Skip to content

Commit

Permalink
πŸ‘· Replace reorder-python-imports with isort (#741)
Browse files Browse the repository at this point in the history
* βž• [poetry] Add isort 5.10.1

* πŸ”§ [nox] Add isort to lint dependencies

* πŸ”§ [pre-commit] Replace reorder-python-imports hook by isort

* πŸ”§ [isort] Use black profile

* πŸ”§ [isort] Force single line per import

* πŸ”§ [isort] Force double blank line after imports

* πŸ’„ [nox] Add double blank line after imports

* πŸ”§ [nox] Remove reorder-python-imports from lint dependencies

* βž– [poetry] Remove reorder-python-imports
  • Loading branch information
cjolowicz committed Dec 25, 2021
1 parent d908c8a commit f196e3c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 70 deletions.
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ repos:
language: system
types: [python]
require_serial: true
- id: isort
name: isort
entry: isort
require_serial: true
language: system
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
language: system
types: [python]
args: [--py37-plus]
- id: reorder-python-imports
name: Reorder python imports
entry: reorder-python-imports
language: system
types: [python]
args: [--application-directories=src]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
Expand Down
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import nox


try:
from nox_poetry import Session
from nox_poetry import session
Expand Down Expand Up @@ -116,11 +117,11 @@ def precommit(session: Session) -> None:
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
"isort",
"pep8-naming",
"pre-commit",
"pre-commit-hooks",
"pyupgrade",
"reorder-python-imports",
)
session.run("pre-commit", *args)
if args and args[0] == "install":
Expand Down
81 changes: 19 additions & 62 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ flake8-docstrings = "^1.6.0"
flake8-rst-docstrings = "^0.2.5"
pep8-naming = "^0.12.1"
darglint = "^1.8.1"
reorder-python-imports = "^2.6.0"
pre-commit-hooks = "^4.0.1"
sphinx-click = "^3.0.2"
Pygments = "^2.10.0"
pyupgrade = "^2.29.1"
furo = ">=2021.11.12"
isort = "^5.10.1"

[tool.poetry.scripts]
cookiecutter-hypermodern-python-instance = "cookiecutter_hypermodern_python_instance.__main__:main"
Expand All @@ -59,6 +59,11 @@ source = ["cookiecutter_hypermodern_python_instance", "tests"]
show_missing = true
fail_under = 100

[tool.isort]
profile = "black"
force_single_line = true
lines_after_imports = 2

[tool.mypy]
strict = true
warn_unreachable = true
Expand Down

0 comments on commit f196e3c

Please sign in to comment.