From: Daniele Varrazzo Date: Tue, 11 Feb 2025 21:23:50 +0000 (+0100) Subject: chore: add isort configuration X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2b0932903eccf81c49c765c63d4e037d01bf951;p=thirdparty%2Fpsycopg.git chore: add isort configuration --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 082386b67..9c27ef8ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,3 +32,9 @@ repos: language: system entry: mypy --pretty --follow-imports=silent files: \.py[i]?$ + + - id: isort + name: isort + language: system + entry: isort + files: \.(py[i]?|pxd|pyx)$ diff --git a/psycopg/pyproject.toml b/psycopg/pyproject.toml index a5df9b80b..f3a291f6b 100644 --- a/psycopg/pyproject.toml +++ b/psycopg/pyproject.toml @@ -83,6 +83,8 @@ dev = [ "codespell >= 2.2", "dnspython >= 2.1", "flake8 >= 4.0", + "isort >= 6.0", + "isort-psycopg", "mypy >= 1.14", "pre-commit >= 4.0.1", "types-setuptools >= 57.4", diff --git a/pyproject.toml b/pyproject.toml index ce539c1d4..f684b6489 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,3 +64,9 @@ disallow_untyped_calls = false [tool.codespell] ignore-words-list = "alot,ans,ba,fo,te,erro,varning" skip = "build,_build,.tox,.mypy_cache,.venv,pq.c,_psycopg.c,*.html" + +[tool.isort] +profile = "black" +length_sort = true +multi_line_output = 9 +sort_order = "psycopg" # requires the isort-psycopg module diff --git a/tools/async_to_sync.py b/tools/async_to_sync.py index 563214444..ae4d755cc 100755 --- a/tools/async_to_sync.py +++ b/tools/async_to_sync.py @@ -132,6 +132,7 @@ def convert(fpin: Path, fpout: Path) -> None: print(output, file=f) sp.check_call(["black", "-q", str(fpout)]) + sp.check_call(["isort", "-q", str(fpout)]) def check(outputs: list[str]) -> int: