Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ‘· Replace reorder-python-imports with isort #702

Merged
merged 2 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ repos:
language: system
types: [python]
require_serial: true
- id: reorder-python-imports
name: Reorder python imports
entry: reorder-python-imports
- id: isort
name: isort
entry: isort
require_serial: true
language: system
types: [python]
args: [--application-directories=src]
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def precommit(session: Session) -> None:
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
"isort",
"pep8-naming",
"pre-commit",
"pre-commit-hooks",
"reorder-python-imports",
"pyupgrade",
)
session.run("pre-commit", *args)
Expand Down
62 changes: 19 additions & 43 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 @@ -39,14 +39,14 @@ flake8-docstrings = ">=1.6.0"
flake8-rst-docstrings = ">=0.2.5"
pep8-naming = ">=0.12.1"
darglint = ">=1.8.1"
reorder-python-imports = ">=3.1.0"
pre-commit-hooks = ">=4.1.0"
furo = ">=2022.1.2"
Pygments = ">=2.11.2"
poetry = ">=1.1.12"
pytest-datadir = ">=1.3.1"
typing-extensions = ">=4.0.1"
pyupgrade = ">=2.31.0"
isort = ">=5.10.1"

[tool.coverage.paths]
source = ["src", "*/site-packages"]
Expand All @@ -59,6 +59,11 @@ source = ["nox_poetry"]
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
3 changes: 2 additions & 1 deletion src/nox_poetry/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ from typing import List
from typing import Mapping
from typing import NoReturn
from typing import Optional
from typing import overload
from typing import Sequence
from typing import TypeVar
from typing import Union
from typing import overload

import nox.sessions
import nox.virtualenv


Python = Optional[Union[str, Sequence[str], bool]]

class _PoetrySession:
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from pathlib import Path
from textwrap import dedent
from types import ModuleType
from typing import TYPE_CHECKING
from typing import Any
from typing import Callable
from typing import Iterable
from typing import List
from typing import TYPE_CHECKING

import pytest
import tomlkit.api # https://github.com/sdispater/tomlkit/issues/128
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Functional tests for ``install``."""
import nox.sessions
from tests.functional.conftest import list_packages
from tests.functional.conftest import Project
from tests.functional.conftest import run_nox_with_noxfile

import nox_poetry
from tests.functional.conftest import Project
from tests.functional.conftest import list_packages
from tests.functional.conftest import run_nox_with_noxfile


def test_local_wheel(project: Project) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_installroot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Functional tests for ``installroot``."""
import nox.sessions
from tests.functional.conftest import list_packages
from tests.functional.conftest import Project
from tests.functional.conftest import run_nox_with_noxfile

import nox_poetry
from tests.functional.conftest import Project
from tests.functional.conftest import list_packages
from tests.functional.conftest import run_nox_with_noxfile


def test_wheel(project: Project) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_patch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Functional tests using ``path``."""
import nox.sessions
from tests.functional.conftest import list_packages
from tests.functional.conftest import Project
from tests.functional.conftest import run_nox_with_noxfile

import nox_poetry.patch
from tests.functional.conftest import Project
from tests.functional.conftest import list_packages
from tests.functional.conftest import run_nox_with_noxfile


def test_local(project: Project) -> None:
Expand Down
5 changes: 2 additions & 3 deletions tests/functional/test_poetry.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Functional tests for ``session.poetry``."""
from tests.functional.conftest import list_packages
import nox_poetry
from tests.functional.conftest import Project
from tests.functional.conftest import list_packages
from tests.functional.conftest import run_nox_with_noxfile

import nox_poetry


def test_passthrough_env(project: Project) -> None:
"""It stores requirements even without a virtualenv directory."""
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import nox.sessions
import pytest
from tests.functional.conftest import list_packages
from tests.functional.conftest import Project
from tests.functional.conftest import run_nox_with_noxfile

import nox_poetry.patch
from tests.functional.conftest import Project
from tests.functional.conftest import list_packages
from tests.functional.conftest import run_nox_with_noxfile


def test_local(project: Project) -> None:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import sys
from pathlib import Path
from typing import Any
from typing import cast
from typing import Optional
from typing import cast


if sys.version_info >= (3, 8):
from typing import Protocol
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_sessions.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""Unit tests for the sessions module."""
from textwrap import dedent
from typing import Callable
from typing import cast
from typing import Iterator
from typing import cast

import nox._options
import nox.manifest
import nox.registry
import pytest
from tests.unit.conftest import FakeSession
from tests.unit.conftest import FakeSessionFactory

import nox_poetry
from nox_poetry.sessions import to_constraints # type: ignore[attr-defined]
from tests.unit.conftest import FakeSession
from tests.unit.conftest import FakeSessionFactory


IterSessions = Callable[[], Iterator[str]]
Expand Down