Skip to content

Commit

Permalink
Use isort to sort imports (#320)
Browse files Browse the repository at this point in the history
Switching because reorder-python-imports is incompatible with Black 24:
asottile/reorder-python-imports#366 /
psf/black#4175 .
  • Loading branch information
adamchainz committed Feb 9, 2024
1 parent 5e226ad commit 1678b05
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Expand Up @@ -43,16 +43,11 @@ repos:
additional_dependencies:
- black==23.1.0
files: '\.rst$'
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
args:
- --py38-plus
- --application-directories
- .:example:src
- --add-import
- 'from __future__ import annotations'
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Expand Up @@ -39,6 +39,13 @@ blacken-docs = "blacken_docs:main"
[tool.black]
target-version = ['py38']

[tool.isort]
add_imports = [
"from __future__ import annotations"
]
force_single_line = true
profile = "black"

[tool.pytest.ini_options]
addopts = """\
--strict-config
Expand Down
1 change: 0 additions & 1 deletion src/blacken_docs/__init__.py
Expand Up @@ -12,7 +12,6 @@
from black.const import DEFAULT_LINE_LENGTH
from black.mode import TargetVersion


PYGMENTS_PY_LANGS = frozenset(("python", "py", "sage", "python3", "py3", "numpy"))
PYGMENTS_PY_LANGS_RE_FRAGMENT = f"({'|'.join(PYGMENTS_PY_LANGS)})"
MD_RE = re.compile(
Expand Down
1 change: 0 additions & 1 deletion tests/test_blacken_docs.py
Expand Up @@ -8,7 +8,6 @@
import blacken_docs
from blacken_docs import __main__ # noqa: F401


BLACK_MODE = black.FileMode(line_length=DEFAULT_LINE_LENGTH)


Expand Down

0 comments on commit 1678b05

Please sign in to comment.