55
66nox .options .sessions = ["test" , "lint" ]
77
8+ _DEFAULT_PYTHON = "3.13"
9+ _ALL_PYTHON = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
810
9- @nox .session (python = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ])
10- def test (session ):
11- session .install ("-e" , ".[test]" )
11+
12+ @nox .session (python = _ALL_PYTHON )
13+ def pytest (session ):
14+ session .install ("-e" , ".[tests]" )
1215
1316 options = session .posargs
1417 if "-k" in options :
@@ -17,10 +20,102 @@ def test(session):
1720 session .run ("pytest" , "-v" , * options )
1821
1922
20- @nox .session
21- def lint (session ):
22- session .install ("-e" , ".[test]" )
23- session .run ("black" , "--check" , "--diff" , "--color" , "." )
24- # This represents Devrel's copy-and-paste linting.
25- # session.run("flake8", *source_files)
26- # session.run('yapf', '--diff', '-r', *source_files)
23+ @nox .session (python = _DEFAULT_PYTHON )
24+ def semgrep_src (session ):
25+ session .install ("-e" , ".[tests]" )
26+ # session.run("semgrep", "scan", "--strict", "--verbose", "--error", "--junit-xml", "--junit-xml-output=semgrep-src.xml", "src")
27+ session .run ("semgrep" , "scan" , "--strict" , "--verbose" , "--error" , "src" )
28+
29+
30+ @nox .session (name = "black-lint" , python = _DEFAULT_PYTHON )
31+ def black_lint (session ):
32+ session .install ("-e" , ".[tests]" )
33+ session .run ("black" , "--verbose" , "--check" , "--diff" , "--color" , "." )
34+
35+
36+ @nox .session (python = _DEFAULT_PYTHON )
37+ def black_format (session ):
38+ session .install ("-e" , ".[tests]" )
39+ session .run ("black" , "--verbose" , "." )
40+
41+
42+ @nox .session (python = _DEFAULT_PYTHON )
43+ def mypy (session ):
44+ session .install ("-e" , ".[tests, examples]" )
45+ session .run ("mypy" , "--install-type" , "--non-interactive" , "--junit-xml" , "mypy.xml" )
46+
47+
48+ @nox .session (python = _DEFAULT_PYTHON )
49+ def pyflakes_src (session ):
50+ session .install ("-e" , ".[tests]" )
51+ session .run ("pyflakes" , "src" )
52+
53+
54+ @nox .session (python = _DEFAULT_PYTHON )
55+ def pyflakes_examples (session ):
56+ session .install ("-e" , ".[tests, examples]" )
57+ session .run ("pyflakes" , "docs/examples" )
58+
59+
60+ @nox .session (python = _DEFAULT_PYTHON )
61+ def pyflakes_tests (session ):
62+ session .install ("-e" , ".[tests]" )
63+ session .run ("pyflakes" , "tests" )
64+
65+
66+ @nox .session (python = _DEFAULT_PYTHON )
67+ def pylint_src (session ):
68+ session .install ("-e" , ".[tests]" )
69+ session .run ("pylint" , "src" )
70+
71+
72+ @nox .session (python = _DEFAULT_PYTHON )
73+ def pylint_examples (session ):
74+ session .install ("-e" , ".[tests, examples]" )
75+ session .run ("pylint" , "docs/examples" )
76+
77+
78+ @nox .session (python = _DEFAULT_PYTHON )
79+ def pylint_tests (session ):
80+ session .install ("-e" , ".[tests]" )
81+ session .run ("pylint" , "--disable" , "protected-access" , "--disable" , "unused-variable" , "tests" )
82+
83+
84+ @nox .session (python = _DEFAULT_PYTHON )
85+ def build_wheel (session ):
86+ session .install ("-e" , ".[build]" )
87+ session .run ("pyproject-build" )
88+ # session.run("simple503", "-B", "dist", "dist")
89+
90+
91+ @nox .session (python = _DEFAULT_PYTHON )
92+ def build_local_dist (session ):
93+ session .install ("-e" , ".[build]" )
94+ session .run ("pyproject-build" )
95+ session .run ("simple503" , "-B" , "dist" , "dist" )
96+
97+
98+ @nox .session (python = _DEFAULT_PYTHON )
99+ def mkdocs_build (session ):
100+ session .install ("-e" , ".[docs]" )
101+ session .run ("mkdocs" , "-v" , "build" )
102+
103+
104+ @nox .session (python = _DEFAULT_PYTHON )
105+ def mkdocs_serve (session ):
106+ session .install ("-e" , ".[docs]" )
107+ session .run ("mkdocs" , "-v" , "serve" )
108+
109+
110+ @nox .session (python = _DEFAULT_PYTHON )
111+ def pyblish_pypi (session ):
112+ session .install ("-e" , ".[build]" )
113+ # TODO
114+ assert False
115+
116+
117+ @nox .session (python = _DEFAULT_PYTHON )
118+ def pyblish_readthedocs (session ):
119+ session .install ("-e" , ".[build, docs]" )
120+ # TODO
121+ assert False
0 commit comments