Skip to content

Commit

Permalink
Use isort to sort imports (#481)
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 authored Feb 9, 2024
1 parent a5613f8 commit 6a52063
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@ repos:
- id: blacken-docs
additional_dependencies:
- black==23.1.0
- 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/app: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
1 change: 0 additions & 1 deletion example/app/testapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from django.urls import path

from testapp import views

urlpatterns = [
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ Repository = "https://github.com/adamchainz/apig-wsgi"
[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
9 changes: 7 additions & 2 deletions src/apig_wsgi/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
else:
# Partial backport of wsgiref.types
from types import TracebackType
from typing import Any, Callable, Dict, Iterable, Tuple, Type, Union

from typing import Any
from typing import Callable
from typing import Dict
from typing import Iterable
from typing import Protocol
from typing import Tuple
from typing import Type
from typing import Union

_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]]
Expand Down

0 comments on commit 6a52063

Please sign in to comment.