From bf8d11f79f613af120c05887b0f8f56e0c8571bc Mon Sep 17 00:00:00 2001 From: Artem Hotenov Date: Sun, 11 Aug 2024 19:25:56 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(nox):=20Replace=20'reorder?= =?UTF-8?q?-python-imports'=20with=20'isort'=20pre-commit=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reason: https://github.com/psf/black/issues/4175#issuecomment-2036987251 Black 24+ and reorder-python-imports have incompatible opinions on whether there should be a blank line after a docstring. Enable 'mypy' session back --- .pre-commit-config.yaml | 5 +++++ noxfile.py | 7 +++++-- pyproject.toml | 10 ++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e67f2e6..5a14f53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,6 +50,11 @@ repos: # language: system # types: [python] # args: [--application-directories=src] + - id: isort + name: Organize Python imports (via isort) + entry: isort + language: system + types: [python] - id: trailing-whitespace name: Trim Trailing Whitespace entry: trailing-whitespace-fixer diff --git a/noxfile.py b/noxfile.py index 8a3b8f6..73f0e31 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,4 +1,5 @@ """Nox sessions.""" + import shutil import sys from pathlib import Path @@ -6,6 +7,7 @@ import nox + try: from nox_poetry import Session from nox_poetry import session @@ -23,9 +25,9 @@ python_versions = ["3.11", "3.12"] nox.needs_version = ">= 2021.6.6" nox.options.sessions = ( - # "pre-commit", + "pre-commit", "safety", - # "mypy", + "mypy", "tests", "typeguard", "xdoctest", @@ -98,6 +100,7 @@ def precommit(session: Session) -> None: "pep8-naming", "pre-commit", "pre-commit-hooks", + "isort", # "reorder-python-imports", ) session.run("pre-commit", *args) diff --git a/pyproject.toml b/pyproject.toml index 47e53b1..f1abe7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,10 @@ classifiers = [ [tool.poetry.urls] Changelog = "https://github.com/hotenov/LEP-downloader/releases" +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + [tool.poetry.dependencies] python = "^3.11" @@ -67,7 +71,6 @@ Pygments = "^2.18.0" furo = ">=2024.8.6" - [tool.poetry.scripts] lep-downloader = "lep_downloader.__main__:main" lep-dl = "lep_downloader.__main__:main" @@ -84,6 +87,7 @@ source = ["lep_downloader"] show_missing = true fail_under = 100 + [tool.mypy] strict = true warn_unreachable = true @@ -110,12 +114,10 @@ module = [ ] ignore_missing_imports = true -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" [tool.isort] force_single_line = true +profile = "black" force_sort_within_sections = false lexicographical = true order_by_type = false