release-kit 0.1.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.
- release_kit-0.1.0/.github/workflows/ci.yml +53 -0
- release_kit-0.1.0/.gitignore +12 -0
- release_kit-0.1.0/AGENTS.md +59 -0
- release_kit-0.1.0/CLAUDE.md +1 -0
- release_kit-0.1.0/LICENSE +201 -0
- release_kit-0.1.0/NOTICE +1 -0
- release_kit-0.1.0/PKG-INFO +13 -0
- release_kit-0.1.0/README.md +61 -0
- release_kit-0.1.0/publish-config.json +11 -0
- release_kit-0.1.0/pyproject.toml +43 -0
- release_kit-0.1.0/ruff.toml +80 -0
- release_kit-0.1.0/src/release_kit/__init__.py +35 -0
- release_kit-0.1.0/src/release_kit/config.py +81 -0
- release_kit-0.1.0/src/release_kit/create_release.py +165 -0
- release_kit-0.1.0/src/release_kit/ensure_release_pr.py +23 -0
- release_kit-0.1.0/src/release_kit/feeds.py +126 -0
- release_kit-0.1.0/src/release_kit/fetch_ci_artifacts.py +75 -0
- release_kit-0.1.0/src/release_kit/ledger.py +33 -0
- release_kit-0.1.0/src/release_kit/mirror_images.py +37 -0
- release_kit-0.1.0/src/release_kit/plan.py +83 -0
- release_kit-0.1.0/src/release_kit/publish_dev.py +104 -0
- release_kit-0.1.0/src/release_kit/publish_packages.py +119 -0
- release_kit-0.1.0/src/release_kit/py.typed +0 -0
- release_kit-0.1.0/tests/test_config.py +174 -0
- release_kit-0.1.0/tests/test_feeds.py +149 -0
- release_kit-0.1.0/tests/test_plan.py +169 -0
- release_kit-0.1.0/uv.lock +431 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
check:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v7
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Lint
|
|
24
|
+
run: uv run ruff check .
|
|
25
|
+
|
|
26
|
+
- name: Format
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: uv run basedpyright
|
|
31
|
+
|
|
32
|
+
- name: Test
|
|
33
|
+
run: uv run pytest
|
|
34
|
+
|
|
35
|
+
publish:
|
|
36
|
+
needs: check
|
|
37
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
permissions:
|
|
40
|
+
contents: write
|
|
41
|
+
id-token: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v5
|
|
44
|
+
|
|
45
|
+
# Workaround: fetch-tags is broken with shallow clones
|
|
46
|
+
- run: git fetch --tags origin
|
|
47
|
+
|
|
48
|
+
- uses: astral-sh/setup-uv@v7
|
|
49
|
+
with:
|
|
50
|
+
enable-cache: true
|
|
51
|
+
|
|
52
|
+
- name: Publish
|
|
53
|
+
run: uv run publish-packages --config publish-config.json
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# release-kit
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
5
|
+
The publication machinery for outernet-foundation repos: the publish pipeline, the per-package tag ledger and path-diff change detection, ephemeral version patching, release orchestration, and the OCI mirror scan. A standalone repo (sibling of `unity-buildkit` / `stack-toolkit` / `bashrun`), published to PyPI and consumed **uvx-isolated** — release workflows invoke `uvx --from release-kit==<version> <command>`; it is a project dependency of nothing. The reason is structural: every tool repo it publishes sits inside its own dependency graph (bashrun, stack-toolkit, unity-buildkit are release-kit's runtime deps), so a project-level release-kit edge in those repos is a resolver cycle plus a root-version conflict against the `0.0.0.dev0` sentinel. Consumers outside that graph (placeframe) use uvx for the same shape, keeping one consumption model.
|
|
6
|
+
|
|
7
|
+
The consumer owns everything declarative: package identities, paths, tag prefixes, registry mappings, compose files, and the CI workflow name live in a consumer-authored `publish-config.json`; every command here reads that file. Per-repo copies of this machinery are refused, as are per-ecosystem splits — the seam is internal: one `Feed` adapter per registry over the shared ledger/diff/versioning core.
|
|
8
|
+
|
|
9
|
+
The package is `release-kit` (src-layout under `src/release_kit/`; import `release_kit`), renamed from `pubpkg` before its first publish — PyPI's registrar rejects names merely similar to existing ones, so `pubpkg` was unclaimable and nothing on PyPI ever carried it. Runtime dependencies: `bashrun` (all shell-outs), `stack-toolkit` (`compute_service_shas`, `collect_repo_references`), `unity-buildkit` (`ci_step`, runner setup), `pydantic`/`pydantic-settings` (config + CI env), `typer` (CLIs) — all from PyPI.
|
|
10
|
+
|
|
11
|
+
## Self-publication
|
|
12
|
+
|
|
13
|
+
release-kit publishes itself from its own checkout: `ci.yml`'s `publish` job (main-push, gated on the check job) runs `uv run publish-packages --config publish-config.json` — the repo *is* release-kit, so no uvx bootstrap and no self-reference. Its dependencies must all exist on PyPI before its first publish (they did: it converted last, leaves-first ordering). The committed `pyproject.toml` version is permanently the `0.0.0.dev0` sentinel; the `release-kit-v*` tags are the version ledger. API-breaking changes ship with a manually bumped version — patch-auto assumes additive changes.
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
All are `uv run <name> --config <path>` from the consuming repo's root (config defaults to `build/publish-config.json` where optional).
|
|
18
|
+
|
|
19
|
+
| Command | Role |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `publish-packages` | Compute the publish plan from the tag ledger + path-diff, publish every changed package to its feeds, bump and tag app versions, push per-package tags. `--dry-run` prints the plan only. |
|
|
22
|
+
| `publish-dev` | Dev-channel mode: publish immutable `-dev.<run-id>` prereleases of every path-diff-changed package to its feeds. `--run-id` defaults to `GITHUB_RUN_ID`; never creates git tags, never touches app versions. |
|
|
23
|
+
| `create-release` | Assemble release notes (service SHAs from the configured compose files, package versions with registry links, app versions), package CI artifacts, and cut the dated GitHub Release. |
|
|
24
|
+
| `ensure-release-pr` | Maintain the standing `dev` → `main` "Next release" gate PR. |
|
|
25
|
+
| `fetch-ci-artifacts` | Locate the successful CI run for the release SHA (via the merge commit's second parent) and download its artifacts, pruning non-release ones per the config's skip rules. |
|
|
26
|
+
| `mirror-images` | Populate the org-level ghcr mirror namespace with every mirror-prefixed image reference the repo scan finds, via `crane copy`. |
|
|
27
|
+
|
|
28
|
+
## The CI-commit-free invariants
|
|
29
|
+
|
|
30
|
+
CI and release workflows must not create commits on any branch — `dev` → `main` merges are always true fast-forwards. The machinery that makes that possible lives here:
|
|
31
|
+
|
|
32
|
+
- **Version tracking**: per-package git tags (`{name}-v{semver}`, e.g. `placeframe-api-client-v0.1.8`, `capture-tool-v0.2.0`), never committed state files.
|
|
33
|
+
- **Change detection**: `git diff --quiet <last-tag> HEAD -- <path>`, never content hashing. `depends_on` cascades trigger dependents even when their own paths are unchanged.
|
|
34
|
+
- **Version scheme**: first release `0.1.0`, then patch bumps from the tag ledger. Per-package numbers are independent within one release event — no lockstep.
|
|
35
|
+
- **Unity `package.json` versions**: permanently `0.0.0-local` in the repo; patched ephemerally during `npm publish` and restored immediately — never committed.
|
|
36
|
+
- **Python `pyproject.toml` versions**: permanently `0.0.0.dev0` in the repo (`0.0.0-local` is not valid PEP 440); patched ephemerally around `uv build` and restored immediately — never committed. The sdist/wheel carries the real version; the committed file never does.
|
|
37
|
+
|
|
38
|
+
## Release units
|
|
39
|
+
|
|
40
|
+
The repo is the release unit: repos release independently; one release event publishes every changed package in the repo together; a package unchanged since its last tag is skipped (registries are immutable — there is nothing to publish), and dependency pins absorb sibling bumps without republishing dependents.
|
|
41
|
+
|
|
42
|
+
## Dev channel
|
|
43
|
+
|
|
44
|
+
`publish-dev` publishes immutable prereleases of every path-diff-changed package; it creates no git tags, bumps no app versions, and opens no release. Versions are keyed by the CI run id and spelled per feed — `{base}-dev.{run_id}` where semver allows it (nuget, npm), `{base}.dev{run_id}` on PyPI — because no single string is both valid semver and valid PEP 440. The base is `next_version(last stable tag)`, so a package's dev versions share one base until the stable flow tags it. npm prereleases ride the single inert `dev` dist-tag so `latest` never moves. The job prints the exact published versions; that print is the consumption interface — consumers pin by hand, there is no discovery tooling.
|
|
45
|
+
|
|
46
|
+
## The Feed seam
|
|
47
|
+
|
|
48
|
+
`feeds.Feed` is the registry adapter protocol (`publish(request: PublishRequest)`); `NuGetFeed`, `NpmFeed`, and `PyPIFeed` implement it. A feed's registry identity (nuget package id, npm name, PyPI distribution name) is config data, not code — the same package can publish to several feeds at one version. Config-declared feed names are validated against `feeds.KNOWN_FEEDS` at load time.
|
|
49
|
+
|
|
50
|
+
`PyPIFeed` shells out to `uv build` + `uv publish` and authenticates via trusted publishing (OIDC): it takes no credential, so the consuming workflow needs `id-token: write` and the PyPI project needs a configured (or pending) publisher for that repo/workflow. Idempotent re-publishing is handled by `uv publish --check-url` against the simple index. PyPI dependency pins are refused (`dependency_versions` must be empty) until a concrete in-repo consumer exists. npm authenticates the same way — trusted publishing via `--provenance`, no token plumbing — and npm allows one trusted publisher per package, bound to a single workflow filename: every workflow that publishes a given package to npm must be the same file.
|
|
51
|
+
|
|
52
|
+
## Config
|
|
53
|
+
|
|
54
|
+
`config.PublishConfig` (pydantic, loaded by `load_config`) validates the consumer's `publish-config.json`, including dependency-graph sanity: `depends_on` entries must reference packages declared **earlier** in the list (the plan walks dependencies-first), and `dependency_pins` must reference known packages. `dependency_pins` map a manifest dependency name to a package name; the pin is applied only when both the pinning package and the pinned package publish in the same event.
|
|
55
|
+
|
|
56
|
+
## See also
|
|
57
|
+
|
|
58
|
+
- `README.md` — human-facing usage and consumption wiring.
|
|
59
|
+
- [`bashrun`](https://github.com/outernet-foundation/bashrun) — the subprocess wrapper every shell-out goes through.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
release_kit-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright 2026 Tyler Hatch
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: release-kit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Publication machinery: per-package tag ledger, path-diff change detection, ephemeral version patching, and per-registry feed adapters (nuget, npm/UPM) driven by a declarative consumer-owned config
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
License-File: NOTICE
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Requires-Dist: bashrun>=0.1.0
|
|
9
|
+
Requires-Dist: pydantic-settings>=2.9.1
|
|
10
|
+
Requires-Dist: pydantic>=2.11.7
|
|
11
|
+
Requires-Dist: stack-toolkit>=0.1.0
|
|
12
|
+
Requires-Dist: typer>=0.17.4
|
|
13
|
+
Requires-Dist: unity-buildkit>=0.1.0
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# release-kit
|
|
2
|
+
|
|
3
|
+
Publication machinery for multi-feed package releases: a per-package git-tag ledger, path-diff change detection, ephemeral version patching, per-registry feed adapters (nuget, npm/UPM, PyPI), release orchestration, and an OCI mirror scan — all driven by a declarative, consumer-owned config.
|
|
4
|
+
|
|
5
|
+
Every consuming repo keeps only a `publish-config.json` (package identities, paths, tag prefixes, registry mappings) and workflow steps that are thin `uvx` invocations. See [`AGENTS.md`](./AGENTS.md) for the invariants (CI-commit-free releases, tag-ledger versioning, ephemeral `0.0.0-local` / `0.0.0.dev0` version patching) and the command catalog.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Python 3.13+ and [uv](https://docs.astral.sh/uv/)
|
|
10
|
+
- At runtime: `git`, `gh`, `dotnet` (nuget publish), `node`/`npm` (npm publish), `uv` (PyPI publish via trusted publishing), `crane` (installed by `mirror-images`)
|
|
11
|
+
|
|
12
|
+
## Consuming from another repo
|
|
13
|
+
|
|
14
|
+
Install nothing — release-kit is consumed **uvx-isolated** (it is a project dependency of nothing: the tool repos it publishes sit inside its own dependency graph, where a project-level release-kit edge is a resolver cycle). Pin the exact version in the workflow:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
uvx --from release-kit==0.1.0 publish-packages --config build/publish-config.json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then author `build/publish-config.json`:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"packages": [
|
|
25
|
+
{ "name": "my-api-client", "path": "generated/csharp/api-client/src/MyApiClient",
|
|
26
|
+
"feeds": { "nuget": "MyApiClient", "npm": "org.example.myproject.apiclient" } },
|
|
27
|
+
{ "name": "my-core", "path": "packages/unity/Core", "feeds": { "npm": "org.example.myproject" } },
|
|
28
|
+
{ "name": "my-arfoundation", "path": "packages/unity/ARFoundation",
|
|
29
|
+
"feeds": { "npm": "org.example.myproject.arfoundation" },
|
|
30
|
+
"depends_on": ["my-core"],
|
|
31
|
+
"dependency_pins": { "org.example.myproject": "my-core" } }
|
|
32
|
+
],
|
|
33
|
+
"apps": [
|
|
34
|
+
{ "name": "MyTool", "path": "apps/MyTool", "tag_prefix": "my-tool", "display_name": "My Tool" }
|
|
35
|
+
],
|
|
36
|
+
"compose_files": ["compose.bake.yml"],
|
|
37
|
+
"ci_workflow": "my-ci.yml",
|
|
38
|
+
"mirror_prefix": "ghcr.io/my-org/mirror"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
and invoke from CI:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uvx --from release-kit==0.1.0 publish-packages --config build/publish-config.json
|
|
46
|
+
uvx --from release-kit==0.1.0 publish-dev --config build/publish-config.json --run-id ${{ github.event.workflow_run.id }}
|
|
47
|
+
uvx --from release-kit==0.1.0 create-release --config build/publish-config.json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`publish-dev` is the dev-channel job: it publishes immutable `-dev.<run-id>` prereleases (`X.Y.Z.dev<run-id>` on PyPI) of every changed package on a green push — no git tags, npm `latest` untouched — and prints the exact versions to pin.
|
|
51
|
+
|
|
52
|
+
Environment (via pydantic-settings): `GITHUB_WORKSPACE`, `GITHUB_REPOSITORY`, `GITHUB_SHA`, `GITHUB_STEP_SUMMARY`, `GITHUB_OUTPUT`, `GITHUB_RUN_ID`, `NUGET_API_KEY`.
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv run ruff check .
|
|
58
|
+
uv run ruff format --check .
|
|
59
|
+
uv run basedpyright
|
|
60
|
+
uv run pytest
|
|
61
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "release-kit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Publication machinery: per-package tag ledger, path-diff change detection, ephemeral version patching, and per-registry feed adapters (nuget, npm/UPM) driven by a declarative consumer-owned config"
|
|
5
|
+
requires-python = ">=3.13"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"bashrun>=0.1.0",
|
|
8
|
+
"stack-toolkit>=0.1.0",
|
|
9
|
+
"unity-buildkit>=0.1.0",
|
|
10
|
+
"pydantic>=2.11.7",
|
|
11
|
+
"pydantic-settings>=2.9.1",
|
|
12
|
+
"typer>=0.17.4",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[dependency-groups]
|
|
16
|
+
dev = ["basedpyright>=1.39.10", "ruff>=0.14.11", "pytest>=8.0.0"]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
create-release = "release_kit.create_release:app"
|
|
24
|
+
ensure-release-pr = "release_kit.ensure_release_pr:app"
|
|
25
|
+
fetch-ci-artifacts = "release_kit.fetch_ci_artifacts:app"
|
|
26
|
+
mirror-images = "release_kit.mirror_images:app"
|
|
27
|
+
publish-dev = "release_kit.publish_dev:app"
|
|
28
|
+
publish-packages = "release_kit.publish_packages:app"
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
packages = ["src/release_kit"]
|
|
32
|
+
include = [
|
|
33
|
+
"src/release_kit/py.typed",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[tool.basedpyright]
|
|
37
|
+
venvPath = "."
|
|
38
|
+
venv = ".venv"
|
|
39
|
+
typeCheckingMode = "strict"
|
|
40
|
+
include = ["src", "tests"]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
target-version = "py313"
|
|
2
|
+
line-length = 120
|
|
3
|
+
preview = true
|
|
4
|
+
|
|
5
|
+
[lint]
|
|
6
|
+
select = ["ALL"]
|
|
7
|
+
ignore = [
|
|
8
|
+
# ── Permanent ─────────────────────────────────────────────────────────
|
|
9
|
+
# Type annotations — basedpyright strict mode handles this
|
|
10
|
+
"ANN",
|
|
11
|
+
# No docstrings, no copyright headers
|
|
12
|
+
"D",
|
|
13
|
+
"DOC",
|
|
14
|
+
"CPY",
|
|
15
|
+
# TODO/FIXME comment formatting
|
|
16
|
+
"TD",
|
|
17
|
+
"FIX",
|
|
18
|
+
# Exception message ergonomics — literal-indirection and custom-class churn without benefit
|
|
19
|
+
"raw-string-in-exception",
|
|
20
|
+
"f-string-in-exception",
|
|
21
|
+
"raise-vanilla-args",
|
|
22
|
+
# Class attribute names never conflict with builtins via self.x
|
|
23
|
+
"builtin-attribute-shadowing",
|
|
24
|
+
# Function-size counters — C901 already covers structural complexity
|
|
25
|
+
"too-many-return-statements",
|
|
26
|
+
"too-many-branches",
|
|
27
|
+
"too-many-arguments",
|
|
28
|
+
"too-many-locals",
|
|
29
|
+
"too-many-statements",
|
|
30
|
+
"too-many-positional-arguments",
|
|
31
|
+
# Typer's Option/Argument in argument defaults is its standard API pattern
|
|
32
|
+
"function-call-in-default-argument",
|
|
33
|
+
# Boolean parameters read fine as keyword-only flags here
|
|
34
|
+
"boolean-type-hint-positional-argument",
|
|
35
|
+
"boolean-default-value-positional-argument",
|
|
36
|
+
"boolean-positional-value-in-call",
|
|
37
|
+
# Relative imports are the intra-package convention
|
|
38
|
+
"relative-imports",
|
|
39
|
+
# Formatter-owned; enforced by `ruff format`
|
|
40
|
+
"missing-trailing-comma",
|
|
41
|
+
"unsorted-imports",
|
|
42
|
+
# Magic values in comparisons are readable in this CLI
|
|
43
|
+
"magic-value-comparison",
|
|
44
|
+
# The formatter owns wrapping; long string literals and URLs stay on one line
|
|
45
|
+
"line-too-long",
|
|
46
|
+
# src-layout tests need no __init__.py
|
|
47
|
+
"implicit-namespace-package",
|
|
48
|
+
# Runtime-used typing imports stay at module level
|
|
49
|
+
"typing-only-first-party-import",
|
|
50
|
+
"typing-only-third-party-import",
|
|
51
|
+
"typing-only-standard-library-import",
|
|
52
|
+
# Small literal tuples read fine in membership tests
|
|
53
|
+
"literal-membership",
|
|
54
|
+
# Feed and ledger adapters are classes so they satisfy their Protocols and can carry
|
|
55
|
+
# per-instance auth state (e.g. NuGetFeed's api key); not every adapter uses `self`
|
|
56
|
+
"no-self-use",
|
|
57
|
+
|
|
58
|
+
# ── Deferred to PLE-248 — Enforce the deferred ruff rules
|
|
59
|
+
# https://linear.app/plerionplatforms/issue/PLE-248
|
|
60
|
+
# Mirrors placeframe's root ruff.toml transitional Ticket-N blocks; lifting
|
|
61
|
+
# a rule here should happen alongside lifting it from placeframe's ruff.toml.
|
|
62
|
+
"complex-structure", # function too complex — Ticket 9
|
|
63
|
+
"too-many-nested-blocks", # too many nested blocks — Ticket 9
|
|
64
|
+
|
|
65
|
+
# ── Deferred to PLE-336 — Replace print() with structured logging
|
|
66
|
+
# https://linear.app/plerionplatforms/issue/PLE-336
|
|
67
|
+
"print", # print found
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[lint.per-file-ignores]
|
|
71
|
+
"tests/**" = ["assert", "suspicious-subprocess-import", "start-process-with-partial-path", "no-self-use", "unused-method-argument"]
|
|
72
|
+
# feeds.py catches subprocess.CalledProcessError raised by bashrun — the stdlib type, no way around the import
|
|
73
|
+
"src/release_kit/feeds.py" = ["suspicious-subprocess-import"]
|
|
74
|
+
# config.py declares the default CI-runner scratch path shared by fetch-ci-artifacts and create-release
|
|
75
|
+
"src/release_kit/config.py" = ["hardcoded-temp-file"]
|
|
76
|
+
# tests assert that same default
|
|
77
|
+
"tests/test_config.py" = ["hardcoded-temp-file"]
|
|
78
|
+
|
|
79
|
+
[lint.flake8-builtins]
|
|
80
|
+
ignorelist = ["id", "map"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from .config import AppConfig, PackageConfig, PublishConfig, load_config, select_packages
|
|
2
|
+
from .feeds import Feed, NuGetFeed, NpmFeed, PublishRequest, build_feeds, pep440_dev_version, semver_dev_version
|
|
3
|
+
from .ledger import GitLedger
|
|
4
|
+
from .plan import (
|
|
5
|
+
PackagePlan,
|
|
6
|
+
TagLedger,
|
|
7
|
+
compute_plan,
|
|
8
|
+
next_version,
|
|
9
|
+
render_dev_summary,
|
|
10
|
+
render_summary,
|
|
11
|
+
resolved_dependency_versions,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AppConfig",
|
|
16
|
+
"Feed",
|
|
17
|
+
"GitLedger",
|
|
18
|
+
"NpmFeed",
|
|
19
|
+
"NuGetFeed",
|
|
20
|
+
"PackageConfig",
|
|
21
|
+
"PackagePlan",
|
|
22
|
+
"PublishConfig",
|
|
23
|
+
"PublishRequest",
|
|
24
|
+
"TagLedger",
|
|
25
|
+
"build_feeds",
|
|
26
|
+
"compute_plan",
|
|
27
|
+
"load_config",
|
|
28
|
+
"next_version",
|
|
29
|
+
"pep440_dev_version",
|
|
30
|
+
"render_dev_summary",
|
|
31
|
+
"render_summary",
|
|
32
|
+
"resolved_dependency_versions",
|
|
33
|
+
"select_packages",
|
|
34
|
+
"semver_dev_version",
|
|
35
|
+
]
|