-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
57 lines (46 loc) · 1.52 KB
/
noxfile.py
File metadata and controls
57 lines (46 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""This file contains the configuration for Nox sessions.
This file defines the following Nox sessions:
- test: Installs dependencies, runs setup.py, and runs pytest.
- format: Fixes common convention problems automatically using black and isort.
- lint: Checks code conventions using flake8.
- typing: Checks type hints using mypy.
"""
import nox
@nox.session(name="test")
def test_pad(session):
session.install("pytest")
session.install("numpy")
session.install("torch")
session.install("build")
session.run("python", "-m", "build", "--no-isolation")
session.install("dist/sympad-0.0.1-cp312-cp312-linux_x86_64.whl")
session.run("pytest")
@nox.session(name="format")
def format(session):
"""Fix common convention problems automatically."""
session.install("black")
session.install("isort")
session.run("isort", ".")
session.run("black", ".")
@nox.session(name="lint")
def lint(session):
"""Check code conventions."""
session.install("flake8")
session.install(
"flake8-black",
"flake8-docstrings",
"flake8-bugbear",
"flake8-broken-line",
"pep8-naming",
"pydocstyle",
"darglint",
)
session.run("flake8", "test", "noxfile.py")
session.install("sphinx", "doc8")
session.run("doc8", "--max-line-length", "120", "docs/")
@nox.session(name="typing")
def mypy(session):
"""Check type hints."""
session.install("torch")
session.install("mypy")
session.run("mypy", "--ignore-missing-imports", "test")