-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoxfile.py
More file actions
executable file
·73 lines (53 loc) · 1.59 KB
/
Copy pathnoxfile.py
File metadata and controls
executable file
·73 lines (53 loc) · 1.59 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["nox>=2025.2.9"]
# ///
"""Nox runner."""
from __future__ import annotations
import shutil
from pathlib import Path
import nox
DIR = Path(__file__).parent.resolve()
PROJECT = nox.project.load_toml()
nox.needs_version = ">=2025.2.9"
nox.options.default_venv_backend = "uv|virtualenv"
nox.options.stop_on_first_error = True
PYTHON_VERSION = "3.11"
@nox.session(python=[PYTHON_VERSION])
def lint(session: nox.Session) -> None:
"""
Run the linter.
"""
session.install("prek")
session.run(
"prek", "run", "--all-files", "--show-diff-on-failure", *session.posargs
)
@nox.session(python=[PYTHON_VERSION])
def pylint(session: nox.Session) -> None:
"""
Run Pylint.
"""
# This needs to be installed into the package environment, and is slower
# than a pre-commit check
session.install("-e.", "pylint>=3.2")
session.run("pylint", "nsidc.icesat2gis", *session.posargs)
@nox.session(python=[PYTHON_VERSION])
def tests(session: nox.Session) -> None:
"""
Run the unit and regular tests.
"""
test_deps = nox.project.dependency_groups(PROJECT, "test")
session.install("-e.", *test_deps)
session.run("pytest", *session.posargs)
@nox.session(default=False, python=[PYTHON_VERSION])
def build(session: nox.Session) -> None:
"""
Build an SDist and wheel.
"""
build_path = DIR.joinpath("build")
if build_path.exists():
shutil.rmtree(build_path)
session.install("build")
session.run("python", "-m", "build")
if __name__ == "__main__":
nox.main()