Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ node_modules/
.envrc
.direnv/

# setuptools_scm
arango/version.py

# test results
*_results.txt

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 26.1.0
hooks:
- id: black

Expand All @@ -29,7 +29,7 @@ repos:
args: [ --profile, black ]

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.3.0
hooks:
- id: flake8

Expand Down
6 changes: 2 additions & 4 deletions arango/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from json import dumps, loads
from typing import Any, Callable, Optional, Sequence, Union

import importlib_metadata

from arango.connection import (
BasicConnection,
Connection,
Expand All @@ -27,6 +25,7 @@
RoundRobinHostResolver,
SingleHostResolver,
)
from arango.version import __version__


def default_serializer(x: Any) -> str:
Expand Down Expand Up @@ -175,8 +174,7 @@ def version(self) -> str:
:return: Client version.
:rtype: str
"""
version: str = importlib_metadata.version("python-arango")
return version
return __version__

@property
def request_timeout(self) -> Any:
Expand Down
14 changes: 4 additions & 10 deletions arango/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,9 +871,7 @@ def find_near(
query = """
FOR doc IN NEAR(@collection, @latitude, @longitude{})
RETURN doc
""".format(
"" if limit is None else ", @limit "
)
""".format("" if limit is None else ", @limit ")

bind_vars = {
"collection": self._name,
Expand Down Expand Up @@ -996,9 +994,7 @@ def find_in_radius(
query = """
FOR doc IN WITHIN(@@collection, @latitude, @longitude, @radius{})
RETURN doc
""".format(
"" if distance_field is None else ", @distance"
)
""".format("" if distance_field is None else ", @distance")

bind_vars = {
"@collection": self._name,
Expand Down Expand Up @@ -1080,7 +1076,7 @@ def build_coord_str_from_index(index: Json) -> str:
coord_str = ""
if index is None:
# Find the first geo index
for collection_index in self.indexes(): # type:ignore[union-attr]
for collection_index in self.indexes(): # type: ignore[union-attr]
if collection_index["type"] == "geo":
coord_str = build_coord_str_from_index(collection_index)
break
Expand Down Expand Up @@ -1168,9 +1164,7 @@ def find_by_text(
aql = """
FOR doc IN FULLTEXT(@collection, @field, @query{})
RETURN doc
""".format(
"" if limit is None else ", @limit"
)
""".format("" if limit is None else ", @limit")

request = Request(
method="post",
Expand Down
3 changes: 2 additions & 1 deletion arango/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, MutableMapping, Optional

from arango.typings import DriverFlags, Fields, Headers, Params
from arango.version import __version__


def normalize_headers(
Expand All @@ -12,7 +13,7 @@ def normalize_headers(
if driver_flags is not None:
for flag in driver_flags:
flags = flags + flag + ";"
driver_version = "8.2.5"
driver_version = __version__
driver_header = "python-arango/" + driver_version + " (" + flags + ")"
normalized_headers: Headers = {
"charset": "utf-8",
Expand Down
1 change: 1 addition & 0 deletions arango/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "8.2.6"
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
requests_toolbelt
importlib_metadata
PyJWT
sphinx_rtd_theme
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ keywords = ["arangodb", "python", "driver"]
readme = "README.md"
dynamic = ["version"]
license = { file = "LICENSE" }
requires-python = ">=3.9"
requires-python = ">=3.10"

classifiers = [
"Intended Audience :: Developers",
Expand All @@ -39,15 +39,16 @@ dependencies = [
"requests",
"requests_toolbelt",
"PyJWT",
"setuptools>=42",
"importlib_metadata>=4.7.1",
"packaging>=23.1",
]

[tool.setuptools.dynamic]
version = { attr = "arango.version.__version__" }

[project.optional-dependencies]
dev = [
"black>=22.3.0",
"flake8>=4.0.1",
"black==26.1.0",
"flake8==7.3.0",
"isort>=5.10.1",
"mypy>=0.942",
"mock",
Expand Down
4 changes: 1 addition & 3 deletions tests/test_aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def test_aql_query_management(db_version, db, sys_db, bad_db, col, docs):
FOR d IN {col}
UPDATE {{_key: d._key, _val: @val }} IN {col}
RETURN NEW
""".format(
col=col.name
),
""".format(col=col.name),
count=True,
# batch_size=1,
ttl=10,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pickle
from typing import Union

import importlib_metadata
import pytest
from requests import Session

Expand All @@ -11,6 +10,7 @@
from arango.exceptions import ArangoClientError, ServerConnectionError
from arango.http import DefaultHTTPClient, DeflateRequestCompression
from arango.resolver import FallbackHostResolver, RandomHostResolver, SingleHostResolver
from arango.version import __version__
from tests.helpers import (
generate_col_name,
generate_db_name,
Expand All @@ -23,7 +23,7 @@ def test_client_attributes(url):
http_client = DefaultHTTPClient()

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

assert repr(client) == f"<ArangoClient {url}>"
Expand All @@ -38,7 +38,7 @@ def test_client_attributes(url):
serializer=json.dumps,
deserializer=json.loads,
)
assert client.version == importlib_metadata.version("python-arango")
assert client.version == __version__
assert client.hosts == client_hosts
assert repr(client) == client_repr
assert isinstance(client._host_resolver, FallbackHostResolver)
Expand All @@ -50,7 +50,7 @@ def test_client_attributes(url):
serializer=json.dumps,
deserializer=json.loads,
)
assert client.version == importlib_metadata.version("python-arango")
assert client.version == __version__
assert client.hosts == client_hosts
assert repr(client) == client_repr
assert isinstance(client._host_resolver, RandomHostResolver)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ def test_cursor_write_query(db, col, docs):
FOR d IN {col} FILTER d._key == @first OR d._key == @second
UPDATE {{_key: d._key, _val: @val }} IN {col}
RETURN NEW
""".format(
col=col.name
),
""".format(col=col.name),
bind_vars={"first": "1", "second": "2", "val": 42},
count=True,
batch_size=1,
Expand Down
Loading