putitoutthere 0.2.25 → 0.2.27
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.
- package/CHANGELOG.md +3 -0
- package/MIGRATIONS.md +186 -0
- package/README.md +51 -12
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +10 -1
- package/dist/check.js.map +1 -1
- package/dist/error-codes.d.ts +10 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +11 -0
- package/dist/error-codes.js.map +1 -1
- package/dist/handlers/pypi.d.ts +0 -8
- package/dist/handlers/pypi.d.ts.map +1 -1
- package/dist/handlers/pypi.js +25 -47
- package/dist/handlers/pypi.js.map +1 -1
- package/dist/preflight.d.ts +38 -0
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +165 -4
- package/dist/preflight.js.map +1 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +7 -1
- package/dist/publish.js.map +1 -1
- package/dist/write-version.d.ts +20 -33
- package/dist/write-version.d.ts.map +1 -1
- package/dist/write-version.js +33 -73
- package/dist/write-version.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,7 @@ are prefixed `**BREAKING**` and link to the matching section in
|
|
|
26
26
|
|
|
27
27
|
### Changed
|
|
28
28
|
|
|
29
|
+
- **BREAKING: `kind = "pypi"` packages must declare `[project].dynamic = ["version"]` in `pyproject.toml`.** Static `[project].version = "..."` literals are now rejected at PR time by `putitoutthere check` and again at publish-time preflight, both surfacing the new stable error code `PIOT_PYPI_STATIC_VERSION`. The most common Python-publishing footgun: putitoutthere does not edit `pyproject.toml` at release time (per the [no version computation](./notes/design-commitments.md#non-goals) design commitment), so a literal silently shipped the previous release's wheel/sdist because the build backend read whatever was on disk. The fix is the same across the three supported backends: `hatch-vcs` (recommended), `setuptools-scm`, and maturin's Cargo.toml-driven path — all accept `dynamic = ["version"]`. `pypi.writeVersion` and the `putitoutthere write-version` CLI subcommand also reject the literal shape (previously they rewrote it in place). The `replacePyProjectVersion` helper, the "preserves comments around the literal" carve-out, and the sibling-pyproject-and-Cargo.toml double-rewrite path are removed; under the dynamic contract `Cargo.toml` alone is the bump target for maturin and `SETUPTOOLS_SCM_PRETEND_VERSION` is the handoff for hatch-vcs / setuptools-scm. See [README → Python version source](./README.md#python-version-source--required-shape) and [MIGRATIONS.md](./MIGRATIONS.md#pypi-pyproject-toml-must-declare-dynamic--version). #333.
|
|
29
30
|
- **BREAKING: `publish` throws on an empty matrix instead of exiting clean.** The reusable workflow's `publish` step now fails red when the plan is empty, with `PIOT_PUBLISH_EMPTY_PLAN` in the message. Previously, an empty plan logged `info: publish: plan is empty; nothing to release` and returned `ok: true` — leaving consumers with green release runs that hadn't published anything. Skips belong at the workflow gate (the `if:` on the publish job that reads the plan job's matrix output), not in the publish step. See [MIGRATIONS.md](./MIGRATIONS.md#publish-throws-on-empty-matrix).
|
|
30
31
|
|
|
31
32
|
### Deprecated
|
|
@@ -38,6 +39,8 @@ are prefixed `**BREAKING**` and link to the matching section in
|
|
|
38
39
|
|
|
39
40
|
### Fixed
|
|
40
41
|
|
|
42
|
+
- **`check` no longer false-positives `PIOT_CRATES_MISSING_METADATA` on crates whose `Cargo.toml` inherits `description` / `license` / `license-file` from `[workspace.package]`.** Cargo's recommended pattern for shared crate metadata is `[workspace.package]` in the workspace root plus `<field>.workspace = true` in each member; `cargo publish` resolves the inheritance and embeds the literal value into `Cargo.toml.orig` before upload, so crates.io receives the resolved field. The check previously parsed the member `Cargo.toml` in isolation and treated `{ workspace: true }` as a missing string, flagging well-formed workspaces as if they would fail publish. `checkCratesMetadata` now walks up from each crate's `path` to find the nearest parent `Cargo.toml` with a `[workspace]` table and, when a field is declared as `<field>.workspace = true`, resolves it from `[workspace.package]` before deciding it's missing. Genuinely-missing fields (workspace root has no value for the inherited key, or no `[workspace.package]` block at all) still report through `PIOT_CRATES_MISSING_METADATA`. Hit in the wild in `thekevinscott/dirsql#177`. See [MIGRATIONS.md](./MIGRATIONS.md#crates-metadata-check-resolves-workspace-package-inheritance). #328.
|
|
43
|
+
|
|
41
44
|
- **`kind = "pypi"` + `build = "hatch"` now publishes a wheel alongside the sdist.** A pure-Python hatch package previously planned only a `target = "sdist"` row, so PyPI ended up with sdist-only and downstream `pip install` / `uvx ...` had to provision hatchling and run `python -m build` on a cold cache (several seconds per invocation) instead of doing a sub-second download-and-extract. `pypa/build`'s default on a pure-Python tree is to produce both an sdist and an any-platform wheel; the planner just wasn't asking for the wheel. The matrix now emits a second row per hatch package — `target = "any"`, `artifact_name = <name>-wheel-any` — and the reusable workflow's build step runs `python -m build --wheel --outdir dist` (with `SETUPTOOLS_SCM_PRETEND_VERSION` set, mirroring the sdist row's contract). Scoped to hatch per the issue: `build = "setuptools"` stays sdist-only (consumers who want a wheel there can switch to hatch or supply their own wheel), and `build = "maturin"` keeps its per-target wheel rows. Consumers' existing `pypi-publish` job picks up the new wheel automatically: the recommended `actions/download-artifact@v8` step in the README already uses `pattern: '*-wheel-*'`. Hit in the wild on `repo-name-checker` 0.1.0. See [MIGRATIONS.md](./MIGRATIONS.md#hatch-wheel-any-row). #324.
|
|
42
45
|
|
|
43
46
|
- **Single-artifact publish jobs no longer fail completeness with `missing artifact directory <name>/`.** `actions/download-artifact@v8` is count-sensitive: with `path: artifacts` and no `name`/`pattern` filter, multiple artifacts each get their own `artifacts/<name>/` subdir (the documented multi-case the engine relies on), but a single artifact extracts directly into `artifacts/` with no per-artifact subdir. Consumers whose plan emits exactly one expected artifact — canonical case: pure-Python `[[package]]` with `build = "hatch"`, which emits an sdist row only — therefore aborted at the engine's completeness check before any side effect ran. The reusable workflow's publish job now normalizes the layout in-process before completeness: when the plan expects a single staged artifact and the documented subdir is absent, files in `artifacts/` are moved into `artifacts/<artifact_name>/` so the rest of the engine sees the contract it was written against. No-op in the multi-artifact case, when the subdir already exists, or when nothing was downloaded (crates-only / vanilla-npm plans). No consumer-side change required. Hit in the wild on a pypi-only consumer with a single sdist row; multi-artifact consumers (pypi + npm, or sdist + wheels) were unaffected. See [MIGRATIONS.md](./MIGRATIONS.md#single-artifact-publish-layout-normalization). #311.
|
package/MIGRATIONS.md
CHANGED
|
@@ -21,6 +21,77 @@ Each section covers five things, in order:
|
|
|
21
21
|
|
|
22
22
|
## Unreleased
|
|
23
23
|
|
|
24
|
+
### Crates metadata check resolves `[workspace.package]` inheritance
|
|
25
|
+
|
|
26
|
+
**Summary.** Cargo's recommended pattern for shared crate metadata in a
|
|
27
|
+
workspace is `[workspace.package]` in the workspace root combined with
|
|
28
|
+
`<field>.workspace = true` on each member. `cargo publish` resolves the
|
|
29
|
+
inheritance and embeds the literal value into `Cargo.toml.orig` before
|
|
30
|
+
upload, so crates.io receives the resolved field. The pre-merge
|
|
31
|
+
`check` and the pre-publish `requireCratesMetadata` previously parsed
|
|
32
|
+
each member `Cargo.toml` in isolation and treated the
|
|
33
|
+
`{ workspace: true }` placeholder as a missing string, flagging
|
|
34
|
+
well-formed workspaces with `PIOT_CRATES_MISSING_METADATA` even though
|
|
35
|
+
the eventual `cargo publish` would succeed. The check now walks up from
|
|
36
|
+
each crate's `path` to find the nearest parent `Cargo.toml` carrying a
|
|
37
|
+
`[workspace]` table and, when a member field is declared as
|
|
38
|
+
`<field>.workspace = true`, resolves the value from `[workspace.package]`
|
|
39
|
+
before deciding it's missing. Genuinely-missing inherited fields — the
|
|
40
|
+
workspace root has no value for the key, or no `[workspace.package]`
|
|
41
|
+
block at all — still report through `PIOT_CRATES_MISSING_METADATA`. Hit
|
|
42
|
+
in the wild in `thekevinscott/dirsql#177`. Tracked at #328.
|
|
43
|
+
|
|
44
|
+
**Required changes.** None.
|
|
45
|
+
|
|
46
|
+
**Deprecations removed.** None.
|
|
47
|
+
|
|
48
|
+
**Behavior changes without code changes.**
|
|
49
|
+
|
|
50
|
+
- Crates packages whose `Cargo.toml` reads
|
|
51
|
+
```toml
|
|
52
|
+
[package]
|
|
53
|
+
name = "foo"
|
|
54
|
+
description.workspace = true
|
|
55
|
+
license.workspace = true
|
|
56
|
+
```
|
|
57
|
+
with the workspace root supplying
|
|
58
|
+
```toml
|
|
59
|
+
[workspace.package]
|
|
60
|
+
description = "..."
|
|
61
|
+
license = "MIT"
|
|
62
|
+
```
|
|
63
|
+
no longer surface as `PIOT_CRATES_MISSING_METADATA` findings from
|
|
64
|
+
`putitoutthere check` or as `requireCratesMetadata` errors from the
|
|
65
|
+
publish path. `license-file.workspace = true` resolves the same way.
|
|
66
|
+
- Crates that inherit a field whose workspace root omits it (or has no
|
|
67
|
+
`[workspace.package]` block) continue to surface as
|
|
68
|
+
`PIOT_CRATES_MISSING_METADATA` — the publish would still fail at
|
|
69
|
+
crates.io's metadata gate, so the preflight keeps flagging it.
|
|
70
|
+
- Inline (non-inherited) `description` / `license` / `license-file`
|
|
71
|
+
fields are unchanged.
|
|
72
|
+
|
|
73
|
+
**Verification.** Inside a workspace that centralizes metadata:
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
# Cargo.toml
|
|
77
|
+
[workspace]
|
|
78
|
+
members = ["packages/rust"]
|
|
79
|
+
|
|
80
|
+
[workspace.package]
|
|
81
|
+
license = "MIT"
|
|
82
|
+
description = "Shared description."
|
|
83
|
+
|
|
84
|
+
# packages/rust/Cargo.toml
|
|
85
|
+
[package]
|
|
86
|
+
name = "foo"
|
|
87
|
+
description.workspace = true
|
|
88
|
+
license.workspace = true
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`putitoutthere check` should report `0 findings` for `foo`'s metadata,
|
|
92
|
+
and `cargo metadata --no-deps --format-version=1 --manifest-path packages/rust/Cargo.toml`
|
|
93
|
+
should show the resolved `"license":"MIT"` / `"description":"..."`.
|
|
94
|
+
|
|
24
95
|
### Hatch wheel-any row
|
|
25
96
|
|
|
26
97
|
**Summary.** `kind = "pypi"` + `build = "hatch"` now publishes a wheel
|
|
@@ -81,6 +152,121 @@ curl -s https://pypi.org/pypi/<name>/json | jq '.urls[].packagetype'
|
|
|
81
152
|
`pip install <name>` (or `uvx <name>`) should download `*.whl` and
|
|
82
153
|
skip the local build step entirely.
|
|
83
154
|
|
|
155
|
+
### pypi `pyproject.toml` must declare `dynamic = ["version"]`
|
|
156
|
+
|
|
157
|
+
**Summary.** Every `kind = "pypi"` package's `pyproject.toml` must
|
|
158
|
+
now declare `[project].dynamic = ["version"]`. Static
|
|
159
|
+
`[project].version = "x.y.z"` literals are rejected at PR time by
|
|
160
|
+
`putitoutthere check` and again at publish-time preflight, both
|
|
161
|
+
under the stable error code `PIOT_PYPI_STATIC_VERSION`. This is
|
|
162
|
+
the most common Python-publishing footgun: putitoutthere does not
|
|
163
|
+
edit `pyproject.toml` at release time (per the [no version
|
|
164
|
+
computation](./notes/design-commitments.md#non-goals) design
|
|
165
|
+
commitment), so a literal silently shipped the previous release's
|
|
166
|
+
wheel/sdist because the build backend read whatever was on disk.
|
|
167
|
+
Making the dynamic shape mandatory closes the failure mode at the
|
|
168
|
+
earliest knowable boundary — the consumer's own repo state, before
|
|
169
|
+
a release run is ever invoked.
|
|
170
|
+
|
|
171
|
+
**Required changes.**
|
|
172
|
+
|
|
173
|
+
Before — a static literal, accepted in v0.2.x:
|
|
174
|
+
|
|
175
|
+
```toml
|
|
176
|
+
[project]
|
|
177
|
+
name = "your-package"
|
|
178
|
+
version = "0.1.0"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
After — `hatch-vcs` (recommended for new packages):
|
|
182
|
+
|
|
183
|
+
```toml
|
|
184
|
+
[build-system]
|
|
185
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
186
|
+
build-backend = "hatchling.build"
|
|
187
|
+
|
|
188
|
+
[project]
|
|
189
|
+
name = "your-package"
|
|
190
|
+
dynamic = ["version"]
|
|
191
|
+
|
|
192
|
+
[tool.hatch.version]
|
|
193
|
+
source = "vcs"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
After — `setuptools-scm` (for setuptools-backed projects):
|
|
197
|
+
|
|
198
|
+
```toml
|
|
199
|
+
[build-system]
|
|
200
|
+
requires = ["setuptools>=64", "setuptools-scm>=8"]
|
|
201
|
+
build-backend = "setuptools.build_meta"
|
|
202
|
+
|
|
203
|
+
[project]
|
|
204
|
+
name = "your-package"
|
|
205
|
+
dynamic = ["version"]
|
|
206
|
+
|
|
207
|
+
[tool.setuptools_scm]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
After — `maturin` (Python packages built from a Rust crate): the
|
|
211
|
+
version source moves to the sibling `Cargo.toml`'s
|
|
212
|
+
`[package].version`. `pyproject.toml` declares only that the version
|
|
213
|
+
is dynamic:
|
|
214
|
+
|
|
215
|
+
```toml
|
|
216
|
+
[build-system]
|
|
217
|
+
requires = ["maturin>=1"]
|
|
218
|
+
build-backend = "maturin"
|
|
219
|
+
|
|
220
|
+
[project]
|
|
221
|
+
name = "your-package"
|
|
222
|
+
dynamic = ["version"]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
No reusable-workflow input changes; the existing
|
|
226
|
+
`SETUPTOOLS_SCM_PRETEND_VERSION` injection in the build step already
|
|
227
|
+
hands the planned version to `hatch-vcs` / `setuptools-scm`, and the
|
|
228
|
+
existing `putitoutthere write-version` step already bumps
|
|
229
|
+
`Cargo.toml` for the maturin path.
|
|
230
|
+
|
|
231
|
+
**Deprecations removed.**
|
|
232
|
+
|
|
233
|
+
- `pypi.writeVersion` and the `putitoutthere write-version` CLI
|
|
234
|
+
subcommand no longer rewrite static literals in place — both now
|
|
235
|
+
surface `PIOT_PYPI_STATIC_VERSION`. Previously they would
|
|
236
|
+
silently overwrite the literal.
|
|
237
|
+
- The `replacePyProjectVersion` helper export and the
|
|
238
|
+
"bumps BOTH pyproject and sibling Cargo.toml on the static-literal
|
|
239
|
+
path" #276 carve-out are gone. Under the dynamic contract, `Cargo.toml`
|
|
240
|
+
alone is the bump target on the maturin path and the pyproject literal
|
|
241
|
+
has no role.
|
|
242
|
+
|
|
243
|
+
**Behavior changes without code changes.**
|
|
244
|
+
|
|
245
|
+
- `putitoutthere check` reports `PIOT_PYPI_STATIC_VERSION` against
|
|
246
|
+
every pypi package whose `pyproject.toml` has a literal
|
|
247
|
+
`[project].version`. Aggregated with the other preflight
|
|
248
|
+
findings — one round-trip, not one error at a time.
|
|
249
|
+
- The publish path runs `requirePypiVersionSource` between the
|
|
250
|
+
existing `requireCratesMetadata` and the artifact-completeness
|
|
251
|
+
check; a misconfigured pypi tree fails fast there even if the
|
|
252
|
+
PR-time `check.yml` gate was skipped.
|
|
253
|
+
|
|
254
|
+
**Verification.**
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# In a repo that still declares a static version:
|
|
258
|
+
$ putitoutthere check
|
|
259
|
+
[PIOT_PYPI_STATIC_VERSION] packages/python/pyproject.toml declares a
|
|
260
|
+
static `[project].version` literal. Use `[project].dynamic =
|
|
261
|
+
["version"]` ...
|
|
262
|
+
|
|
263
|
+
# After the migration above:
|
|
264
|
+
$ putitoutthere check
|
|
265
|
+
# (no findings, exits 0)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Tracked at #333.
|
|
269
|
+
|
|
84
270
|
### New `check.yml` reusable workflow for PR-time config sanity
|
|
85
271
|
|
|
86
272
|
**Summary.** `putitoutthere` now ships a third reusable workflow,
|
package/README.md
CHANGED
|
@@ -741,18 +741,57 @@ def entrypoint():
|
|
|
741
741
|
os.execv(binary, [str(binary), *sys.argv[1:]])
|
|
742
742
|
```
|
|
743
743
|
|
|
744
|
-
##
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
744
|
+
## Python version source — required shape
|
|
745
|
+
|
|
746
|
+
Every `kind = "pypi"` package **must** declare `[project].dynamic = ["version"]`
|
|
747
|
+
in its `pyproject.toml`. Static `[project].version = "..."` literals are
|
|
748
|
+
rejected at PR time by `putitoutthere check` (error code
|
|
749
|
+
`PIOT_PYPI_STATIC_VERSION`) and again at publish time before any side effect.
|
|
750
|
+
|
|
751
|
+
Why the requirement exists: putitoutthere does not edit `pyproject.toml`
|
|
752
|
+
at release time (per the "no version computation" design commitment) — a
|
|
753
|
+
static literal silently ships the previous release's wheel/sdist because
|
|
754
|
+
the build backend reads whatever is on disk. The fix is the same across
|
|
755
|
+
all supported Python build backends: declare the version as dynamic and
|
|
756
|
+
let the backend derive it.
|
|
757
|
+
|
|
758
|
+
### Recommended: `hatch-vcs`
|
|
759
|
+
|
|
760
|
+
The blessed path for new Python packages. The version comes from the
|
|
761
|
+
latest git tag at build time, so no manual `pyproject.toml` edit is ever
|
|
762
|
+
needed.
|
|
763
|
+
|
|
764
|
+
```toml
|
|
765
|
+
[build-system]
|
|
766
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
767
|
+
build-backend = "hatchling.build"
|
|
768
|
+
|
|
769
|
+
[project]
|
|
770
|
+
name = "your-package"
|
|
771
|
+
dynamic = ["version"]
|
|
772
|
+
|
|
773
|
+
[tool.hatch.version]
|
|
774
|
+
source = "vcs"
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
The reusable workflow sets `SETUPTOOLS_SCM_PRETEND_VERSION` on the build
|
|
778
|
+
step to the planned version, which `hatch-vcs` honors. Per-package
|
|
779
|
+
variants like `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_<PKG>` are silently
|
|
780
|
+
ignored by `hatch-vcs`; only the global form works.
|
|
781
|
+
|
|
782
|
+
### Also accepted
|
|
783
|
+
|
|
784
|
+
- **`setuptools-scm`** (for setuptools-backed projects): same idea, same
|
|
785
|
+
env-var handoff. Add `setuptools-scm` to `[build-system].requires`,
|
|
786
|
+
declare `dynamic = ["version"]`, and the workflow's
|
|
787
|
+
`SETUPTOOLS_SCM_PRETEND_VERSION` injection covers the build step.
|
|
788
|
+
- **Maturin** (for Python packages built from a Rust crate): pyproject
|
|
789
|
+
declares `dynamic = ["version"]`; the version source is the sibling
|
|
790
|
+
`Cargo.toml`'s `[package].version`. putitoutthere bumps `Cargo.toml`
|
|
791
|
+
before `maturin build` runs.
|
|
792
|
+
|
|
793
|
+
If a Python package can't fit any of these three shapes, it's outside
|
|
794
|
+
putitoutthere's scope — write your own release workflow.
|
|
756
795
|
|
|
757
796
|
## Project layout
|
|
758
797
|
|
package/dist/check.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAqBH,MAAM,WAAW,YAAY;IAC3B;yEACqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;iDAC6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,EAAE,CAsC5D"}
|
package/dist/check.js
CHANGED
|
@@ -31,7 +31,7 @@ import { loadConfig } from './config.js';
|
|
|
31
31
|
import { ErrorCodes } from './error-codes.js';
|
|
32
32
|
import { matchesAny } from './glob.js';
|
|
33
33
|
import { assertTripleSupported } from './handlers/npm-platform.js';
|
|
34
|
-
import { checkCratesMetadata, checkProvenanceMetadata } from './preflight.js';
|
|
34
|
+
import { checkCratesMetadata, checkProvenanceMetadata, checkPypiVersionSource, } from './preflight.js';
|
|
35
35
|
import { formatTag } from './tag-template.js';
|
|
36
36
|
import { normalizeTarget } from './types.js';
|
|
37
37
|
/**
|
|
@@ -76,6 +76,7 @@ export function runChecks(opts) {
|
|
|
76
76
|
checkNpmRepository(packages, findings);
|
|
77
77
|
checkCratesPackageMetadata(packages, findings);
|
|
78
78
|
checkPyprojectAndBundleCli(packages, cwd, findings);
|
|
79
|
+
checkPypiVersion(packages, findings);
|
|
79
80
|
checkNpmTargetTriples(packages, findings);
|
|
80
81
|
return findings;
|
|
81
82
|
}
|
|
@@ -198,6 +199,14 @@ function checkPyprojectAndBundleCli(packages, cwd, findings) {
|
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
}
|
|
202
|
+
function checkPypiVersion(packages, findings) {
|
|
203
|
+
for (const f of checkPypiVersionSource(packages)) {
|
|
204
|
+
findings.push({
|
|
205
|
+
package: f.package,
|
|
206
|
+
message: `[${ErrorCodes.PYPI_STATIC_VERSION}] ${f.pyprojectPath} declares a static \`[project].version\` literal. Use \`[project].dynamic = ["version"]\` with hatch-vcs (recommended), setuptools-scm, or the maturin Cargo.toml-driven path — putitoutthere does not edit pyproject.toml at release time, so a literal silently ships the previous release.`,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
201
210
|
function checkNpmTargetTriples(packages, findings) {
|
|
202
211
|
for (const p of packages) {
|
|
203
212
|
if (p.kind !== 'npm')
|
package/dist/check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAgB,MAAM,aA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IAAI,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/error-codes.d.ts
CHANGED
|
@@ -44,6 +44,16 @@ export declare const ErrorCodes: {
|
|
|
44
44
|
* transitive dep. Failing at preflight catches the precondition
|
|
45
45
|
* in milliseconds. #290. */
|
|
46
46
|
readonly CRATES_MISSING_METADATA: "PIOT_CRATES_MISSING_METADATA";
|
|
47
|
+
/** A pypi package's `pyproject.toml` declares a static
|
|
48
|
+
* `[project].version = "..."` literal instead of
|
|
49
|
+
* `[project].dynamic = ["version"]`. putitoutthere does not edit
|
|
50
|
+
* the literal at release time (per design-commitment #1, no
|
|
51
|
+
* version computation), so the build backend reads whatever is on
|
|
52
|
+
* disk and silently ships the previous release's wheel/sdist.
|
|
53
|
+
* The fix is `dynamic = ["version"]` with hatch-vcs as the source
|
|
54
|
+
* (the recommended path; setuptools-scm and the maturin
|
|
55
|
+
* Cargo.toml-driven path are equally valid). */
|
|
56
|
+
readonly PYPI_STATIC_VERSION: "PIOT_PYPI_STATIC_VERSION";
|
|
47
57
|
};
|
|
48
58
|
export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
49
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU;IACrB;;;8CAG0C;;IAE1C;;;;;;kDAM8C;;IAE9C;;;;;0DAKsD;;IAEtD;;;;;;iCAM6B;;
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU;IACrB;;;8CAG0C;;IAE1C;;;;;;kDAM8C;;IAE9C;;;;;0DAKsD;;IAEtD;;;;;;iCAM6B;;IAE7B;;;;;;;;qDAQiD;;CAEzC,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,SAAS,EAM/C,CAAC"}
|
package/dist/error-codes.js
CHANGED
|
@@ -44,6 +44,16 @@ export const ErrorCodes = {
|
|
|
44
44
|
* transitive dep. Failing at preflight catches the precondition
|
|
45
45
|
* in milliseconds. #290. */
|
|
46
46
|
CRATES_MISSING_METADATA: 'PIOT_CRATES_MISSING_METADATA',
|
|
47
|
+
/** A pypi package's `pyproject.toml` declares a static
|
|
48
|
+
* `[project].version = "..."` literal instead of
|
|
49
|
+
* `[project].dynamic = ["version"]`. putitoutthere does not edit
|
|
50
|
+
* the literal at release time (per design-commitment #1, no
|
|
51
|
+
* version computation), so the build backend reads whatever is on
|
|
52
|
+
* disk and silently ships the previous release's wheel/sdist.
|
|
53
|
+
* The fix is `dynamic = ["version"]` with hatch-vcs as the source
|
|
54
|
+
* (the recommended path; setuptools-scm and the maturin
|
|
55
|
+
* Cargo.toml-driven path are equally valid). */
|
|
56
|
+
PYPI_STATIC_VERSION: 'PIOT_PYPI_STATIC_VERSION',
|
|
47
57
|
};
|
|
48
58
|
/**
|
|
49
59
|
* Iterable form of the codes. Walked by tests for uniqueness/format
|
|
@@ -54,5 +64,6 @@ export const ALL_ERROR_CODES = [
|
|
|
54
64
|
ErrorCodes.PUBLISH_EMPTY_PLAN,
|
|
55
65
|
ErrorCodes.NPM_MISSING_REPOSITORY,
|
|
56
66
|
ErrorCodes.CRATES_MISSING_METADATA,
|
|
67
|
+
ErrorCodes.PYPI_STATIC_VERSION,
|
|
57
68
|
];
|
|
58
69
|
//# sourceMappingURL=error-codes.js.map
|
package/dist/error-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;8CAG0C;IAC1C,aAAa,EAAE,oBAAoB;IACnC;;;;;;kDAM8C;IAC9C,kBAAkB,EAAE,yBAAyB;IAC7C;;;;;0DAKsD;IACtD,sBAAsB,EAAE,6BAA6B;IACrD;;;;;;iCAM6B;IAC7B,uBAAuB,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;8CAG0C;IAC1C,aAAa,EAAE,oBAAoB;IACnC;;;;;;kDAM8C;IAC9C,kBAAkB,EAAE,yBAAyB;IAC7C;;;;;0DAKsD;IACtD,sBAAsB,EAAE,6BAA6B;IACrD;;;;;;iCAM6B;IAC7B,uBAAuB,EAAE,8BAA8B;IACvD;;;;;;;;qDAQiD;IACjD,mBAAmB,EAAE,0BAA0B;CACvC,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,UAAU,CAAC,aAAa;IACxB,UAAU,CAAC,kBAAkB;IAC7B,UAAU,CAAC,sBAAsB;IACjC,UAAU,CAAC,uBAAuB;IAClC,UAAU,CAAC,mBAAmB;CAC/B,CAAC"}
|
package/dist/handlers/pypi.d.ts
CHANGED
|
@@ -35,14 +35,6 @@
|
|
|
35
35
|
* Issue #17. Plan: §6.4, §12.2, §12.3, §13.1, §14.5, §16.1.
|
|
36
36
|
*/
|
|
37
37
|
import type { Handler } from '../types.js';
|
|
38
|
-
/**
|
|
39
|
-
* Rewrites the first `version = "x.y.z"` inside the `[project]` table.
|
|
40
|
-
*
|
|
41
|
-
* Precondition: the caller has already confirmed a `[project]` table exists
|
|
42
|
-
* and does not declare `dynamic = ["version"]`. Throws when no literal
|
|
43
|
-
* `version = "..."` line can be located inside `[project]`.
|
|
44
|
-
*/
|
|
45
|
-
export declare function replacePyProjectVersion(source: string, version: string): string;
|
|
46
38
|
/**
|
|
47
39
|
* `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_<SUFFIX>` name suffix derived from
|
|
48
40
|
* a package name per PEP 503's canonical normalisation. Uppercase,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pypi.d.ts","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;
|
|
1
|
+
{"version":3,"file":"pypi.d.ts","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAQH,OAAO,KAAK,EAAO,OAAO,EAAiB,MAAM,aAAa,CAAC;AAqJ/D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,eAAO,MAAM,IAAI,EAAE,OAKlB,CAAC"}
|
package/dist/handlers/pypi.js
CHANGED
|
@@ -34,12 +34,14 @@
|
|
|
34
34
|
*
|
|
35
35
|
* Issue #17. Plan: §6.4, §12.2, §12.3, §13.1, §14.5, §16.1.
|
|
36
36
|
*/
|
|
37
|
-
import { readFileSync
|
|
37
|
+
import { readFileSync } from 'node:fs';
|
|
38
38
|
import { join } from 'node:path';
|
|
39
39
|
import { parse as parseToml } from 'smol-toml';
|
|
40
|
+
import { ErrorCodes } from '../error-codes.js';
|
|
40
41
|
import { TransientError } from '../types.js';
|
|
41
42
|
import { USER_AGENT } from '../version.js';
|
|
42
43
|
const REGISTRY = 'https://pypi.org';
|
|
44
|
+
const DYNAMIC_VERSION_DOC_POINTER = 'https://thekevinscott.github.io/putitoutthere/guide/dynamic-versions';
|
|
43
45
|
async function isPublishedImpl(pkg, version, _ctx) {
|
|
44
46
|
const name = pypiNameFor(pkg);
|
|
45
47
|
const url = `${REGISTRY}/pypi/${encodeURIComponent(name)}/${encodeURIComponent(version)}/json`;
|
|
@@ -70,9 +72,6 @@ function writeVersionImpl(pkg, version, ctx) {
|
|
|
70
72
|
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
71
73
|
return Promise.reject(err instanceof Error ? err : new Error(String(err)));
|
|
72
74
|
}
|
|
73
|
-
// Single TOML parse site: distinguishes (a) malformed TOML, (b) no [project]
|
|
74
|
-
// table, (c) [project] present but without static or dynamic version.
|
|
75
|
-
// The regex rewrite below only runs for case (c)-that-resolves-successfully.
|
|
76
75
|
let parsed;
|
|
77
76
|
try {
|
|
78
77
|
parsed = parseToml(original);
|
|
@@ -83,39 +82,37 @@ function writeVersionImpl(pkg, version, ctx) {
|
|
|
83
82
|
}
|
|
84
83
|
const project = parsed?.project;
|
|
85
84
|
if (!project) {
|
|
86
|
-
return Promise.reject(new Error(
|
|
85
|
+
return Promise.reject(new Error(`pyproject.toml has no [project] table -- declare [project].dynamic = ["version"] with hatch-vcs (or setuptools-scm / maturin Cargo.toml). See ${DYNAMIC_VERSION_DOC_POINTER}.`));
|
|
87
86
|
}
|
|
88
|
-
// Dynamic-version projects (hatch-vcs, setuptools-scm, maturin reading
|
|
89
|
-
// Cargo.toml, etc) have `dynamic = [..., "version", ...]` under [project]
|
|
90
|
-
// and no literal version line to rewrite. The build backend derives the
|
|
91
|
-
// version itself. Per design-commitment #1 (no version computation),
|
|
92
|
-
// skip the rewrite -- the consumer's build system handles propagation.
|
|
93
|
-
// Surface an actionable guidance line so adopters aren't left guessing
|
|
94
|
-
// how the planned version reaches the build backend. See #207.
|
|
95
87
|
if (projectDynamicIncludesVersion(project)) {
|
|
88
|
+
// Dynamic-version: hatch-vcs / setuptools-scm read the version
|
|
89
|
+
// from a git tag or `SETUPTOOLS_SCM_PRETEND_VERSION`; maturin
|
|
90
|
+
// reads it from `Cargo.toml`'s `[package].version`. In every case
|
|
91
|
+
// pyproject.toml is the wrong file to rewrite; the build job is
|
|
92
|
+
// responsible for setting the version source before `python -m
|
|
93
|
+
// build` / `maturin build` runs. Per design-commitment #1 (no
|
|
94
|
+
// version computation), we surface guidance and exit.
|
|
96
95
|
const who = pkg.name ? `pypi: ${pkg.name}` : 'pypi';
|
|
97
96
|
const envSuffix = pkg.name ? scmEnvSuffix(pkg.name) : '<PKG>';
|
|
98
97
|
ctx.log.info([
|
|
99
|
-
`${who}: detected dynamic version;
|
|
98
|
+
`${who}: detected dynamic version; nothing to rewrite in pyproject.toml.`,
|
|
100
99
|
` Planned version: ${version}. Pass it to the build backend via one of:`,
|
|
101
100
|
` - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${envSuffix}=${version} (hatch-vcs / setuptools-scm)`,
|
|
102
101
|
` - Update [package].version in Cargo.toml ${' '.repeat(Math.max(0, envSuffix.length - 12))} (maturin reading Cargo)`,
|
|
103
102
|
` Set the env var on the build job, before \`python -m build\` / \`maturin build\` runs.`,
|
|
104
|
-
` See
|
|
103
|
+
` See ${DYNAMIC_VERSION_DOC_POINTER}`,
|
|
105
104
|
].join('\n'));
|
|
106
105
|
return Promise.resolve([]);
|
|
107
106
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
// Static literal — not allowed. Preflight should have rejected this
|
|
108
|
+
// already (`requirePypiVersionSource` runs before any writeVersion
|
|
109
|
+
// call on the publish path), but the CLI `write-version` subcommand
|
|
110
|
+
// can be invoked directly; guard here so the failure mode is the
|
|
111
|
+
// same actionable error rather than a silent rewrite. See #333.
|
|
112
|
+
if (typeof project.version === 'string') {
|
|
113
|
+
return Promise.reject(new Error(`[${ErrorCodes.PYPI_STATIC_VERSION}] pyproject.toml at ${pyProjectPath} declares a static \`[project].version\` literal. Use \`[project].dynamic = ["version"]\` with hatch-vcs (recommended), setuptools-scm, or the maturin Cargo.toml-driven path — putitoutthere does not edit pyproject.toml at release time. See ${DYNAMIC_VERSION_DOC_POINTER}.`));
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
return Promise.reject(err instanceof Error ? err : new Error(String(err)));
|
|
114
|
-
}
|
|
115
|
-
if (updated === original)
|
|
116
|
-
return Promise.resolve([]);
|
|
117
|
-
writeFileSync(pyProjectPath, updated, 'utf8');
|
|
118
|
-
return Promise.resolve([pyProjectPath]);
|
|
115
|
+
return Promise.reject(new Error(`pyproject.toml at ${pyProjectPath}: [project] table declares no version source -- add \`dynamic = ["version"]\`. See ${DYNAMIC_VERSION_DOC_POINTER}.`));
|
|
119
116
|
}
|
|
120
117
|
async function publishImpl(pkg, version, ctx) {
|
|
121
118
|
if (await isPublishedImpl(pkg, version, ctx)) {
|
|
@@ -143,31 +140,12 @@ async function publishImpl(pkg, version, ctx) {
|
|
|
143
140
|
function pypiNameFor(pkg) {
|
|
144
141
|
return pkg.pypi ?? pkg.name;
|
|
145
142
|
}
|
|
146
|
-
/**
|
|
147
|
-
* Rewrites the first `version = "x.y.z"` inside the `[project]` table.
|
|
148
|
-
*
|
|
149
|
-
* Precondition: the caller has already confirmed a `[project]` table exists
|
|
150
|
-
* and does not declare `dynamic = ["version"]`. Throws when no literal
|
|
151
|
-
* `version = "..."` line can be located inside `[project]`.
|
|
152
|
-
*/
|
|
153
|
-
export function replacePyProjectVersion(source, version) {
|
|
154
|
-
const re = /(\[project\][\s\S]*?)(^\s*version\s*=\s*")([^"]*)(")/m;
|
|
155
|
-
const m = re.exec(source);
|
|
156
|
-
if (!m) {
|
|
157
|
-
throw new Error('pyproject.toml: [project] is present but declares neither a static version nor dynamic = ["version"]');
|
|
158
|
-
}
|
|
159
|
-
const [, pre, prefix, old, suffix] = m;
|
|
160
|
-
if (old === version)
|
|
161
|
-
return source;
|
|
162
|
-
const start = m.index + pre.length;
|
|
163
|
-
const end = start + prefix.length + old.length + suffix.length;
|
|
164
|
-
return source.slice(0, start) + prefix + version + suffix + source.slice(end);
|
|
165
|
-
}
|
|
166
143
|
/**
|
|
167
144
|
* Returns true when a parsed `[project].dynamic` is an array containing
|
|
168
|
-
* `"version"`.
|
|
169
|
-
*
|
|
170
|
-
*
|
|
145
|
+
* `"version"`. The only accepted version-source shape after #333: the
|
|
146
|
+
* build backend derives the version (hatch-vcs / setuptools-scm read a
|
|
147
|
+
* git tag or `SETUPTOOLS_SCM_PRETEND_VERSION`; maturin reads
|
|
148
|
+
* `Cargo.toml`'s `[package].version`).
|
|
171
149
|
*/
|
|
172
150
|
function projectDynamicIncludesVersion(project) {
|
|
173
151
|
const { dynamic } = project;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pypi.js","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"pypi.js","sourceRoot":"","sources":["../../src/handlers/pypi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC,MAAM,2BAA2B,GAC/B,sEAAsE,CAAC;AAEzE,KAAK,UAAU,eAAe,CAC5B,GAAoC,EACpC,OAAe,EACf,IAAS;IAET,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,GAAG,QAAQ,SAAS,kBAAkB,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;IAC/F,M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GAMG;AACH,SAAS,6BAA6B,CAAC,OAA8B;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,gBAAgB;IAC9B,OAAO,EAAE,WAAW;CACrB,CAAC"}
|
package/dist/preflight.d.ts
CHANGED
|
@@ -95,6 +95,44 @@ export interface CratesMetadataFinding {
|
|
|
95
95
|
* modes; this check is scoped to the metadata fields alone.
|
|
96
96
|
*/
|
|
97
97
|
export declare function checkCratesMetadata(packages: readonly Package[]): CratesMetadataFinding[];
|
|
98
|
+
export interface PypiVersionFinding {
|
|
99
|
+
package: string;
|
|
100
|
+
/** Pkg-relative `pyproject.toml` path examined. */
|
|
101
|
+
pyprojectPath: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Scan every pypi package's `pyproject.toml` for a static
|
|
105
|
+
* `[project].version = "..."` literal. Returns the list of findings;
|
|
106
|
+
* an empty list means every pypi package declares
|
|
107
|
+
* `[project].dynamic = ["version"]` (or has no `[project]` table at
|
|
108
|
+
* all — that case is reported by a different check).
|
|
109
|
+
*
|
|
110
|
+
* Why: a static literal silently ships the previous release. The build
|
|
111
|
+
* backend reads pyproject.toml at build time and putitoutthere does not
|
|
112
|
+
* rewrite the literal (per design-commitment #1, no version
|
|
113
|
+
* computation). hatch-vcs / setuptools-scm derive the version from a
|
|
114
|
+
* git tag or `SETUPTOOLS_SCM_PRETEND_VERSION`; for maturin, the
|
|
115
|
+
* version flows from `Cargo.toml`'s `[package].version`. All three
|
|
116
|
+
* accept `dynamic = ["version"]`.
|
|
117
|
+
*
|
|
118
|
+
* Non-pypi packages, a missing `pyproject.toml`, malformed TOML, and a
|
|
119
|
+
* `pyproject.toml` with no `[project]` table are skipped — other parts
|
|
120
|
+
* of the pipeline (`checkPyprojectAndBundleCli`, the handler's own
|
|
121
|
+
* read) already surface those failure modes.
|
|
122
|
+
*/
|
|
123
|
+
export declare function checkPypiVersionSource(packages: readonly Package[]): PypiVersionFinding[];
|
|
124
|
+
/**
|
|
125
|
+
* Throw with an actionable error when any pypi package's pyproject.toml
|
|
126
|
+
* declares a static `[project].version` literal. Reports every failing
|
|
127
|
+
* package in one error rather than failing on the first, so consumers
|
|
128
|
+
* fix them all in one round-trip.
|
|
129
|
+
*
|
|
130
|
+
* The fix shape is the same across hatch-vcs, setuptools-scm, and
|
|
131
|
+
* maturin: declare `dynamic = ["version"]` and let the build backend
|
|
132
|
+
* derive the version from a tagged source (git tag,
|
|
133
|
+
* `SETUPTOOLS_SCM_PRETEND_VERSION`, or sibling `Cargo.toml`).
|
|
134
|
+
*/
|
|
135
|
+
export declare function requirePypiVersionSource(packages: readonly Package[]): void;
|
|
98
136
|
/**
|
|
99
137
|
* Throw with an actionable error when any crates package's Cargo.toml
|
|
100
138
|
* lacks a required `[package]` metadata field. Reports every failing
|
package/dist/preflight.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAqBvC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,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;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,qBAAqB,EAAE,CA8CzB;AAcD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,kBAAkB,EAAE,CA2BtB;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAmC3E;AA0ED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CA6BxE"}
|
package/dist/preflight.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Issue #14, #280.
|
|
22
22
|
*/
|
|
23
23
|
import { readFileSync } from 'node:fs';
|
|
24
|
-
import { join } from 'node:path';
|
|
24
|
+
import { dirname, join, parse as parsePath } from 'node:path';
|
|
25
25
|
import { parse as parseToml } from 'smol-toml';
|
|
26
26
|
import { ErrorCodes } from './error-codes.js';
|
|
27
27
|
// Per-kind accepted env var names, primary first. `checkAuth` scans left
|
|
@@ -209,11 +209,19 @@ export function checkCratesMetadata(packages) {
|
|
|
209
209
|
continue;
|
|
210
210
|
}
|
|
211
211
|
const pkgTable = (parsed.package ?? {});
|
|
212
|
+
// `[workspace.package]` inheritance (#328): cargo resolves
|
|
213
|
+
// `license.workspace = true` against the workspace root before
|
|
214
|
+
// upload, so the literal value lands on crates.io. The check has
|
|
215
|
+
// to do the same — otherwise crates following Cargo's recommended
|
|
216
|
+
// centralized-metadata pattern false-positive.
|
|
217
|
+
const wsPkgTable = readWorkspacePackageTable(p.path);
|
|
218
|
+
const description = resolveInherited(pkgTable.description, wsPkgTable, 'description');
|
|
219
|
+
const license = resolveInherited(pkgTable.license, wsPkgTable, 'license');
|
|
220
|
+
const licenseFile = resolveInherited(pkgTable['license-file'], wsPkgTable, 'license-file');
|
|
212
221
|
const missing = [];
|
|
213
|
-
if (!nonEmptyString(
|
|
222
|
+
if (!nonEmptyString(description))
|
|
214
223
|
missing.push('description');
|
|
215
|
-
if (!nonEmptyString(
|
|
216
|
-
!nonEmptyString(pkgTable['license-file'])) {
|
|
224
|
+
if (!nonEmptyString(license) && !nonEmptyString(licenseFile)) {
|
|
217
225
|
missing.push('license');
|
|
218
226
|
}
|
|
219
227
|
if (missing.length > 0) {
|
|
@@ -225,6 +233,159 @@ export function checkCratesMetadata(packages) {
|
|
|
225
233
|
function nonEmptyString(v) {
|
|
226
234
|
return typeof v === 'string' && v.trim().length > 0;
|
|
227
235
|
}
|
|
236
|
+
/* ----------------------- pypi dynamic version ----------------------- */
|
|
237
|
+
// User-facing recipe for hatch-vcs adoption. Embedded verbatim in the
|
|
238
|
+
// thrown error so users have a copy/paste fix instead of a doc-search
|
|
239
|
+
// target.
|
|
240
|
+
const PYPI_VERSION_DOC_POINTER = 'https://thekevinscott.github.io/putitoutthere/guide/dynamic-versions';
|
|
241
|
+
/**
|
|
242
|
+
* Scan every pypi package's `pyproject.toml` for a static
|
|
243
|
+
* `[project].version = "..."` literal. Returns the list of findings;
|
|
244
|
+
* an empty list means every pypi package declares
|
|
245
|
+
* `[project].dynamic = ["version"]` (or has no `[project]` table at
|
|
246
|
+
* all — that case is reported by a different check).
|
|
247
|
+
*
|
|
248
|
+
* Why: a static literal silently ships the previous release. The build
|
|
249
|
+
* backend reads pyproject.toml at build time and putitoutthere does not
|
|
250
|
+
* rewrite the literal (per design-commitment #1, no version
|
|
251
|
+
* computation). hatch-vcs / setuptools-scm derive the version from a
|
|
252
|
+
* git tag or `SETUPTOOLS_SCM_PRETEND_VERSION`; for maturin, the
|
|
253
|
+
* version flows from `Cargo.toml`'s `[package].version`. All three
|
|
254
|
+
* accept `dynamic = ["version"]`.
|
|
255
|
+
*
|
|
256
|
+
* Non-pypi packages, a missing `pyproject.toml`, malformed TOML, and a
|
|
257
|
+
* `pyproject.toml` with no `[project]` table are skipped — other parts
|
|
258
|
+
* of the pipeline (`checkPyprojectAndBundleCli`, the handler's own
|
|
259
|
+
* read) already surface those failure modes.
|
|
260
|
+
*/
|
|
261
|
+
export function checkPypiVersionSource(packages) {
|
|
262
|
+
const findings = [];
|
|
263
|
+
for (const p of packages) {
|
|
264
|
+
if (p.kind !== 'pypi')
|
|
265
|
+
continue;
|
|
266
|
+
const pyprojectPath = join(p.path, 'pyproject.toml');
|
|
267
|
+
let raw;
|
|
268
|
+
try {
|
|
269
|
+
raw = readFileSync(pyprojectPath, 'utf8');
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
let parsed;
|
|
275
|
+
try {
|
|
276
|
+
parsed = parseToml(raw);
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
const project = parsed.project;
|
|
282
|
+
if (project === undefined)
|
|
283
|
+
continue;
|
|
284
|
+
if (declaresDynamicVersion(project))
|
|
285
|
+
continue;
|
|
286
|
+
if (typeof project.version === 'string') {
|
|
287
|
+
findings.push({ package: p.name, pyprojectPath });
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return findings;
|
|
291
|
+
}
|
|
292
|
+
function declaresDynamicVersion(project) {
|
|
293
|
+
const { dynamic } = project;
|
|
294
|
+
return Array.isArray(dynamic) && dynamic.includes('version');
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Throw with an actionable error when any pypi package's pyproject.toml
|
|
298
|
+
* declares a static `[project].version` literal. Reports every failing
|
|
299
|
+
* package in one error rather than failing on the first, so consumers
|
|
300
|
+
* fix them all in one round-trip.
|
|
301
|
+
*
|
|
302
|
+
* The fix shape is the same across hatch-vcs, setuptools-scm, and
|
|
303
|
+
* maturin: declare `dynamic = ["version"]` and let the build backend
|
|
304
|
+
* derive the version from a tagged source (git tag,
|
|
305
|
+
* `SETUPTOOLS_SCM_PRETEND_VERSION`, or sibling `Cargo.toml`).
|
|
306
|
+
*/
|
|
307
|
+
export function requirePypiVersionSource(packages) {
|
|
308
|
+
const findings = checkPypiVersionSource(packages);
|
|
309
|
+
if (findings.length === 0)
|
|
310
|
+
return;
|
|
311
|
+
const lines = [
|
|
312
|
+
`[${ErrorCodes.PYPI_STATIC_VERSION}] pyproject.toml must declare \`[project].dynamic = ["version"]\` instead of a static \`[project].version = "..."\` literal.`,
|
|
313
|
+
'',
|
|
314
|
+
'Failing packages:',
|
|
315
|
+
];
|
|
316
|
+
for (const f of findings) {
|
|
317
|
+
lines.push(` - ${f.package}: ${f.pyprojectPath}`);
|
|
318
|
+
}
|
|
319
|
+
lines.push('', 'Why: putitoutthere does not edit pyproject.toml at release time (per the', '"no version computation" design commitment). A static literal silently', 'ships the previous release\'s wheel/sdist, because the build backend reads', 'whatever is on disk.', '', 'Recommended fix (hatch-vcs):', '', ' [build-system]', ' requires = ["hatchling", "hatch-vcs"]', ' build-backend = "hatchling.build"', '', ' [project]', ' name = "<your-package>"', ' dynamic = ["version"]', '', ' [tool.hatch.version]', ' source = "vcs"', '', 'setuptools-scm and the maturin (Cargo.toml-driven) path are equally', `valid — see ${PYPI_VERSION_DOC_POINTER}.`);
|
|
320
|
+
throw new Error(lines.join('\n'));
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Return the inherited workspace value when the field is declared as
|
|
324
|
+
* `<field>.workspace = true`; otherwise pass the raw value through.
|
|
325
|
+
* `wsPkgTable` is `undefined` when no parent `Cargo.toml` declares a
|
|
326
|
+
* `[workspace.package]` block — inheritance simply yields `undefined`
|
|
327
|
+
* there, which `nonEmptyString` correctly treats as missing.
|
|
328
|
+
*/
|
|
329
|
+
function resolveInherited(value, wsPkgTable, key) {
|
|
330
|
+
if (value !== null &&
|
|
331
|
+
typeof value === 'object' &&
|
|
332
|
+
value.workspace === true) {
|
|
333
|
+
return wsPkgTable?.[key];
|
|
334
|
+
}
|
|
335
|
+
return value;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Find the nearest parent `Cargo.toml` whose `[workspace]` table makes
|
|
339
|
+
* it a workspace root and return its `[workspace.package]` table (if
|
|
340
|
+
* any). Walks up from `crateDir` to the filesystem root. Returns
|
|
341
|
+
* `undefined` when no workspace root is found or when the workspace
|
|
342
|
+
* defines no shared `[workspace.package]` metadata.
|
|
343
|
+
*/
|
|
344
|
+
function readWorkspacePackageTable(crateDir) {
|
|
345
|
+
const rootMarker = parsePath(crateDir).root;
|
|
346
|
+
let dir = dirname(crateDir);
|
|
347
|
+
while (dir && dir !== rootMarker) {
|
|
348
|
+
const manifest = join(dir, 'Cargo.toml');
|
|
349
|
+
let raw;
|
|
350
|
+
try {
|
|
351
|
+
raw = readFileSync(manifest, 'utf8');
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
const parent = dirname(dir);
|
|
355
|
+
if (parent === dir)
|
|
356
|
+
break;
|
|
357
|
+
dir = parent;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
let parsed;
|
|
361
|
+
try {
|
|
362
|
+
parsed = parseToml(raw);
|
|
363
|
+
}
|
|
364
|
+
catch {
|
|
365
|
+
// Cargo will surface the parser error; just skip this manifest
|
|
366
|
+
// for workspace lookup so we don't crash on a malformed parent.
|
|
367
|
+
const parent = dirname(dir);
|
|
368
|
+
if (parent === dir)
|
|
369
|
+
break;
|
|
370
|
+
dir = parent;
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (parsed.workspace !== undefined) {
|
|
374
|
+
const ws = parsed.workspace;
|
|
375
|
+
const wsPkg = ws.package;
|
|
376
|
+
if (wsPkg !== undefined && typeof wsPkg === 'object') {
|
|
377
|
+
return wsPkg;
|
|
378
|
+
}
|
|
379
|
+
// Workspace root found, but no shared metadata — stop walking.
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
const parent = dirname(dir);
|
|
383
|
+
if (parent === dir)
|
|
384
|
+
break;
|
|
385
|
+
dir = parent;
|
|
386
|
+
}
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
228
389
|
/**
|
|
229
390
|
* Throw with an actionable error when any crates package's Cargo.toml
|
|
230
391
|
* lacks a required `[package]` metadata field. Reports every failing
|
package/dist/preflight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,yEAAyE;AACzE,uEAAuE;AACvE,6DAA6D;AAC7D,oEAAoE;AACpE,kEAAkE;AAClE,yDAAyD;AACzD,uEAAuE;AACvE,uCAAuC;AACvC,MAAM,SAAS,GAAoC;IACjD,MAAM,EAAE,CAAC,sBAAsB,CAAC;IAChC,IAAI,EAAE,CAAC,gBAAgB,CAAC;IACxB,GAAG,EAAE,CAAC,iBAAiB,EAAE,WAAW,CAAC;CACtC,CAAC;AAEF,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AAClD,uEAAuE;AACvE,UAAU;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;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoBH,OAAO,EAA6B,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA2J1E"}
|
package/dist/publish.js
CHANGED
|
@@ -25,7 +25,7 @@ import { handlerFor as defaultHandlerFor } from './handlers/index.js';
|
|
|
25
25
|
import { createLogger } from './log.js';
|
|
26
26
|
import { plan } from './plan.js';
|
|
27
27
|
import { formatTag } from './tag-template.js';
|
|
28
|
-
import { requireAuth, requireCratesMetadata, requireProvenanceMetadata } from './preflight.js';
|
|
28
|
+
import { requireAuth, requireCratesMetadata, requirePypiVersionSource, requireProvenanceMetadata, } from './preflight.js';
|
|
29
29
|
import { withRetry } from './retry.js';
|
|
30
30
|
import { readHandlerMeta } from './types.js';
|
|
31
31
|
import { dumpFailure } from './verbose.js';
|
|
@@ -78,6 +78,12 @@ export async function publish(opts) {
|
|
|
78
78
|
// verification build has compiled the crate and every transitive
|
|
79
79
|
// dep — same wasted-work argument as 2b. #290.
|
|
80
80
|
requireCratesMetadata(selectedPackages);
|
|
81
|
+
// 2d. Pre-flight pypi version source: every selected pypi package's
|
|
82
|
+
// pyproject.toml must declare `[project].dynamic = ["version"]`
|
|
83
|
+
// instead of a static literal. The engine does not rewrite the
|
|
84
|
+
// literal at release time (design-commitment #1), so a literal
|
|
85
|
+
// would silently ship the previous release's wheel/sdist.
|
|
86
|
+
requirePypiVersionSource(selectedPackages);
|
|
81
87
|
// 3. Artifact completeness.
|
|
82
88
|
// First normalize the layout in case actions/download-artifact@v8
|
|
83
89
|
// dumped a single artifact directly into `artifacts/` rather than
|
package/dist/publish.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD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|
13
|
-
* versioned.
|
|
4
|
+
* Maturin reads `[package].version` from a sibling `Cargo.toml` (when
|
|
5
|
+
* pyproject declares `dynamic = ["version"]`) at build time. There is
|
|
6
|
+
* no env override the build job can inject —
|
|
7
|
+
* `SETUPTOOLS_SCM_PRETEND_VERSION` is honored by hatch-vcs /
|
|
8
|
+
* setuptools-scm but not by maturin. So Cargo.toml has to be
|
|
9
|
+
* rewritten before `maturin build` runs. crates and npm bump at
|
|
10
|
+
* publish (cargo / npm read the manifest at upload time, not before);
|
|
11
|
+
* maturin is the one path where the artifact (the wheel) leaves the
|
|
12
|
+
* build runner already versioned.
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Static `[project].version` literals are rejected at preflight time
|
|
15
|
+
* (`requirePypiVersionSource`); this function refuses the same shape
|
|
16
|
+
* for the same reason, so a CLI-direct invocation surfaces the same
|
|
17
|
+
* actionable error rather than building an under-versioned artifact.
|
|
19
18
|
*/
|
|
20
19
|
/**
|
|
21
|
-
* Rewrite the version source
|
|
22
|
-
*
|
|
20
|
+
* Rewrite the version source for a maturin package and return the list
|
|
21
|
+
* of absolute paths that were modified.
|
|
23
22
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* pyproject literal AND a Cargo `[package].version` literal will
|
|
30
|
-
* have the two manifests disagree post-bump if only pyproject is
|
|
31
|
-
* rewritten, and maturin's mismatch-resolution behavior varies
|
|
32
|
-
* by platform / version (PR #277 hit this on Windows: wheels
|
|
33
|
-
* shipped at the stale Cargo literal even though pyproject was
|
|
34
|
-
* bumped). Bumping both keeps the contract straightforward.
|
|
35
|
-
* - `[project].dynamic = ["version", ...]` → rewrite the sibling
|
|
36
|
-
* `Cargo.toml`'s `[package].version`. Errors if Cargo.toml is
|
|
37
|
-
* missing.
|
|
38
|
-
*
|
|
39
|
-
* Throws on missing pyproject.toml, malformed TOML, or a `[project]`
|
|
40
|
-
* table that declares neither a literal nor `dynamic = ["version"]`.
|
|
23
|
+
* Contract: pyproject must declare `[project].dynamic = ["version"]`.
|
|
24
|
+
* The bump targets the sibling `Cargo.toml`'s `[package].version`.
|
|
25
|
+
* Errors if Cargo.toml is missing, pyproject is missing, pyproject is
|
|
26
|
+
* malformed, the `[project]` table is absent, or pyproject carries a
|
|
27
|
+
* static `[project].version` literal (#333).
|
|
41
28
|
*
|
|
42
29
|
* I/O uses `readFileSync` with `try` / `catch (ENOENT)` instead of an
|
|
43
30
|
* `existsSync` precheck — the precheck is a TOCTOU race CodeQL flags
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-version.d.ts","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"write-version.d.ts","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAaH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAuD9E"}
|
package/dist/write-version.js
CHANGED
|
@@ -1,48 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pre-build version bump used by `_matrix.yml`'s maturin steps. #276.
|
|
3
3
|
*
|
|
4
|
-
* Maturin reads `[
|
|
5
|
-
* `[
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* versioned.
|
|
4
|
+
* Maturin reads `[package].version` from a sibling `Cargo.toml` (when
|
|
5
|
+
* pyproject declares `dynamic = ["version"]`) at build time. There is
|
|
6
|
+
* no env override the build job can inject —
|
|
7
|
+
* `SETUPTOOLS_SCM_PRETEND_VERSION` is honored by hatch-vcs /
|
|
8
|
+
* setuptools-scm but not by maturin. So Cargo.toml has to be
|
|
9
|
+
* rewritten before `maturin build` runs. crates and npm bump at
|
|
10
|
+
* publish (cargo / npm read the manifest at upload time, not before);
|
|
11
|
+
* maturin is the one path where the artifact (the wheel) leaves the
|
|
12
|
+
* build runner already versioned.
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Static `[project].version` literals are rejected at preflight time
|
|
15
|
+
* (`requirePypiVersionSource`); this function refuses the same shape
|
|
16
|
+
* for the same reason, so a CLI-direct invocation surfaces the same
|
|
17
|
+
* actionable error rather than building an under-versioned artifact.
|
|
19
18
|
*/
|
|
20
19
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
21
20
|
import { join } from 'node:path';
|
|
22
21
|
import { parse as parseToml } from 'smol-toml';
|
|
22
|
+
import { ErrorCodes } from './error-codes.js';
|
|
23
23
|
import { replaceCargoVersion } from './handlers/crates.js';
|
|
24
|
-
|
|
24
|
+
const DYNAMIC_VERSION_DOC_POINTER = 'https://thekevinscott.github.io/putitoutthere/guide/dynamic-versions';
|
|
25
25
|
/**
|
|
26
|
-
* Rewrite the version source
|
|
27
|
-
*
|
|
26
|
+
* Rewrite the version source for a maturin package and return the list
|
|
27
|
+
* of absolute paths that were modified.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* pyproject literal AND a Cargo `[package].version` literal will
|
|
35
|
-
* have the two manifests disagree post-bump if only pyproject is
|
|
36
|
-
* rewritten, and maturin's mismatch-resolution behavior varies
|
|
37
|
-
* by platform / version (PR #277 hit this on Windows: wheels
|
|
38
|
-
* shipped at the stale Cargo literal even though pyproject was
|
|
39
|
-
* bumped). Bumping both keeps the contract straightforward.
|
|
40
|
-
* - `[project].dynamic = ["version", ...]` → rewrite the sibling
|
|
41
|
-
* `Cargo.toml`'s `[package].version`. Errors if Cargo.toml is
|
|
42
|
-
* missing.
|
|
43
|
-
*
|
|
44
|
-
* Throws on missing pyproject.toml, malformed TOML, or a `[project]`
|
|
45
|
-
* table that declares neither a literal nor `dynamic = ["version"]`.
|
|
29
|
+
* Contract: pyproject must declare `[project].dynamic = ["version"]`.
|
|
30
|
+
* The bump targets the sibling `Cargo.toml`'s `[package].version`.
|
|
31
|
+
* Errors if Cargo.toml is missing, pyproject is missing, pyproject is
|
|
32
|
+
* malformed, the `[project]` table is absent, or pyproject carries a
|
|
33
|
+
* static `[project].version` literal (#333).
|
|
46
34
|
*
|
|
47
35
|
* I/O uses `readFileSync` with `try` / `catch (ENOENT)` instead of an
|
|
48
36
|
* `existsSync` precheck — the precheck is a TOCTOU race CodeQL flags
|
|
@@ -74,58 +62,30 @@ export function writeVersionForBuild(pkgDir, version) {
|
|
|
74
62
|
}
|
|
75
63
|
const project = parsed?.project;
|
|
76
64
|
if (!project) {
|
|
77
|
-
throw new Error(`write-version: ${pyProjectPath} has no [project] table -- declare [project].
|
|
65
|
+
throw new Error(`write-version: ${pyProjectPath} has no [project] table -- declare [project].dynamic = ["version"]. See ${DYNAMIC_VERSION_DOC_POINTER}.`);
|
|
78
66
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
cargoOriginal = readFileSync(cargoPath, 'utf8');
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
if (err.code === 'ENOENT') {
|
|
87
|
-
throw new Error(`write-version: pyproject.toml declares dynamic = ["version"] but Cargo.toml is missing at ${cargoPath}. Maturin's dynamic-version mode reads [package].version from Cargo.toml; without it there's nothing to bump.`, { cause: err });
|
|
88
|
-
}
|
|
89
|
-
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
90
|
-
throw err;
|
|
67
|
+
if (!isDynamicVersion(project)) {
|
|
68
|
+
if (typeof project.version === 'string') {
|
|
69
|
+
throw new Error(`[${ErrorCodes.PYPI_STATIC_VERSION}] write-version: ${pyProjectPath} declares a static \`[project].version\` literal. Use \`[project].dynamic = ["version"]\` with hatch-vcs (recommended), setuptools-scm, or the maturin Cargo.toml-driven path — putitoutthere does not edit pyproject.toml at release time. See ${DYNAMIC_VERSION_DOC_POINTER}.`);
|
|
91
70
|
}
|
|
92
|
-
|
|
93
|
-
if (cargoUpdated !== cargoOriginal)
|
|
94
|
-
writeFileSync(cargoPath, cargoUpdated, 'utf8');
|
|
95
|
-
return [cargoPath];
|
|
71
|
+
throw new Error(`write-version: ${pyProjectPath}: [project] table declares no version source -- add \`dynamic = ["version"]\`. See ${DYNAMIC_VERSION_DOC_POINTER}.`);
|
|
96
72
|
}
|
|
97
|
-
const
|
|
98
|
-
const pyUpdated = replacePyProjectVersion(pyOriginal, version);
|
|
99
|
-
if (pyUpdated !== pyOriginal)
|
|
100
|
-
writeFileSync(pyProjectPath, pyUpdated, 'utf8');
|
|
101
|
-
written.push(pyProjectPath);
|
|
102
|
-
// Bump a sibling Cargo.toml's [package].version too, when present.
|
|
103
|
-
// Pure-python pyproject (no Rust crate) → no Cargo.toml → skip.
|
|
104
|
-
// Cargo.toml without [package].version (workspace root) → skip
|
|
105
|
-
// (replaceCargoVersion throws on missing field; catch and continue).
|
|
73
|
+
const cargoPath = join(pkgDir, 'Cargo.toml');
|
|
106
74
|
let cargoOriginal;
|
|
107
75
|
try {
|
|
108
76
|
cargoOriginal = readFileSync(cargoPath, 'utf8');
|
|
109
77
|
}
|
|
110
78
|
catch (err) {
|
|
111
|
-
if (err.code === 'ENOENT')
|
|
112
|
-
|
|
79
|
+
if (err.code === 'ENOENT') {
|
|
80
|
+
throw new Error(`write-version: pyproject.toml declares dynamic = ["version"] but Cargo.toml is missing at ${cargoPath}. Maturin's dynamic-version mode reads [package].version from Cargo.toml; without it there's nothing to bump.`, { cause: err });
|
|
81
|
+
}
|
|
113
82
|
/* v8 ignore next -- non-ENOENT read errors surface as-is */
|
|
114
83
|
throw err;
|
|
115
84
|
}
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
cargoUpdated = replaceCargoVersion(cargoOriginal, version);
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
// No [package].version in Cargo.toml — nothing to bump on the
|
|
122
|
-
// Cargo side. The pyproject bump above is the source of truth.
|
|
123
|
-
return written;
|
|
124
|
-
}
|
|
85
|
+
const cargoUpdated = replaceCargoVersion(cargoOriginal, version);
|
|
125
86
|
if (cargoUpdated !== cargoOriginal)
|
|
126
87
|
writeFileSync(cargoPath, cargoUpdated, 'utf8');
|
|
127
|
-
|
|
128
|
-
return written;
|
|
88
|
+
return [cargoPath];
|
|
129
89
|
}
|
|
130
90
|
function isDynamicVersion(project) {
|
|
131
91
|
const { dynamic } = project;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-version.js","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"write-version.js","sourceRoot":"","sources":["../src/write-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,2BAA2B,GAC/B,sEAAsE,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,OAAe;IAClE,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACrD,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IA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