-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: GitHub <[email protected]>
- Loading branch information
1 parent
70ee6c1
commit 5a59c1d
Showing
5 changed files
with
54 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Noxfile.""" | ||
|
||
import shutil | ||
from pathlib import Path | ||
|
||
import nox | ||
|
||
nox.options.default_venv_backend = "none" | ||
nox.options.sessions = ["lints"] | ||
|
||
|
||
CLEANABLE_TARGETS = [ | ||
"./dist", | ||
"./build", | ||
"./.nox", | ||
"./.coverage", | ||
"./.coverage.*", | ||
"./coverage.json", | ||
"./**/.mypy_cache", | ||
"./**/.pytest_cache", | ||
"./**/__pycache__", | ||
"./**/*.pyc", | ||
"./**/*.pyo", | ||
] | ||
|
||
|
||
@nox.session | ||
def tests(session: nox.Session) -> None: | ||
"""Run tests.""" | ||
session.run("pytest") | ||
|
||
|
||
@nox.session | ||
def lints(session: nox.Session) -> None: | ||
"""Run lints.""" | ||
session.run("pre-commit", "run", "--all-files") | ||
session.run("ruff", "format", ".") | ||
session.run("ruff", "check", "--fix", ".") | ||
session.run("mypy", "--strict", "src/") | ||
|
||
|
||
@nox.session | ||
def clean(_: nox.Session) -> None: | ||
"""Clean cache, .pyc, .pyo, and test/build artifact files from project.""" | ||
count = 0 | ||
for searchpath in CLEANABLE_TARGETS: | ||
for filepath in Path().glob(searchpath): | ||
if filepath.is_dir(): | ||
shutil.rmtree(filepath) | ||
else: | ||
filepath.unlink() | ||
count += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters