nox-python-standards 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. nox_python_standards-0.2.1/LICENSE +14 -0
  2. nox_python_standards-0.2.1/PKG-INFO +148 -0
  3. nox_python_standards-0.2.1/README.md +135 -0
  4. nox_python_standards-0.2.1/pyproject.toml +93 -0
  5. nox_python_standards-0.2.1/setup.cfg +4 -0
  6. nox_python_standards-0.2.1/src/nox_python_standards/__init__.py +2 -0
  7. nox_python_standards-0.2.1/src/nox_python_standards/__main__.py +6 -0
  8. nox_python_standards-0.2.1/src/nox_python_standards/cli.py +45 -0
  9. nox_python_standards-0.2.1/src/nox_python_standards/config.py +286 -0
  10. nox_python_standards-0.2.1/src/nox_python_standards/py.typed +0 -0
  11. nox_python_standards-0.2.1/src/nox_python_standards/repository.py +83 -0
  12. nox_python_standards-0.2.1/src/nox_python_standards/resources/PYTHON_CONVENTIONS.md +33 -0
  13. nox_python_standards-0.2.1/src/nox_python_standards/resources/ownership.json +15 -0
  14. nox_python_standards-0.2.1/src/nox_python_standards/resources/policy.json +25 -0
  15. nox_python_standards-0.2.1/src/nox_python_standards/resources/versions.json +4 -0
  16. nox_python_standards-0.2.1/src/nox_python_standards/versions.py +134 -0
  17. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/PKG-INFO +148 -0
  18. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/SOURCES.txt +22 -0
  19. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/dependency_links.txt +1 -0
  20. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/entry_points.txt +2 -0
  21. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/requires.txt +1 -0
  22. nox_python_standards-0.2.1/src/nox_python_standards.egg-info/top_level.txt +1 -0
  23. nox_python_standards-0.2.1/test/test_config.py +245 -0
  24. nox_python_standards-0.2.1/test/test_versions.py +285 -0
@@ -0,0 +1,14 @@
1
+ Zero-Clause BSD
2
+
3
+ Copyright (c) 2026 Noxala Inc.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for
6
+ any purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
10
+ OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
11
+ FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
12
+ DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
13
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
14
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: nox-python-standards
3
+ Version: 0.2.1
4
+ Summary: Check and sync complete local copies of Noxala Python standards
5
+ License-Expression: 0BSD
6
+ Project-URL: Repository, https://github.com/noxala/nox-python-standards
7
+ Project-URL: Issues, https://github.com/noxala/nox-python-standards/issues
8
+ Requires-Python: <3.15,>=3.14.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: tomlkit==0.15.0
12
+ Dynamic: license-file
13
+
14
+ # nox-python-standards
15
+
16
+ Shared Noxala Python settings, checked against complete local `pyproject.toml`
17
+ files. Each repository owns its Makefile, hooks, CI and native tool commands.
18
+
19
+ ## Install and adopt
20
+
21
+ Use the Python/uv versions in [pyproject.toml](pyproject.toml), Git, and Node.js
22
+ on PATH for `check`.
23
+
24
+ Add development dependencies with an exact PyPI version and the
25
+ [approved tool versions](src/nox_python_standards/resources/versions.json):
26
+
27
+ ```toml
28
+ [dependency-groups]
29
+ dev = [
30
+ "nox-python-standards==0.2.1",
31
+ "ruff==0.15.14",
32
+ "pyright==1.1.411",
33
+ ]
34
+
35
+ [tool.nox-python-standards]
36
+ sources = ["."]
37
+ dependency-group = "dev"
38
+
39
+ [tool.nox-python-standards.ruff]
40
+ authorized_version = "v0.15.14" # manual approval
41
+ ```
42
+
43
+ Keep local path/exclusion/import settings. Lock and install dependencies, run
44
+ `uv run nox-py-standards sync`, then review and commit the config, lockfile and
45
+ `.noxala/PYTHON_CONVENTIONS.md`. Root agent instructions should require that
46
+ snapshot before Python edits and state repository-specific rules.
47
+
48
+ For upgrades, review the release, update pins/lockfile, install, and explicitly
49
+ sync. Ruff version changes require separate manual approval.
50
+
51
+ ## Check and sync
52
+
53
+ - **`check`** verifies shared settings, ownership, conventions, config discovery,
54
+ exact tool pins, manual Ruff approval and active tool versions. It is read-only;
55
+ tool calls are limited to `--version` probes. Node must exist before probing
56
+ Pyright; the probe selects its bundled pinned release without downloading tools.
57
+ - **`sync`** adopts shared settings and conventions, preserving local settings,
58
+ comments, dependency pins, lockfiles and approval. It needs no Ruff/Pyright
59
+ installation. Invalid TOML, unclassified overrides and competing configs block
60
+ writes. Repeated sync is byte-stable; each changed file is replaced atomically.
61
+
62
+ Run from any consumer subdirectory, or use `nox-py-standards --root /repo check`.
63
+ `python -m nox_python_standards` exposes the same commands. Neither command installs
64
+ dependencies. Repositories control their normal tool execution and environment.
65
+
66
+ From 0.1: `config check/sync` becomes `check/sync`; other commands are removed.
67
+ `check` no longer runs source lint, formatting, headers, typing or tests.
68
+
69
+ ## Native fix policy
70
+
71
+ Checked Ruff settings enforce its exact version and approve PT007 via
72
+ `extend-safe-fixes = ["PT007"]`; other unsafe fixes remain disabled. Keep repair
73
+ recipes local, for example:
74
+
75
+ ```make
76
+ ruff:
77
+ uv run --locked nox-py-standards check
78
+ uv run --locked ruff format .
79
+ uv run --locked ruff check --fix .
80
+ uv run --locked ruff format .
81
+ ```
82
+
83
+ Repeat until stable. CLI flags can override settings; review and test recipes
84
+ to preserve the policy.
85
+
86
+ ## Configuration ownership
87
+
88
+ | Authority | Owns |
89
+ | --- | --- |
90
+ | [policy.json](src/nox_python_standards/resources/policy.json) | Shared settings |
91
+ | [ownership.json](src/nox_python_standards/resources/ownership.json) | Local keys and types |
92
+ | [versions.json](src/nox_python_standards/resources/versions.json) | Exact Ruff/Pyright versions |
93
+
94
+ Shared values must match exactly, even when native defaults agree. Paths,
95
+ exclusions, import classification and approved test exceptions stay local; Tach
96
+ owns generated first-party lists. Unrelated tables are preserved.
97
+
98
+ Unclassified overrides, inheritance, root `ruff.toml`, `.ruff.toml` or
99
+ `pyrightconfig.json`, and nested Ruff configs affecting scoped Git sources fail.
100
+
101
+ Policy originated in [COMO](https://github.com/noxala/como/tree/da28acec147d114270ba4524f51a47a5afb2515e);
102
+ this package has no consumer dependency.
103
+
104
+ ## CI and package development
105
+
106
+ Consumers run `uv run --locked nox-py-standards check` after locked installation,
107
+ before generators/fixes, and first in local pre-commit/pre-push hooks. Require
108
+ the gate unconditionally, then run repository checks. Never auto-sync in CI.
109
+
110
+ For code or packaging changes here:
111
+
112
+ ```sh
113
+ uv sync --locked
114
+ uv run --locked nox-py-standards check
115
+ uv run --locked ruff format --check .
116
+ uv run --locked ruff check .
117
+ uv run --locked pyright --threads 4
118
+ uv run --locked pytest
119
+ uv run --locked python tools/verify_distribution.py
120
+ ```
121
+
122
+ [CI](.github/workflows/ci.yml) runs on Linux/macOS. Distribution verification
123
+ rebuilds from sdist and tests an isolated, non-editable installation, including
124
+ sync without tools and check with missing/present tools.
125
+
126
+ Repository administrators should enable auto-merge and require `quality (Linux)`
127
+ and `quality (macOS)`.
128
+
129
+ ## Publishing
130
+
131
+ Licensed under [0BSD](LICENSE). Releases publish wheels and sdists to
132
+ [PyPI](https://pypi.org/project/nox-python-standards/) through GitHub OIDC;
133
+ no persistent PyPI token is needed.
134
+
135
+ One-time setup: on your [PyPI publishing page](https://pypi.org/manage/account/publishing/),
136
+ add a pending GitHub publisher with project `nox-python-standards`, owner `noxala`,
137
+ repository `nox-python-standards`, workflow `publish.yml`, and environment `pypi`.
138
+ The GitHub repository must have the matching `pypi` environment.
139
+
140
+ For each release, update `project.version` and this installation example, run
141
+ `uv lock`, and merge through the required checks. Publish a GitHub release tagged
142
+ `v<version>` at that merged commit. [Publish](.github/workflows/publish.yml)
143
+ reruns Linux/macOS quality checks, requires the tag to match the package version
144
+ and belong to `master`, builds distributions, then uploads through the `pypi`
145
+ environment. To publish an existing tag, run Publish manually from `master`
146
+ with that tag. A failed upload can be retried before either file is published;
147
+ after a partial upload, inspect PyPI before retrying. Published files cannot be
148
+ overwritten; subsequent changes need a new version.
@@ -0,0 +1,135 @@
1
+ # nox-python-standards
2
+
3
+ Shared Noxala Python settings, checked against complete local `pyproject.toml`
4
+ files. Each repository owns its Makefile, hooks, CI and native tool commands.
5
+
6
+ ## Install and adopt
7
+
8
+ Use the Python/uv versions in [pyproject.toml](pyproject.toml), Git, and Node.js
9
+ on PATH for `check`.
10
+
11
+ Add development dependencies with an exact PyPI version and the
12
+ [approved tool versions](src/nox_python_standards/resources/versions.json):
13
+
14
+ ```toml
15
+ [dependency-groups]
16
+ dev = [
17
+ "nox-python-standards==0.2.1",
18
+ "ruff==0.15.14",
19
+ "pyright==1.1.411",
20
+ ]
21
+
22
+ [tool.nox-python-standards]
23
+ sources = ["."]
24
+ dependency-group = "dev"
25
+
26
+ [tool.nox-python-standards.ruff]
27
+ authorized_version = "v0.15.14" # manual approval
28
+ ```
29
+
30
+ Keep local path/exclusion/import settings. Lock and install dependencies, run
31
+ `uv run nox-py-standards sync`, then review and commit the config, lockfile and
32
+ `.noxala/PYTHON_CONVENTIONS.md`. Root agent instructions should require that
33
+ snapshot before Python edits and state repository-specific rules.
34
+
35
+ For upgrades, review the release, update pins/lockfile, install, and explicitly
36
+ sync. Ruff version changes require separate manual approval.
37
+
38
+ ## Check and sync
39
+
40
+ - **`check`** verifies shared settings, ownership, conventions, config discovery,
41
+ exact tool pins, manual Ruff approval and active tool versions. It is read-only;
42
+ tool calls are limited to `--version` probes. Node must exist before probing
43
+ Pyright; the probe selects its bundled pinned release without downloading tools.
44
+ - **`sync`** adopts shared settings and conventions, preserving local settings,
45
+ comments, dependency pins, lockfiles and approval. It needs no Ruff/Pyright
46
+ installation. Invalid TOML, unclassified overrides and competing configs block
47
+ writes. Repeated sync is byte-stable; each changed file is replaced atomically.
48
+
49
+ Run from any consumer subdirectory, or use `nox-py-standards --root /repo check`.
50
+ `python -m nox_python_standards` exposes the same commands. Neither command installs
51
+ dependencies. Repositories control their normal tool execution and environment.
52
+
53
+ From 0.1: `config check/sync` becomes `check/sync`; other commands are removed.
54
+ `check` no longer runs source lint, formatting, headers, typing or tests.
55
+
56
+ ## Native fix policy
57
+
58
+ Checked Ruff settings enforce its exact version and approve PT007 via
59
+ `extend-safe-fixes = ["PT007"]`; other unsafe fixes remain disabled. Keep repair
60
+ recipes local, for example:
61
+
62
+ ```make
63
+ ruff:
64
+ uv run --locked nox-py-standards check
65
+ uv run --locked ruff format .
66
+ uv run --locked ruff check --fix .
67
+ uv run --locked ruff format .
68
+ ```
69
+
70
+ Repeat until stable. CLI flags can override settings; review and test recipes
71
+ to preserve the policy.
72
+
73
+ ## Configuration ownership
74
+
75
+ | Authority | Owns |
76
+ | --- | --- |
77
+ | [policy.json](src/nox_python_standards/resources/policy.json) | Shared settings |
78
+ | [ownership.json](src/nox_python_standards/resources/ownership.json) | Local keys and types |
79
+ | [versions.json](src/nox_python_standards/resources/versions.json) | Exact Ruff/Pyright versions |
80
+
81
+ Shared values must match exactly, even when native defaults agree. Paths,
82
+ exclusions, import classification and approved test exceptions stay local; Tach
83
+ owns generated first-party lists. Unrelated tables are preserved.
84
+
85
+ Unclassified overrides, inheritance, root `ruff.toml`, `.ruff.toml` or
86
+ `pyrightconfig.json`, and nested Ruff configs affecting scoped Git sources fail.
87
+
88
+ Policy originated in [COMO](https://github.com/noxala/como/tree/da28acec147d114270ba4524f51a47a5afb2515e);
89
+ this package has no consumer dependency.
90
+
91
+ ## CI and package development
92
+
93
+ Consumers run `uv run --locked nox-py-standards check` after locked installation,
94
+ before generators/fixes, and first in local pre-commit/pre-push hooks. Require
95
+ the gate unconditionally, then run repository checks. Never auto-sync in CI.
96
+
97
+ For code or packaging changes here:
98
+
99
+ ```sh
100
+ uv sync --locked
101
+ uv run --locked nox-py-standards check
102
+ uv run --locked ruff format --check .
103
+ uv run --locked ruff check .
104
+ uv run --locked pyright --threads 4
105
+ uv run --locked pytest
106
+ uv run --locked python tools/verify_distribution.py
107
+ ```
108
+
109
+ [CI](.github/workflows/ci.yml) runs on Linux/macOS. Distribution verification
110
+ rebuilds from sdist and tests an isolated, non-editable installation, including
111
+ sync without tools and check with missing/present tools.
112
+
113
+ Repository administrators should enable auto-merge and require `quality (Linux)`
114
+ and `quality (macOS)`.
115
+
116
+ ## Publishing
117
+
118
+ Licensed under [0BSD](LICENSE). Releases publish wheels and sdists to
119
+ [PyPI](https://pypi.org/project/nox-python-standards/) through GitHub OIDC;
120
+ no persistent PyPI token is needed.
121
+
122
+ One-time setup: on your [PyPI publishing page](https://pypi.org/manage/account/publishing/),
123
+ add a pending GitHub publisher with project `nox-python-standards`, owner `noxala`,
124
+ repository `nox-python-standards`, workflow `publish.yml`, and environment `pypi`.
125
+ The GitHub repository must have the matching `pypi` environment.
126
+
127
+ For each release, update `project.version` and this installation example, run
128
+ `uv lock`, and merge through the required checks. Publish a GitHub release tagged
129
+ `v<version>` at that merged commit. [Publish](.github/workflows/publish.yml)
130
+ reruns Linux/macOS quality checks, requires the tag to match the package version
131
+ and belong to `master`, builds distributions, then uploads through the `pypi`
132
+ environment. To publish an existing tag, run Publish manually from `master`
133
+ with that tag. A failed upload can be retried before either file is published;
134
+ after a partial upload, inspect PyPI before retrying. Published files cannot be
135
+ overwritten; subsequent changes need a new version.
@@ -0,0 +1,93 @@
1
+ [build-system]
2
+ requires = ["setuptools>=80"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "nox-python-standards"
7
+ version = "0.2.1"
8
+ description = "Check and sync complete local copies of Noxala Python standards"
9
+ readme = "README.md"
10
+ license = "0BSD"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.14.10,<3.15"
13
+ dependencies = ["tomlkit==0.15.0"]
14
+
15
+ [project.urls]
16
+ Repository = "https://github.com/noxala/nox-python-standards"
17
+ Issues = "https://github.com/noxala/nox-python-standards/issues"
18
+
19
+ [project.scripts]
20
+ nox-py-standards = "nox_python_standards.cli:main"
21
+
22
+ [dependency-groups]
23
+ dev = ["pytest==9.0.3", "ruff==0.15.14", "pyright==1.1.411"]
24
+
25
+ [tool.setuptools.packages.find]
26
+ where = ["src"]
27
+
28
+ [tool.setuptools.package-data]
29
+ nox_python_standards = ["resources/*.json", "resources/*.md", "py.typed"]
30
+
31
+ [tool.uv]
32
+ required-version = ">=0.13.6"
33
+
34
+ [tool.nox-python-standards]
35
+ sources = ["src", "test", "tools"]
36
+ dependency-group = "dev"
37
+
38
+ [tool.nox-python-standards.ruff]
39
+ authorized_version = "v0.15.14"
40
+
41
+ # Shared fields are checked against the installed release. Explicit adoption:
42
+ # nox-py-standards sync; CI: nox-py-standards check.
43
+ [tool.ruff]
44
+ required-version = "==0.15.14"
45
+ fix = false
46
+ fix-only = false
47
+ unsafe-fixes = false
48
+ line-length = 88
49
+ target-version = "py314"
50
+ extend-exclude = ["build", "dist", ".venv"]
51
+
52
+ [tool.ruff.format]
53
+ quote-style = "double"
54
+ indent-style = "space"
55
+ line-ending = "lf"
56
+ skip-magic-trailing-comma = false
57
+ docstring-code-format = true
58
+
59
+ [tool.ruff.lint]
60
+ extend-safe-fixes = ["PT007"]
61
+ extend-unsafe-fixes = []
62
+ fixable = ["ALL"]
63
+ unfixable = []
64
+ select = ["A", "B", "DTZ", "E", "F", "I", "LOG", "N", "PGH", "PIE", "PT", "RET", "RUF", "SIM", "SLF", "T20", "UP", "W"]
65
+ ignore = []
66
+ extend-ignore = ["RET504", "SIM102", "SIM103", "SIM108", "SIM110"]
67
+
68
+ [tool.ruff.lint.isort]
69
+ combine-as-imports = true
70
+ force-sort-within-sections = true
71
+ required-imports = ["from __future__ import annotations"]
72
+ known-first-party = ["nox_python_standards"]
73
+ known-third-party = []
74
+
75
+ [tool.ruff.lint.per-file-ignores]
76
+ "test/**/*.py" = ["SLF001"]
77
+
78
+ [tool.pyright]
79
+ typeCheckingMode = "strict"
80
+ reportMissingImports = "error"
81
+ reportMissingTypeStubs = false
82
+ include = ["src", "test", "tools"]
83
+ exclude = ["build", "dist", ".venv"]
84
+ extraPaths = ["src"]
85
+ pythonVersion = "3.14"
86
+ venvPath = "."
87
+ venv = ".venv"
88
+ executionEnvironments = [{ root = "test", reportPrivateUsage = "none" }]
89
+
90
+ [tool.pytest.ini_options]
91
+ testpaths = ["test"]
92
+ addopts = "-ra"
93
+ filterwarnings = ["error"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ # src/nox_python_standards/__init__.py
2
+ from __future__ import annotations
@@ -0,0 +1,6 @@
1
+ # src/nox_python_standards/__main__.py
2
+ from __future__ import annotations
3
+
4
+ from nox_python_standards.cli import main
5
+
6
+ raise SystemExit(main())
@@ -0,0 +1,45 @@
1
+ # src/nox_python_standards/cli.py
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ from pathlib import Path
6
+ import sys
7
+ from typing import cast
8
+
9
+ from nox_python_standards.config import Configuration, release_version
10
+ from nox_python_standards.repository import StandardsError, project_root
11
+ from nox_python_standards.versions import check_versions
12
+
13
+
14
+ def parser() -> argparse.ArgumentParser:
15
+ result = argparse.ArgumentParser(prog="nox-py-standards")
16
+ result.add_argument("--version", action="version", version=release_version())
17
+ result.add_argument(
18
+ "--root", type=Path, help="Consumer Git root (default: current Git root)"
19
+ )
20
+ result.add_argument("command", choices=("check", "sync"))
21
+ return result
22
+
23
+
24
+ def main(arguments: list[str] | None = None) -> int:
25
+ options = parser().parse_args(arguments)
26
+ command = cast(str, options.command)
27
+ try:
28
+ root = project_root(cast(Path | None, options.root))
29
+ configuration = Configuration.read(root)
30
+ if command == "sync":
31
+ configuration.sync()
32
+ else:
33
+ configuration.check()
34
+ check_versions(configuration)
35
+ sys.stdout.write(
36
+ f"nox-python-standards {release_version()}: {command} passed\n"
37
+ )
38
+ return 0
39
+ except (StandardsError, OSError, UnicodeError) as exc:
40
+ sys.stderr.write(f"nox-py-standards: {exc}\n")
41
+ return 1
42
+
43
+
44
+ if __name__ == "__main__":
45
+ raise SystemExit(main())