From: Daniele Varrazzo Date: Tue, 11 Feb 2025 21:23:50 +0000 (+0100) Subject: chore: add isort configuration X-Git-Tag: 3.2.5~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b22e34d4c96f97ff930682285927c753afc0f724;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/setup.cfg b/psycopg/setup.cfg index 1c23bd917..c4a645f29 100644 --- a/psycopg/setup.cfg +++ b/psycopg/setup.cfg @@ -79,6 +79,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: