Skip to content

Commit 8562b29

Browse files
committed
No longer using setuptools and importlib as direct dependencies
1 parent c60f4ea commit 8562b29

File tree

9 files changed

+18
-32
lines changed

9 files changed

+18
-32
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- id: trailing-whitespace
1919

2020
- repo: https://github.com/psf/black
21-
rev: 23.1.0
21+
rev: 26.1.0
2222
hooks:
2323
- id: black
2424

@@ -29,7 +29,7 @@ repos:
2929
args: [ --profile, black ]
3030

3131
- repo: https://github.com/PyCQA/flake8
32-
rev: 6.0.0
32+
rev: 7.3.0
3333
hooks:
3434
- id: flake8
3535

arango/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from json import dumps, loads
44
from typing import Any, Callable, Optional, Sequence, Union
55

6-
import importlib_metadata
7-
6+
from arango import version
87
from arango.connection import (
98
BasicConnection,
109
Connection,
@@ -175,8 +174,7 @@ def version(self) -> str:
175174
:return: Client version.
176175
:rtype: str
177176
"""
178-
version: str = importlib_metadata.version("python-arango")
179-
return version
177+
return version.__version__
180178

181179
@property
182180
def request_timeout(self) -> Any:

arango/collection.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,7 @@ def find_near(
871871
query = """
872872
FOR doc IN NEAR(@collection, @latitude, @longitude{})
873873
RETURN doc
874-
""".format(
875-
"" if limit is None else ", @limit "
876-
)
874+
""".format("" if limit is None else ", @limit ")
877875

878876
bind_vars = {
879877
"collection": self._name,
@@ -996,9 +994,7 @@ def find_in_radius(
996994
query = """
997995
FOR doc IN WITHIN(@@collection, @latitude, @longitude, @radius{})
998996
RETURN doc
999-
""".format(
1000-
"" if distance_field is None else ", @distance"
1001-
)
997+
""".format("" if distance_field is None else ", @distance")
1002998

1003999
bind_vars = {
10041000
"@collection": self._name,
@@ -1080,7 +1076,7 @@ def build_coord_str_from_index(index: Json) -> str:
10801076
coord_str = ""
10811077
if index is None:
10821078
# Find the first geo index
1083-
for collection_index in self.indexes(): # type:ignore[union-attr]
1079+
for collection_index in self.indexes(): # type: ignore[union-attr]
10841080
if collection_index["type"] == "geo":
10851081
coord_str = build_coord_str_from_index(collection_index)
10861082
break
@@ -1168,9 +1164,7 @@ def find_by_text(
11681164
aql = """
11691165
FOR doc IN FULLTEXT(@collection, @field, @query{})
11701166
RETURN doc
1171-
""".format(
1172-
"" if limit is None else ", @limit"
1173-
)
1167+
""".format("" if limit is None else ", @limit")
11741168

11751169
request = Request(
11761170
method="post",

arango/request.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Any, MutableMapping, Optional
44

5+
from arango import version
56
from arango.typings import DriverFlags, Fields, Headers, Params
67

78

@@ -12,7 +13,7 @@ def normalize_headers(
1213
if driver_flags is not None:
1314
for flag in driver_flags:
1415
flags = flags + flag + ";"
15-
driver_version = "8.2.5"
16+
driver_version = version.__version__
1617
driver_header = "python-arango/" + driver_version + " (" + flags + ")"
1718
normalized_headers: Headers = {
1819
"charset": "utf-8",

docs/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
requests_toolbelt
2-
importlib_metadata
32
PyJWT
43
sphinx_rtd_theme

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ dependencies = [
3939
"requests",
4040
"requests_toolbelt",
4141
"PyJWT",
42-
"setuptools>=42",
43-
"importlib_metadata>=4.7.1",
4442
"packaging>=23.1",
4543
]
4644

4745
[project.optional-dependencies]
4846
dev = [
49-
"black>=22.3.0",
50-
"flake8>=4.0.1",
47+
"black==26.1.0",
48+
"flake8==7.3.0",
5149
"isort>=5.10.1",
5250
"mypy>=0.942",
5351
"mock",

tests/test_aql.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ def test_aql_query_management(db_version, db, sys_db, bad_db, col, docs):
110110
FOR d IN {col}
111111
UPDATE {{_key: d._key, _val: @val }} IN {col}
112112
RETURN NEW
113-
""".format(
114-
col=col.name
115-
),
113+
""".format(col=col.name),
116114
count=True,
117115
# batch_size=1,
118116
ttl=10,

tests/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import pickle
33
from typing import Union
44

5-
import importlib_metadata
65
import pytest
76
from requests import Session
87

8+
from arango import version
99
from arango.client import ArangoClient
1010
from arango.database import StandardDatabase
1111
from arango.exceptions import ArangoClientError, ServerConnectionError
@@ -23,7 +23,7 @@ def test_client_attributes(url):
2323
http_client = DefaultHTTPClient()
2424

2525
client = ArangoClient(hosts=url, http_client=http_client)
26-
assert client.version == importlib_metadata.version("python-arango")
26+
assert client.version == version.__version__
2727
assert client.hosts == [url]
2828

2929
assert repr(client) == f"<ArangoClient {url}>"
@@ -38,7 +38,7 @@ def test_client_attributes(url):
3838
serializer=json.dumps,
3939
deserializer=json.loads,
4040
)
41-
assert client.version == importlib_metadata.version("python-arango")
41+
assert client.version == version.__version__
4242
assert client.hosts == client_hosts
4343
assert repr(client) == client_repr
4444
assert isinstance(client._host_resolver, FallbackHostResolver)
@@ -50,7 +50,7 @@ def test_client_attributes(url):
5050
serializer=json.dumps,
5151
deserializer=json.loads,
5252
)
53-
assert client.version == importlib_metadata.version("python-arango")
53+
assert client.version == version.__version__
5454
assert client.hosts == client_hosts
5555
assert repr(client) == client_repr
5656
assert isinstance(client._host_resolver, RandomHostResolver)

tests/test_cursor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ def test_cursor_write_query(db, col, docs):
113113
FOR d IN {col} FILTER d._key == @first OR d._key == @second
114114
UPDATE {{_key: d._key, _val: @val }} IN {col}
115115
RETURN NEW
116-
""".format(
117-
col=col.name
118-
),
116+
""".format(col=col.name),
119117
bind_vars={"first": "1", "second": "2", "val": 42},
120118
count=True,
121119
batch_size=1,

0 commit comments

Comments
 (0)