rn-forge-devops 0.3.1__tar.gz → 0.4.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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rn-forge-devops
3
- Version: 0.3.1
4
- Summary: CI and release automation for rn-forge repositories in any language, run with uv
3
+ Version: 0.4.0
4
+ Summary: Release commands for the pykit workspace
5
5
  Author: Rohit Narayanan
6
6
  Author-email: Rohit Narayanan <rohit.nn@gmail.com>
7
7
  License-Expression: MIT
@@ -29,46 +29,33 @@ Description-Content-Type: text/markdown
29
29
  · [Source](https://github.com/rn-forge/pykit/tree/main/packages/rn-forge-devops)
30
30
  · [All pykit packages](https://rn-forge.github.io/pykit/)
31
31
 
32
- CI and release automation for rn-forge repositories in any language, run with
33
- uv. The `rn-forge-devops` command reads a repository's workspace manifests,
34
- selects the packages a change affects, prints every CI job's matrix, and gates
35
- each package's release on its checks. Workflow files call it instead of carrying
36
- that logic.
32
+ Release commands for the pykit workspace. The CI planner is kiln's
33
+ `kiln-devops`; this package keeps only the commands pykit's own release process
34
+ calls.
37
35
 
38
36
  It depends on `packaging` and on no other rn-forge package. It is a CI tool, not
39
37
  a library an application depends on.
40
38
 
41
- - `rn_forge.devops.ci` — the core: the member graph, change selection, check
42
- matrices and release gating. It knows neither the CI platform nor the stack.
43
39
  - `rn_forge.devops.requirements` — the `requirements` check: every requirement
44
40
  between workspace members is a version range that admits the member's
45
41
  current version and has a ceiling.
46
- - `rn_forge.devops.uv` — the uv workspace adapter: it reads
47
- `[tool.uv.workspace]` members, their internal requirements and their
48
- `[tool.workspace-ci]` tables, and runs `smoke`.
49
- - `rn_forge.devops.github` — the GitHub Actions adapter: `$GITHUB_OUTPUT` lines
50
- and the event context.
51
- - `rn_forge.devops.index` and `rn_forge.devops.releases` — the `index`
52
- subcommand: a PEP 503 simple index rendered from a repository's GitHub
53
- Release files, and the adapter that reads them with `gh`.
54
- - `rn_forge.devops.notes` — the `notes` and `umbrella` subcommands: a changelog
55
- version's section, and the umbrella release for the newest shipped release
56
- page.
42
+ - `rn_forge.devops.notes` — the `umbrella` subcommand: the umbrella release for
43
+ the newest shipped release page.
57
44
  - `rn_forge.devops.cli` — the `rn-forge-devops` console script.
58
45
 
59
- The package facade re-exports the planner core only. The core never imports an
60
- adapter, and the package never imports another `rn_forge` package;
46
+ The package facade re-exports nothing. The package never imports another
47
+ `rn_forge` package, and `.requirements` and `.notes` never import each other;
61
48
  `.importlinter` proves both.
62
49
 
63
50
  ## Usage
64
51
 
65
- Run it from inside a uv workspace; the workspace root is the nearest directory
66
- at or above the current one whose `pyproject.toml` declares
52
+ Run `requirements` from inside a uv workspace; the workspace root is the nearest
53
+ directory at or above the current one whose `pyproject.toml` declares
67
54
  `[tool.uv.workspace]`.
68
55
 
69
56
  ```bash
70
- uvx --from "rn-forge-devops>=0.3,<0.4" rn-forge-devops plan
57
+ uvx --from "rn-forge-devops>=0.4,<0.5" rn-forge-devops requirements
71
58
  ```
72
59
 
73
- The subcommands and the `[tool.workspace-ci]` tables are described in the
60
+ The subcommands are described in the
74
61
  [subcommand reference](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/reference/subcommands.html).
@@ -0,0 +1,38 @@
1
+ # rn-forge-devops
2
+
3
+ [Documentation](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/)
4
+ ·
5
+ [Changelog](https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-devops/CHANGELOG.md)
6
+ · [Source](https://github.com/rn-forge/pykit/tree/main/packages/rn-forge-devops)
7
+ · [All pykit packages](https://rn-forge.github.io/pykit/)
8
+
9
+ Release commands for the pykit workspace. The CI planner is kiln's
10
+ `kiln-devops`; this package keeps only the commands pykit's own release process
11
+ calls.
12
+
13
+ It depends on `packaging` and on no other rn-forge package. It is a CI tool, not
14
+ a library an application depends on.
15
+
16
+ - `rn_forge.devops.requirements` — the `requirements` check: every requirement
17
+ between workspace members is a version range that admits the member's
18
+ current version and has a ceiling.
19
+ - `rn_forge.devops.notes` — the `umbrella` subcommand: the umbrella release for
20
+ the newest shipped release page.
21
+ - `rn_forge.devops.cli` — the `rn-forge-devops` console script.
22
+
23
+ The package facade re-exports nothing. The package never imports another
24
+ `rn_forge` package, and `.requirements` and `.notes` never import each other;
25
+ `.importlinter` proves both.
26
+
27
+ ## Usage
28
+
29
+ Run `requirements` from inside a uv workspace; the workspace root is the nearest
30
+ directory at or above the current one whose `pyproject.toml` declares
31
+ `[tool.uv.workspace]`.
32
+
33
+ ```bash
34
+ uvx --from "rn-forge-devops>=0.4,<0.5" rn-forge-devops requirements
35
+ ```
36
+
37
+ The subcommands are described in the
38
+ [subcommand reference](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/reference/subcommands.html).
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "rn-forge-devops"
3
- version = "0.3.1"
4
- description = "CI and release automation for rn-forge repositories in any language, run with uv"
3
+ version = "0.4.0"
4
+ description = "Release commands for the pykit workspace"
5
5
  readme = "README.md"
6
6
  license = "MIT"
7
7
  license-files = ["LICENSE"]
@@ -31,11 +31,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-devop
31
31
  Issues = "https://github.com/rn-forge/pykit/issues"
32
32
 
33
33
  [build-system]
34
- requires = ["uv_build>=0.11.28,<0.12.0"]
34
+ requires = ["uv_build>=0.13.7,<0.14.0"]
35
35
  build-backend = "uv_build"
36
36
 
37
+ [tool.pyright]
38
+ typeCheckingMode = "strict"
39
+ reportMissingTypeStubs = false
40
+ reportUnnecessaryTypeIgnoreComment = "error"
41
+ venv = ".venv"
42
+ venvPath = "../.."
43
+
37
44
  [tool.uv.build-backend]
38
45
  module-name = "rn_forge.devops"
46
+ source-exclude = ["**/.DS_Store"]
39
47
 
40
48
  [tool.uv.sources.rn-forge-devops]
41
49
  workspace = true
@@ -1,19 +1,19 @@
1
1
  [project]
2
2
  name = "rn-forge-devops"
3
- version = "0.3.1"
4
- description = "CI and release automation for rn-forge repositories in any language, run with uv"
3
+ version = "0.4.0"
4
+ description = "Release commands for the pykit workspace"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Rohit Narayanan", email = "rohit.nn@gmail.com" }]
7
7
  license = "MIT"
8
8
  license-files = ["LICENSE"]
9
9
  classifiers = [
10
- "Development Status :: 3 - Alpha",
11
- "Intended Audience :: Developers",
12
- "Operating System :: OS Independent",
13
- "Programming Language :: Python :: 3",
14
- "Programming Language :: Python :: 3 :: Only",
15
- "Programming Language :: Python :: 3.14",
16
- "Typing :: Typed",
10
+ "Development Status :: 3 - Alpha",
11
+ "Intended Audience :: Developers",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3 :: Only",
15
+ "Programming Language :: Python :: 3.14",
16
+ "Typing :: Typed",
17
17
  ]
18
18
  requires-python = ">=3.14"
19
19
  dependencies = ["packaging>=24"]
@@ -28,11 +28,19 @@ Changelog = "https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-devop
28
28
  Issues = "https://github.com/rn-forge/pykit/issues"
29
29
 
30
30
  [build-system]
31
- requires = ["uv_build>=0.11.28,<0.12.0"]
31
+ requires = ["uv_build>=0.13.7,<0.14.0"]
32
32
  build-backend = "uv_build"
33
33
 
34
+ [tool.pyright]
35
+ typeCheckingMode = "strict"
36
+ reportMissingTypeStubs = false
37
+ reportUnnecessaryTypeIgnoreComment = "error"
38
+ venv = ".venv"
39
+ venvPath = "../.."
40
+
34
41
  [tool.uv.build-backend]
35
42
  module-name = "rn_forge.devops"
43
+ source-exclude = ["**/.DS_Store"]
36
44
 
37
45
  [tool.uv.sources]
38
46
  rn-forge-devops = { workspace = true }
@@ -42,16 +50,16 @@ addopts = "-ra --import-mode=importlib"
42
50
 
43
51
  [dependency-groups]
44
52
  dev = [
45
- "pyright>=1.1.411",
46
- "pytest>=9.1.1",
47
- "pytest-cov>=7.1.0",
48
- "pytest-randomly>=4.1.0",
49
- "rn-forge-devops",
50
- "ruff>=0.15.21",
53
+ "pyright>=1.1.411",
54
+ "pytest>=9.1.1",
55
+ "pytest-cov>=7.1.0",
56
+ "pytest-randomly>=4.1.0",
57
+ "rn-forge-devops",
58
+ "ruff>=0.15.21",
51
59
  ]
52
60
  docs = [
53
- "mkdocs>=1.6.1",
54
- "mkdocs-material>=9.7.6",
55
- "mkdocstrings[python]>=1.0.6",
56
- "rn-forge-devops",
61
+ "mkdocs>=1.6.1",
62
+ "mkdocs-material>=9.7.6",
63
+ "mkdocstrings[python]>=1.0.6",
64
+ "rn-forge-devops",
57
65
  ]
@@ -0,0 +1,3 @@
1
+ """Release commands for the pykit workspace."""
2
+
3
+ __all__: list[str] = []
@@ -0,0 +1,79 @@
1
+ """The `rn-forge-devops` console script."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ from rn_forge.devops import notes, requirements
10
+
11
+
12
+ def _parser() -> argparse.ArgumentParser:
13
+ parser = argparse.ArgumentParser(
14
+ prog="rn-forge-devops",
15
+ description="Release commands for the pykit workspace.",
16
+ )
17
+ commands = parser.add_subparsers(dest="command", required=True)
18
+ commands.add_parser(
19
+ "requirements", help="check internal requirements are version ranges"
20
+ )
21
+ umbrella = commands.add_parser(
22
+ "umbrella",
23
+ help="write the pending umbrella release's notes; tags are read from stdin",
24
+ )
25
+ umbrella.add_argument("releases_dir", metavar="RELEASES_DIR")
26
+ umbrella.add_argument("body_file", metavar="BODY_FILE")
27
+ umbrella.add_argument("--site-url", required=True, metavar="URL")
28
+ return parser
29
+
30
+
31
+ def _within_cwd(raw: str) -> Path | None:
32
+ path = Path(raw).resolve()
33
+ return path if path.is_relative_to(Path.cwd().resolve()) else None
34
+
35
+
36
+ def _umbrella(args: argparse.Namespace) -> int:
37
+ releases_dir = _within_cwd(args.releases_dir)
38
+ if releases_dir is None:
39
+ print(f"{args.releases_dir} is outside the working directory", file=sys.stderr)
40
+ return 1
41
+ body_file = _within_cwd(args.body_file)
42
+ if body_file is None:
43
+ print(f"{args.body_file} is outside the working directory", file=sys.stderr)
44
+ return 1
45
+ # `git ls-remote --tags --refs` lines: `<sha>\trefs/tags/<name>`.
46
+ tags = {
47
+ line.split("refs/tags/", 1)[1].strip()
48
+ for line in sys.stdin.read().splitlines()
49
+ if "refs/tags/" in line
50
+ }
51
+ found = notes.pending_umbrella(releases_dir, tags, args.site_url)
52
+ if found is not None:
53
+ body_file.write_text(found.body, encoding="utf-8")
54
+ print(f"tag={found.tag}")
55
+ print(f"title={found.title}")
56
+ return 0
57
+
58
+
59
+ def _requirements(root: Path) -> int:
60
+ problems = requirements.check_requirements(root)
61
+ for problem in problems:
62
+ print(problem, file=sys.stderr)
63
+ return 1 if problems else 0
64
+
65
+
66
+ def main(argv: list[str] | None = None) -> int:
67
+ """Run a subcommand and return its exit status.
68
+
69
+ Args:
70
+ argv: The arguments after the program name; `sys.argv[1:]` when omitted.
71
+ """
72
+ args = _parser().parse_args(argv)
73
+ if args.command == "umbrella":
74
+ return _umbrella(args)
75
+ try:
76
+ root = requirements.find_root(Path.cwd())
77
+ except FileNotFoundError as error:
78
+ sys.exit(str(error))
79
+ return _requirements(root)
@@ -1,4 +1,4 @@
1
- """Release notes: a changelog section and the umbrella release for a shipped page."""
1
+ """The umbrella release for a shipped release page."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -39,36 +39,6 @@ class Umbrella:
39
39
  """The release notes: the page's `## Shipped` section and a link to the page."""
40
40
 
41
41
 
42
- def changelog_section(changelog: str, version: str) -> str:
43
- """Return the body under `## [<version>]` up to the next `## [` heading.
44
-
45
- The heading is `## [<version>]` followed by the end of the line or
46
- ` - <date>`; the version must match exactly.
47
-
48
- Args:
49
- changelog: The text of a Keep a Changelog file.
50
- version: The version whose section to return.
51
-
52
- Returns:
53
- The section body with surrounding whitespace removed.
54
-
55
- Raises:
56
- ValueError: The version has no heading, or its body is empty.
57
- """
58
- heading = re.compile(
59
- rf"^## \[{re.escape(version)}\](?: - .*)?[ \t]*$", re.MULTILINE
60
- )
61
- match = heading.search(changelog)
62
- if match is None:
63
- raise ValueError(f"no `## [{version}]` heading in the changelog")
64
- rest = changelog[match.end() :]
65
- following = re.search(r"^## \[", rest, re.MULTILINE)
66
- body = (rest[: following.start()] if following else rest).strip()
67
- if not body:
68
- raise ValueError(f"the `## [{version}]` section is empty")
69
- return body
70
-
71
-
72
42
  def pending_umbrella(
73
43
  releases_dir: Path, existing_tags: Collection[str], site_url: str
74
44
  ) -> Umbrella | None:
@@ -13,6 +13,22 @@ from packaging.version import Version
13
13
  MANIFEST = "pyproject.toml"
14
14
 
15
15
 
16
+ def find_root(start: Path) -> Path:
17
+ """Return the nearest directory at or above `start` whose `pyproject.toml`
18
+ declares `[tool.uv.workspace]`.
19
+
20
+ Raises:
21
+ FileNotFoundError: When there is none.
22
+ """
23
+ for directory in (start, *start.parents):
24
+ manifest = directory / MANIFEST
25
+ if manifest.is_file() and "workspace" in tomllib.loads(
26
+ manifest.read_text()
27
+ ).get("tool", {}).get("uv", {}):
28
+ return directory
29
+ raise FileNotFoundError(f"no uv workspace at or above {start}")
30
+
31
+
16
32
  def _members(root: Path) -> dict[str, tuple[str, str, dict[str, Any]]]:
17
33
  """Map each member's canonical name to its name, version and manifest."""
18
34
  workspace: dict[str, Any] = tomllib.loads((root / MANIFEST).read_text())["tool"][
@@ -1,51 +0,0 @@
1
- # rn-forge-devops
2
-
3
- [Documentation](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/)
4
- ·
5
- [Changelog](https://github.com/rn-forge/pykit/blob/main/packages/rn-forge-devops/CHANGELOG.md)
6
- · [Source](https://github.com/rn-forge/pykit/tree/main/packages/rn-forge-devops)
7
- · [All pykit packages](https://rn-forge.github.io/pykit/)
8
-
9
- CI and release automation for rn-forge repositories in any language, run with
10
- uv. The `rn-forge-devops` command reads a repository's workspace manifests,
11
- selects the packages a change affects, prints every CI job's matrix, and gates
12
- each package's release on its checks. Workflow files call it instead of carrying
13
- that logic.
14
-
15
- It depends on `packaging` and on no other rn-forge package. It is a CI tool, not
16
- a library an application depends on.
17
-
18
- - `rn_forge.devops.ci` — the core: the member graph, change selection, check
19
- matrices and release gating. It knows neither the CI platform nor the stack.
20
- - `rn_forge.devops.requirements` — the `requirements` check: every requirement
21
- between workspace members is a version range that admits the member's
22
- current version and has a ceiling.
23
- - `rn_forge.devops.uv` — the uv workspace adapter: it reads
24
- `[tool.uv.workspace]` members, their internal requirements and their
25
- `[tool.workspace-ci]` tables, and runs `smoke`.
26
- - `rn_forge.devops.github` — the GitHub Actions adapter: `$GITHUB_OUTPUT` lines
27
- and the event context.
28
- - `rn_forge.devops.index` and `rn_forge.devops.releases` — the `index`
29
- subcommand: a PEP 503 simple index rendered from a repository's GitHub
30
- Release files, and the adapter that reads them with `gh`.
31
- - `rn_forge.devops.notes` — the `notes` and `umbrella` subcommands: a changelog
32
- version's section, and the umbrella release for the newest shipped release
33
- page.
34
- - `rn_forge.devops.cli` — the `rn-forge-devops` console script.
35
-
36
- The package facade re-exports the planner core only. The core never imports an
37
- adapter, and the package never imports another `rn_forge` package;
38
- `.importlinter` proves both.
39
-
40
- ## Usage
41
-
42
- Run it from inside a uv workspace; the workspace root is the nearest directory
43
- at or above the current one whose `pyproject.toml` declares
44
- `[tool.uv.workspace]`.
45
-
46
- ```bash
47
- uvx --from "rn-forge-devops>=0.3,<0.4" rn-forge-devops plan
48
- ```
49
-
50
- The subcommands and the `[tool.workspace-ci]` tables are described in the
51
- [subcommand reference](https://rn-forge.github.io/pykit/packages/rn-forge-devops/latest/reference/subcommands.html).
@@ -1,31 +0,0 @@
1
- """CI and release automation: the platform- and stack-neutral core."""
2
-
3
- from rn_forge.devops.ci import (
4
- UNSCOPED,
5
- Package,
6
- Smoke,
7
- Workspace,
8
- changed_files,
9
- normalize,
10
- plan,
11
- releasable,
12
- release_order,
13
- released,
14
- requirement_name,
15
- select,
16
- )
17
-
18
- __all__ = [
19
- "UNSCOPED",
20
- "Package",
21
- "Smoke",
22
- "Workspace",
23
- "changed_files",
24
- "normalize",
25
- "plan",
26
- "releasable",
27
- "release_order",
28
- "released",
29
- "requirement_name",
30
- "select",
31
- ]