Skip to content
Merged
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
44 changes: 23 additions & 21 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@
LINT_PATH = "./src"
REQUIREMENTS_PATH = "./requirements"


LINTING_COMMANDS = (
(
"isort",
"--verbose",
"--force-single-line-imports",
"--profile",
"black",
"--add-import",
"from __future__ import annotations",
LINT_PATH,
TESTS_PATH,
),
("black", "--verbose", LINT_PATH, TESTS_PATH),
("flake8", "--show-source", "--verbose", LINT_PATH, TESTS_PATH),
("mypy", "--no-incremental", "--package", MODULE_NAME),
("mypy", "--no-incremental", TESTS_PATH),
)

# What we allowed to clean (delete)
CLEANABLE_TARGETS = [
"./dist",
Expand Down Expand Up @@ -55,10 +74,7 @@ def dev(session: nox.Session) -> None:
python = partial(session.run, f"{venv_path}/python", "-m")
contraint = ("--constraint", f"{REQUIREMENTS_PATH}/constraints.txt")

for requirement_file in get_requirement_files():
python("pip", "install", "-r", requirement_file, *contraint, external=True)

python("pip", "install", "--editable", ".", *contraint, external=True)
python("pip", "install", "--editable", ".[dev,test]", *contraint, external=True)

python("pip", "install", "pre-commit", external=True)
session.run(f"{venv_path}/pre-commit", "install", external=True)
Expand Down Expand Up @@ -109,26 +125,12 @@ def run_linters_and_formatters(session: nox.Session) -> None:
print_standard_logs(session)

contraint = ("--constraint", f"{REQUIREMENTS_PATH}/constraints.txt")
session.install(".[dev]", *contraint)
session.install(".[dev,test]", *contraint)

python = partial(session.run, "python", "-m")

# Handle anything tool that applies corrections first.
python(
"isort",
"--verbose",
"--force-single-line-imports",
"--profile",
"black",
"--add-import",
"from __future__ import annotations",
LINT_PATH,
)
python("black", "--verbose", LINT_PATH)

# Linters: aka, things that yell but want you to fix things
python("flake8", "--show-source", "--verbose", LINT_PATH)
python("mypy", "--no-incremental", "--package", MODULE_NAME)
for linter_command in LINTING_COMMANDS:
python(*linter_command)


@nox.session()
Expand Down