-
Notifications
You must be signed in to change notification settings - Fork 4
/
noxfile.py
62 lines (49 loc) · 1.84 KB
/
noxfile.py
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
58
59
60
61
62
import nox
nox.options.error_on_external_run = True
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ['coverage', 'docs', 'ruff']
@nox.session()
def coverage(session):
session.install('-e', '.[dev]') # -e needed for coverage in newer pytest...
session.run(
'pytest', '--import-mode=importlib', '--cov=s2cell', '--cov-report', 'term-missing',
'--cov-branch', '--cov-fail-under=100', '-n', 'auto', '--instafail', *session.posargs
)
@nox.session()
def ruff(session):
session.install('.[dev]')
session.run('ruff', 'check', 's2cell', 'tests', *session.posargs)
@nox.session()
def test(session):
session.install('-e', '.[dev]')
session.run('pytest', '--import-mode=importlib', '-n', 'auto', '--instafail', *session.posargs)
@nox.session()
def build_wheel(session):
session.install('wheel')
session.run('python', 'setup.py', 'bdist_wheel')
@nox.session()
def docs(session):
session.install('-e', '.[dev]')
session.run(
'python', '-m', 'sphinx',
'-c', 'docs/',
'-a', # Update all output files
'-E', # Do not reuse environment from previous run
'-T', # Show full trace on error
'-W', # Treat warnings as errors
'--keep-going', # When using -W, only exit after all warnings shown
#'-j', 'auto', # Generate in parallel
'docs', 'docs/build',
)
@nox.session()
def upload_release(session):
# Add requirements for building wheel and uploading to PyPI
session.install('wheel', 'twine')
# Clear out old dist files if they exist
session.run('rm', '-rf', 'dist', external=True)
# Build sdist and wheel
session.run('python', 'setup.py', 'sdist', 'bdist_wheel')
# Check description with twine
session.run('twine', 'check', 'dist/*')
# Upload to PyPI
session.run('twine', 'upload', 'dist/*')