rn-forge-devops 0.4.0__tar.gz → 0.5.0__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.
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/PKG-INFO +7 -1
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/README.md +6 -0
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/pyproject.toml +1 -1
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/pyproject.toml.orig +1 -1
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/src/rn_forge/devops/cli.py +7 -2
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/src/rn_forge/devops/requirements.py +45 -12
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/LICENSE +0 -0
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/src/rn_forge/devops/__init__.py +0 -0
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/src/rn_forge/devops/notes.py +0 -0
- {rn_forge_devops-0.4.0 → rn_forge_devops-0.5.0}/src/rn_forge/devops/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rn-forge-devops
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Release commands for the pykit workspace
|
|
5
5
|
Author: Rohit Narayanan
|
|
6
6
|
Author-email: Rohit Narayanan <rohit.nn@gmail.com>
|
|
@@ -57,5 +57,11 @@ directory at or above the current one whose `pyproject.toml` declares
|
|
|
57
57
|
uvx --from "rn-forge-devops>=0.4,<0.5" rn-forge-devops requirements
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
The package has no extras.
|
|
61
|
+
|
|
62
|
+
`requirements` exits 0 when every requirement is a range that admits the
|
|
63
|
+
member's version and has a ceiling, 1 when at least one is not (one stderr line
|
|
64
|
+
each), and 2 for invalid input, with a diagnostic and no traceback.
|
|
65
|
+
|
|
60
66
|
The subcommands are described in the
|
|
61
67
|
[subcommand reference](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/reference/subcommands.html).
|
|
@@ -34,5 +34,11 @@ directory at or above the current one whose `pyproject.toml` declares
|
|
|
34
34
|
uvx --from "rn-forge-devops>=0.4,<0.5" rn-forge-devops requirements
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
The package has no extras.
|
|
38
|
+
|
|
39
|
+
`requirements` exits 0 when every requirement is a range that admits the
|
|
40
|
+
member's version and has a ceiling, 1 when at least one is not (one stderr line
|
|
41
|
+
each), and 2 for invalid input, with a diagnostic and no traceback.
|
|
42
|
+
|
|
37
43
|
The subcommands are described in the
|
|
38
44
|
[subcommand reference](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/reference/subcommands.html).
|
|
@@ -75,5 +75,10 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
75
75
|
try:
|
|
76
76
|
root = requirements.find_root(Path.cwd())
|
|
77
77
|
except FileNotFoundError as error:
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
print(str(error), file=sys.stderr)
|
|
79
|
+
return 2
|
|
80
|
+
try:
|
|
81
|
+
return _requirements(root)
|
|
82
|
+
except requirements.InvalidManifest as error:
|
|
83
|
+
print(str(error), file=sys.stderr)
|
|
84
|
+
return 2
|
|
@@ -6,13 +6,17 @@ import tomllib
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
-
from packaging.requirements import Requirement
|
|
9
|
+
from packaging.requirements import InvalidRequirement, Requirement
|
|
10
10
|
from packaging.utils import canonicalize_name
|
|
11
|
-
from packaging.version import Version
|
|
11
|
+
from packaging.version import InvalidVersion, Version
|
|
12
12
|
|
|
13
13
|
MANIFEST = "pyproject.toml"
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
class InvalidManifest(ValueError):
|
|
17
|
+
"""A workspace manifest contains invalid input for requirement checks."""
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
def find_root(start: Path) -> Path:
|
|
17
21
|
"""Return the nearest directory at or above `start` whose `pyproject.toml`
|
|
18
22
|
declares `[tool.uv.workspace]`.
|
|
@@ -29,28 +33,41 @@ def find_root(start: Path) -> Path:
|
|
|
29
33
|
raise FileNotFoundError(f"no uv workspace at or above {start}")
|
|
30
34
|
|
|
31
35
|
|
|
32
|
-
def _members(root: Path) -> dict[str, tuple[str, str, dict[str, Any]]]:
|
|
33
|
-
"""Map each
|
|
36
|
+
def _members(root: Path) -> dict[str, tuple[str, str, dict[str, Any], Path]]:
|
|
37
|
+
"""Map each canonical name to its name, version, manifest and path."""
|
|
34
38
|
workspace: dict[str, Any] = tomllib.loads((root / MANIFEST).read_text())["tool"][
|
|
35
39
|
"uv"
|
|
36
40
|
]["workspace"]
|
|
41
|
+
if "members" not in workspace:
|
|
42
|
+
raise InvalidManifest(f"{root / MANIFEST}: workspace lacks members")
|
|
37
43
|
excluded = {
|
|
38
44
|
path
|
|
39
45
|
for pattern in workspace.get("exclude", [])
|
|
40
46
|
for path in root.glob(f"{pattern}/{MANIFEST}")
|
|
41
47
|
}
|
|
42
|
-
members: dict[str, tuple[str, str, dict[str, Any]]] = {}
|
|
48
|
+
members: dict[str, tuple[str, str, dict[str, Any], Path]] = {}
|
|
43
49
|
for pattern in workspace["members"]:
|
|
44
50
|
for path in sorted(root.glob(f"{pattern}/{MANIFEST}")):
|
|
45
51
|
if path in excluded:
|
|
46
52
|
continue
|
|
47
53
|
manifest: dict[str, Any] = tomllib.loads(path.read_text())
|
|
54
|
+
if "project" not in manifest:
|
|
55
|
+
raise InvalidManifest(f"{path}: missing [project]")
|
|
48
56
|
project: dict[str, Any] = manifest["project"]
|
|
57
|
+
if "name" not in project:
|
|
58
|
+
raise InvalidManifest(f"{path}: missing [project].name")
|
|
49
59
|
name: str = project["name"]
|
|
60
|
+
version: str = project.get("version", "")
|
|
61
|
+
if "version" in project:
|
|
62
|
+
try:
|
|
63
|
+
Version(version)
|
|
64
|
+
except InvalidVersion as error:
|
|
65
|
+
raise InvalidManifest(f"{path}: {error}") from error
|
|
50
66
|
members[canonicalize_name(name)] = (
|
|
51
67
|
name,
|
|
52
|
-
|
|
68
|
+
version,
|
|
53
69
|
manifest,
|
|
70
|
+
path,
|
|
54
71
|
)
|
|
55
72
|
return members
|
|
56
73
|
|
|
@@ -69,24 +86,40 @@ def check_requirements(root: Path) -> list[str]:
|
|
|
69
86
|
"""Return the problems with requirements on other workspace members.
|
|
70
87
|
|
|
71
88
|
Reads the members listed under `[tool.uv.workspace]` in `root/pyproject.toml`.
|
|
72
|
-
|
|
73
|
-
`[dependency-groups]
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
Checks `dependencies`, every `optional-dependencies` list and string items
|
|
90
|
+
in `[dependency-groups]`. Names are canonicalized, extras are accepted and
|
|
91
|
+
markers are ignored. A requirement on another member is reported when it
|
|
92
|
+
is a direct URL or path, excludes the member's `[project].version`, or has
|
|
93
|
+
no `<` or `<=` ceiling; `~=` and `==` alone have no ceiling.
|
|
94
|
+
|
|
95
|
+
Non-members (including excluded members), self-references, `include-group`
|
|
96
|
+
entries and member globs matching no manifest are skipped. A member with
|
|
97
|
+
no version skips only the version check; its ceiling is still checked.
|
|
76
98
|
|
|
77
99
|
Args:
|
|
78
100
|
root: The workspace root directory.
|
|
79
101
|
|
|
80
102
|
Returns:
|
|
81
103
|
One message per problem, empty when the requirements are all ranges.
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
InvalidManifest: A requirement is malformed, a member lacks `[project]`
|
|
107
|
+
or `name`, a version is unparsable, or the workspace lacks `members`.
|
|
108
|
+
The message names the manifest and any malformed requirement text;
|
|
109
|
+
no result is returned for invalid input.
|
|
82
110
|
"""
|
|
83
111
|
members = _members(root)
|
|
84
112
|
problems: list[str] = []
|
|
85
|
-
for key, (name, _, manifest) in members.items():
|
|
113
|
+
for key, (name, _, manifest, path) in members.items():
|
|
86
114
|
for text in _requirements(
|
|
87
115
|
manifest["project"], manifest.get("dependency-groups", {})
|
|
88
116
|
):
|
|
89
|
-
|
|
117
|
+
try:
|
|
118
|
+
req = Requirement(text)
|
|
119
|
+
except InvalidRequirement as error:
|
|
120
|
+
raise InvalidManifest(
|
|
121
|
+
f"{path}: invalid requirement {text!r}: {error}"
|
|
122
|
+
) from error
|
|
90
123
|
target_key = canonicalize_name(req.name)
|
|
91
124
|
target = members.get(target_key)
|
|
92
125
|
# A package naming itself (an extra that includes other extras) is no dependency.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|