rn-forge-devops 0.4.0__tar.gz → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rn-forge-devops
3
- Version: 0.4.0
3
+ Version: 0.5.1
4
4
  Summary: Release commands for the pykit workspace
5
5
  Author: Rohit Narayanan
6
6
  Author-email: Rohit Narayanan <rohit.nn@gmail.com>
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
14
  Classifier: Programming Language :: Python :: 3.14
15
15
  Classifier: Typing :: Typed
16
- Requires-Dist: packaging>=24
16
+ Requires-Dist: packaging>=26.3
17
17
  Requires-Python: >=3.14
18
18
  Project-URL: Documentation, https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/
19
19
  Project-URL: Source, https://github.com/rn-forge/pykit/tree/main/packages/rn-forge-devops
@@ -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).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rn-forge-devops"
3
- version = "0.4.0"
3
+ version = "0.5.1"
4
4
  description = "Release commands for the pykit workspace"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -15,7 +15,7 @@ classifiers = [
15
15
  "Typing :: Typed",
16
16
  ]
17
17
  requires-python = ">=3.14"
18
- dependencies = ["packaging>=24"]
18
+ dependencies = ["packaging>=26.3"]
19
19
 
20
20
  [[project.authors]]
21
21
  name = "Rohit Narayanan"
@@ -54,15 +54,15 @@ addopts = "-ra --import-mode=importlib"
54
54
  [dependency-groups]
55
55
  dev = [
56
56
  "pyright>=1.1.411",
57
- "pytest>=9.1.1",
57
+ "pytest>=9.2.0",
58
58
  "pytest-cov>=7.1.0",
59
59
  "pytest-randomly>=4.1.0",
60
60
  "rn-forge-devops",
61
- "ruff>=0.15.21",
61
+ "ruff>=0.17.4",
62
62
  ]
63
63
  docs = [
64
64
  "mkdocs>=1.6.1",
65
- "mkdocs-material>=9.7.6",
66
- "mkdocstrings[python]>=1.0.6",
65
+ "mkdocs-material>=9.8.1",
66
+ "mkdocstrings[python]>=1.0.8",
67
67
  "rn-forge-devops",
68
68
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "rn-forge-devops"
3
- version = "0.4.0"
3
+ version = "0.5.1"
4
4
  description = "Release commands for the pykit workspace"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Rohit Narayanan", email = "rohit.nn@gmail.com" }]
@@ -16,7 +16,7 @@ classifiers = [
16
16
  "Typing :: Typed",
17
17
  ]
18
18
  requires-python = ">=3.14"
19
- dependencies = ["packaging>=24"]
19
+ dependencies = ["packaging>=26.3"]
20
20
 
21
21
  [project.scripts]
22
22
  rn-forge-devops = "rn_forge.devops.cli:main"
@@ -51,15 +51,15 @@ addopts = "-ra --import-mode=importlib"
51
51
  [dependency-groups]
52
52
  dev = [
53
53
  "pyright>=1.1.411",
54
- "pytest>=9.1.1",
54
+ "pytest>=9.2.0",
55
55
  "pytest-cov>=7.1.0",
56
56
  "pytest-randomly>=4.1.0",
57
57
  "rn-forge-devops",
58
- "ruff>=0.15.21",
58
+ "ruff>=0.17.4",
59
59
  ]
60
60
  docs = [
61
61
  "mkdocs>=1.6.1",
62
- "mkdocs-material>=9.7.6",
63
- "mkdocstrings[python]>=1.0.6",
62
+ "mkdocs-material>=9.8.1",
63
+ "mkdocstrings[python]>=1.0.8",
64
64
  "rn-forge-devops",
65
65
  ]
@@ -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
- sys.exit(str(error))
79
- return _requirements(root)
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,46 @@ 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 member's canonical name to its name, version and manifest."""
36
+ def _read_member(path: Path) -> tuple[str, str, dict[str, Any]]:
37
+ manifest: dict[str, Any] = tomllib.loads(path.read_text())
38
+ if "project" not in manifest:
39
+ raise InvalidManifest(f"{path}: missing [project]")
40
+ project: dict[str, Any] = manifest["project"]
41
+ if "name" not in project:
42
+ raise InvalidManifest(f"{path}: missing [project].name")
43
+ name: str = project["name"]
44
+ version: str = project.get("version", "")
45
+ if "version" in project:
46
+ try:
47
+ Version(version)
48
+ except InvalidVersion as error:
49
+ raise InvalidManifest(f"{path}: {error}") from error
50
+ return name, version, manifest
51
+
52
+
53
+ def _members(root: Path) -> dict[str, tuple[str, str, dict[str, Any], Path]]:
54
+ """Map each canonical name to its name, version, manifest and path."""
34
55
  workspace: dict[str, Any] = tomllib.loads((root / MANIFEST).read_text())["tool"][
35
56
  "uv"
36
57
  ]["workspace"]
58
+ if "members" not in workspace:
59
+ raise InvalidManifest(f"{root / MANIFEST}: workspace lacks members")
37
60
  excluded = {
38
61
  path
39
62
  for pattern in workspace.get("exclude", [])
40
63
  for path in root.glob(f"{pattern}/{MANIFEST}")
41
64
  }
42
- members: dict[str, tuple[str, str, dict[str, Any]]] = {}
65
+ members: dict[str, tuple[str, str, dict[str, Any], Path]] = {}
43
66
  for pattern in workspace["members"]:
44
67
  for path in sorted(root.glob(f"{pattern}/{MANIFEST}")):
45
68
  if path in excluded:
46
69
  continue
47
- manifest: dict[str, Any] = tomllib.loads(path.read_text())
48
- project: dict[str, Any] = manifest["project"]
49
- name: str = project["name"]
70
+ name, version, manifest = _read_member(path)
50
71
  members[canonicalize_name(name)] = (
51
72
  name,
52
- project.get("version", ""),
73
+ version,
53
74
  manifest,
75
+ path,
54
76
  )
55
77
  return members
56
78
 
@@ -69,24 +91,40 @@ def check_requirements(root: Path) -> list[str]:
69
91
  """Return the problems with requirements on other workspace members.
70
92
 
71
93
  Reads the members listed under `[tool.uv.workspace]` in `root/pyproject.toml`.
72
- A requirement on a member, in `dependencies`, `optional-dependencies` or
73
- `[dependency-groups]`, is reported when it is a URL, when its specifier
74
- excludes the member's `[project]` version, or when its specifier has no
75
- `<` or `<=` clause. Requirements on anything else are ignored.
94
+ Checks `dependencies`, every `optional-dependencies` list and string items
95
+ in `[dependency-groups]`. Names are canonicalized, extras are accepted and
96
+ markers are ignored. A requirement on another member is reported when it
97
+ is a direct URL or path, excludes the member's `[project].version`, or has
98
+ no `<` or `<=` ceiling; `~=` and `==` alone have no ceiling.
99
+
100
+ Non-members (including excluded members), self-references, `include-group`
101
+ entries and member globs matching no manifest are skipped. A member with
102
+ no version skips only the version check; its ceiling is still checked.
76
103
 
77
104
  Args:
78
105
  root: The workspace root directory.
79
106
 
80
107
  Returns:
81
108
  One message per problem, empty when the requirements are all ranges.
109
+
110
+ Raises:
111
+ InvalidManifest: A requirement is malformed, a member lacks `[project]`
112
+ or `name`, a version is unparsable, or the workspace lacks `members`.
113
+ The message names the manifest and any malformed requirement text;
114
+ no result is returned for invalid input.
82
115
  """
83
116
  members = _members(root)
84
117
  problems: list[str] = []
85
- for key, (name, _, manifest) in members.items():
118
+ for key, (name, _, manifest, path) in members.items():
86
119
  for text in _requirements(
87
120
  manifest["project"], manifest.get("dependency-groups", {})
88
121
  ):
89
- req = Requirement(text)
122
+ try:
123
+ req = Requirement(text)
124
+ except InvalidRequirement as error:
125
+ raise InvalidManifest(
126
+ f"{path}: invalid requirement {text!r}: {error}"
127
+ ) from error
90
128
  target_key = canonicalize_name(req.name)
91
129
  target = members.get(target_key)
92
130
  # A package naming itself (an extra that includes other extras) is no dependency.
File without changes