spec-spine 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.
- spec_spine-0.1.0/LICENSE +202 -0
- spec_spine-0.1.0/PKG-INFO +66 -0
- spec_spine-0.1.0/README.md +47 -0
- spec_spine-0.1.0/pyproject.toml +56 -0
- spec_spine-0.1.0/setup.cfg +4 -0
- spec_spine-0.1.0/src/spec_spine/__init__.py +19 -0
- spec_spine-0.1.0/src/spec_spine/_refuse.py +28 -0
- spec_spine-0.1.0/src/spec_spine/platform_map.py +148 -0
- spec_spine-0.1.0/src/spec_spine.egg-info/PKG-INFO +66 -0
- spec_spine-0.1.0/src/spec_spine.egg-info/SOURCES.txt +12 -0
- spec_spine-0.1.0/src/spec_spine.egg-info/dependency_links.txt +1 -0
- spec_spine-0.1.0/src/spec_spine.egg-info/entry_points.txt +2 -0
- spec_spine-0.1.0/src/spec_spine.egg-info/top_level.txt +1 -0
- spec_spine-0.1.0/test/test_platform_map.py +70 -0
spec_spine-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 The spec-spine Authors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spec-spine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The spec-spine CLI: compile a markdown spec corpus into a deterministic authority ledger and refuse code that drifts from its owning spec. Ships the prebuilt binary; no Rust toolchain required.
|
|
5
|
+
Author: The spec-spine Authors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/bartekus/spec-spine
|
|
8
|
+
Project-URL: Repository, https://github.com/bartekus/spec-spine
|
|
9
|
+
Project-URL: Issues, https://github.com/bartekus/spec-spine/issues
|
|
10
|
+
Keywords: spec,specification,authority,governance,coupling,cli,rust,deterministic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# spec-spine (Python / uvx)
|
|
21
|
+
|
|
22
|
+
The `spec-spine` CLI for Python users: compile a markdown spec corpus into a
|
|
23
|
+
deterministic authority ledger and refuse code that drifts from its owning spec.
|
|
24
|
+
Ships the prebuilt binary; **no Rust toolchain required**.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
uvx spec-spine check # run the CLI with no install
|
|
28
|
+
uv tool install spec-spine # or install it as a persistent tool
|
|
29
|
+
pip install spec-spine # or into a project/venv
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
|
|
34
|
+
This is a **binary distribution**, not a Python binding. There is no native
|
|
35
|
+
extension and the engine is never called from Python. The project publishes:
|
|
36
|
+
|
|
37
|
+
- **five platform wheels** — one per supported target, each carrying the prebuilt
|
|
38
|
+
`spec-spine` binary in the wheel's scripts directory. pip/uv select the one
|
|
39
|
+
matching your host by its platform tag and install the binary onto `PATH`. On a
|
|
40
|
+
supported host there is **no Python in the run path and no network at install**
|
|
41
|
+
beyond fetching the wheel itself; it works offline from a warm cache or a
|
|
42
|
+
private mirror, and under `--no-binary`-free resolution.
|
|
43
|
+
- **one sdist** — the unsupported-host fallback. It builds only when no wheel
|
|
44
|
+
matches (musl/Alpine, win-arm64, 32-bit), and its `spec-spine` command prints a
|
|
45
|
+
clear message pointing at `cargo install spec-spine-cli`.
|
|
46
|
+
|
|
47
|
+
This mirrors the npm shim (spec 007): npm uses `os`/`cpu`-gated
|
|
48
|
+
`optionalDependencies`; Python uses wheel platform tags. One project, many
|
|
49
|
+
wheels.
|
|
50
|
+
|
|
51
|
+
## Supported targets
|
|
52
|
+
|
|
53
|
+
| host | wheel platform tag | release triple |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| macOS arm64 | `macosx_11_0_arm64` | `aarch64-apple-darwin` |
|
|
56
|
+
| macOS x86_64 | `macosx_10_12_x86_64` | `x86_64-apple-darwin` |
|
|
57
|
+
| Linux x86_64 (glibc) | `manylinux_2_17_x86_64` | `x86_64-unknown-linux-gnu` |
|
|
58
|
+
| Linux arm64 (glibc) | `manylinux_2_17_aarch64` | `aarch64-unknown-linux-gnu` |
|
|
59
|
+
| Windows x86_64 | `win_amd64` | `x86_64-pc-windows-msvc` |
|
|
60
|
+
|
|
61
|
+
Linux binaries are **glibc**. Alpine/musl hosts have no wheel and must use
|
|
62
|
+
`cargo install spec-spine-cli` or a glibc-based image.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# spec-spine (Python / uvx)
|
|
2
|
+
|
|
3
|
+
The `spec-spine` CLI for Python users: compile a markdown spec corpus into a
|
|
4
|
+
deterministic authority ledger and refuse code that drifts from its owning spec.
|
|
5
|
+
Ships the prebuilt binary; **no Rust toolchain required**.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
uvx spec-spine check # run the CLI with no install
|
|
9
|
+
uv tool install spec-spine # or install it as a persistent tool
|
|
10
|
+
pip install spec-spine # or into a project/venv
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## How it works
|
|
14
|
+
|
|
15
|
+
This is a **binary distribution**, not a Python binding. There is no native
|
|
16
|
+
extension and the engine is never called from Python. The project publishes:
|
|
17
|
+
|
|
18
|
+
- **five platform wheels** — one per supported target, each carrying the prebuilt
|
|
19
|
+
`spec-spine` binary in the wheel's scripts directory. pip/uv select the one
|
|
20
|
+
matching your host by its platform tag and install the binary onto `PATH`. On a
|
|
21
|
+
supported host there is **no Python in the run path and no network at install**
|
|
22
|
+
beyond fetching the wheel itself; it works offline from a warm cache or a
|
|
23
|
+
private mirror, and under `--no-binary`-free resolution.
|
|
24
|
+
- **one sdist** — the unsupported-host fallback. It builds only when no wheel
|
|
25
|
+
matches (musl/Alpine, win-arm64, 32-bit), and its `spec-spine` command prints a
|
|
26
|
+
clear message pointing at `cargo install spec-spine-cli`.
|
|
27
|
+
|
|
28
|
+
This mirrors the npm shim (spec 007): npm uses `os`/`cpu`-gated
|
|
29
|
+
`optionalDependencies`; Python uses wheel platform tags. One project, many
|
|
30
|
+
wheels.
|
|
31
|
+
|
|
32
|
+
## Supported targets
|
|
33
|
+
|
|
34
|
+
| host | wheel platform tag | release triple |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| macOS arm64 | `macosx_11_0_arm64` | `aarch64-apple-darwin` |
|
|
37
|
+
| macOS x86_64 | `macosx_10_12_x86_64` | `x86_64-apple-darwin` |
|
|
38
|
+
| Linux x86_64 (glibc) | `manylinux_2_17_x86_64` | `x86_64-unknown-linux-gnu` |
|
|
39
|
+
| Linux arm64 (glibc) | `manylinux_2_17_aarch64` | `aarch64-unknown-linux-gnu` |
|
|
40
|
+
| Windows x86_64 | `win_amd64` | `x86_64-pc-windows-msvc` |
|
|
41
|
+
|
|
42
|
+
Linux binaries are **glibc**. Alpine/musl hosts have no wheel and must use
|
|
43
|
+
`cargo install spec-spine-cli` or a glibc-based image.
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Spec: specs/008-python-distribution/spec.md
|
|
2
|
+
#
|
|
3
|
+
# This pyproject builds ONLY the source distribution (sdist). The five platform
|
|
4
|
+
# wheels are assembled by scripts/generate_wheels.py from the release archives
|
|
5
|
+
# (no build backend, no second Rust build) -- the exact parallel of npm's
|
|
6
|
+
# generate-platform-packages.js. We publish: 5 platform wheels + this sdist.
|
|
7
|
+
# We never publish the pure `py3-none-any` wheel this backend would build; that
|
|
8
|
+
# wheel is built locally, only on a host where no platform wheel matched, where
|
|
9
|
+
# its `spec-spine` entry point is the clear refusal (_refuse.py).
|
|
10
|
+
# setuptools>=77 gives us the standard SPDX `license`/`license-files` fields
|
|
11
|
+
# (PEP 639); with it, a license *classifier* is rejected as redundant.
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["setuptools>=77"]
|
|
14
|
+
build-backend = "setuptools.build_meta"
|
|
15
|
+
|
|
16
|
+
[project]
|
|
17
|
+
name = "spec-spine"
|
|
18
|
+
# Single source of truth at publish time is the git tag; generate_wheels.py and
|
|
19
|
+
# the sdist build are both invoked with --version / SETUPTOOLS_SCM-free explicit
|
|
20
|
+
# version by release.yml, and the lock check fails on a tag/version mismatch
|
|
21
|
+
# (§3.5 parity). 0.1.0 here tracks the workspace version.
|
|
22
|
+
version = "0.1.0"
|
|
23
|
+
description = "The spec-spine CLI: compile a markdown spec corpus into a deterministic authority ledger and refuse code that drifts from its owning spec. Ships the prebuilt binary; no Rust toolchain required."
|
|
24
|
+
readme = "README.md"
|
|
25
|
+
license = "Apache-2.0"
|
|
26
|
+
license-files = ["LICENSE"]
|
|
27
|
+
authors = [{ name = "The spec-spine Authors" }]
|
|
28
|
+
keywords = ["spec", "specification", "authority", "governance", "coupling", "cli", "rust", "deterministic"]
|
|
29
|
+
# Honest floor for the tiny Python that the sdist actually runs. The platform
|
|
30
|
+
# wheels declare a more permissive floor (set in generate_wheels.py) so a Python
|
|
31
|
+
# version mismatch never pushes a supported host onto this sdist.
|
|
32
|
+
requires-python = ">=3.9"
|
|
33
|
+
classifiers = [
|
|
34
|
+
"Development Status :: 4 - Beta",
|
|
35
|
+
"Environment :: Console",
|
|
36
|
+
"Programming Language :: Rust",
|
|
37
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/bartekus/spec-spine"
|
|
42
|
+
Repository = "https://github.com/bartekus/spec-spine"
|
|
43
|
+
Issues = "https://github.com/bartekus/spec-spine/issues"
|
|
44
|
+
|
|
45
|
+
# Same command name on every host. On a supported host the platform wheel's
|
|
46
|
+
# bundled binary provides `spec-spine`; on an unsupported host this sdist
|
|
47
|
+
# provides `spec-spine` -> the refusal. Only one is ever installed per host, so
|
|
48
|
+
# the names never collide.
|
|
49
|
+
[project.scripts]
|
|
50
|
+
spec-spine = "spec_spine._refuse:main"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools]
|
|
53
|
+
package-dir = { "" = "src" }
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""spec-spine — Python/uvx distribution.
|
|
2
|
+
|
|
3
|
+
On a supported host you never import this package: pip/uv select a platform
|
|
4
|
+
wheel whose only payload is the prebuilt `spec-spine` binary in the wheel's
|
|
5
|
+
scripts directory, so `spec-spine`/`uvx spec-spine` runs the native binary with
|
|
6
|
+
no Python in the path. This importable package ships only in the sdist, which is
|
|
7
|
+
built solely on hosts with no matching wheel (musl, win-arm64, 32-bit), where its
|
|
8
|
+
`spec-spine` entry point prints a clear refusal (see _refuse.py). Spec:
|
|
9
|
+
specs/008-python-distribution/spec.md.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
try: # populated from installed dist metadata; no hardcoded second source of truth
|
|
15
|
+
from importlib.metadata import version as _version
|
|
16
|
+
|
|
17
|
+
__version__ = _version("spec-spine")
|
|
18
|
+
except Exception: # pragma: no cover - not installed as a dist
|
|
19
|
+
__version__ = "0+unknown"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Spec: specs/008-python-distribution/spec.md §3.4 (unsupported hosts fail clearly).
|
|
2
|
+
|
|
3
|
+
The `spec-spine` console entry point shipped by the sdist. It is reached only on
|
|
4
|
+
a host with no prebuilt wheel (musl/Alpine, win-arm64, 32-bit, ...), because on a
|
|
5
|
+
supported host the platform wheel's bundled binary IS the `spec-spine` command
|
|
6
|
+
and this module is never installed. Its whole job is to name the host, explain
|
|
7
|
+
why there is no binary, and point at the source-build escape hatch -- the exact
|
|
8
|
+
posture of npm/lib/platform.js's unsupported-host message. It never tries to run
|
|
9
|
+
anything; it exits non-zero.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
from . import platform_map
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> int:
|
|
20
|
+
host = platform_map.detect_host()
|
|
21
|
+
sys.stderr.write(
|
|
22
|
+
platform_map.unsupported_message(host["os"], host["cpu"], host["reason"]) + "\n"
|
|
23
|
+
)
|
|
24
|
+
return 1
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__": # `python -m spec_spine._refuse`
|
|
28
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""Spec: specs/008-python-distribution/spec.md (extends 007-distribution).
|
|
2
|
+
|
|
3
|
+
The single (os, cpu) -> target table for the Python/uvx channel, plus host
|
|
4
|
+
detection and the unsupported-host message. This is the Python-side mirror of
|
|
5
|
+
npm/lib/platform.js's SUPPORTED map and the §3.2 table in spec 007: the five
|
|
6
|
+
triples, the in-archive binary name, and the per-target wheel platform tag are
|
|
7
|
+
ONE FACT, and this module is its home on the Python side. A drift between this
|
|
8
|
+
table, release.yml's matrix, install.sh's detection, and npm/lib/platform.js is
|
|
9
|
+
a governed change (spec 007 §2, now four places).
|
|
10
|
+
|
|
11
|
+
Pure data + pure functions: no filesystem or network on the mapping path, so the
|
|
12
|
+
table is unit-tested directly (test/test_platform_map.py). Used by three
|
|
13
|
+
consumers: scripts/generate_wheels.py (publish time), _refuse.py (runtime, on the
|
|
14
|
+
unsupported path), and the tests.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import platform as _platform
|
|
20
|
+
import sys
|
|
21
|
+
import sysconfig
|
|
22
|
+
|
|
23
|
+
# platform key -> release triple, npm-style (os, cpu), wheel platform tag, and
|
|
24
|
+
# whether the in-archive binary is `.exe`. The wheel platform tag is what makes
|
|
25
|
+
# pip/uv install only the matching wheel on a host -- the Python analogue of
|
|
26
|
+
# npm's os/cpu fields. glibc is encoded by the `manylinux_*` tags: a musl host
|
|
27
|
+
# matches none of these and falls through to the sdist refusal (§3.4 parity).
|
|
28
|
+
TARGETS: dict[str, dict] = {
|
|
29
|
+
"darwin-arm64": {
|
|
30
|
+
"triple": "aarch64-apple-darwin",
|
|
31
|
+
"os": "darwin",
|
|
32
|
+
"cpu": "arm64",
|
|
33
|
+
"wheel_platform": "macosx_11_0_arm64",
|
|
34
|
+
"windows": False,
|
|
35
|
+
},
|
|
36
|
+
"darwin-x64": {
|
|
37
|
+
"triple": "x86_64-apple-darwin",
|
|
38
|
+
"os": "darwin",
|
|
39
|
+
"cpu": "x64",
|
|
40
|
+
"wheel_platform": "macosx_10_12_x86_64",
|
|
41
|
+
"windows": False,
|
|
42
|
+
},
|
|
43
|
+
"linux-x64": {
|
|
44
|
+
"triple": "x86_64-unknown-linux-gnu",
|
|
45
|
+
"os": "linux",
|
|
46
|
+
"cpu": "x64",
|
|
47
|
+
"wheel_platform": "manylinux_2_17_x86_64",
|
|
48
|
+
"windows": False,
|
|
49
|
+
},
|
|
50
|
+
"linux-arm64": {
|
|
51
|
+
"triple": "aarch64-unknown-linux-gnu",
|
|
52
|
+
"os": "linux",
|
|
53
|
+
"cpu": "arm64",
|
|
54
|
+
"wheel_platform": "manylinux_2_17_aarch64",
|
|
55
|
+
"windows": False,
|
|
56
|
+
},
|
|
57
|
+
"win32-x64": {
|
|
58
|
+
"triple": "x86_64-pc-windows-msvc",
|
|
59
|
+
"os": "win32",
|
|
60
|
+
"cpu": "x64",
|
|
61
|
+
"wheel_platform": "win_amd64",
|
|
62
|
+
"windows": True,
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# The Python distribution name and the importable package / data-dir stem. PyPI
|
|
67
|
+
# normalizes "spec-spine" <-> "spec_spine"; the .data/scripts and .dist-info
|
|
68
|
+
# directories inside a wheel use the underscore form.
|
|
69
|
+
DIST_NAME = "spec-spine"
|
|
70
|
+
DIST_STEM = "spec_spine"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class UnsupportedHostError(RuntimeError):
|
|
74
|
+
"""Raised when the running host has no prebuilt binary."""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def binary_name(windows: bool) -> str:
|
|
78
|
+
"""In-archive / in-wheel binary name: `.exe` on Windows, bare elsewhere."""
|
|
79
|
+
return "spec-spine.exe" if windows else "spec-spine"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def target_for(os_name: str, cpu: str) -> dict:
|
|
83
|
+
"""(os, cpu) -> target record. Raises UnsupportedHostError for any host with
|
|
84
|
+
no prebuilt binary. `os`/`cpu` are the npm-style names ('darwin'/'linux'/
|
|
85
|
+
'win32', 'x64'/'arm64'), not Python's ('linux2', 'x86_64')."""
|
|
86
|
+
key = f"{os_name}-{cpu}"
|
|
87
|
+
rec = TARGETS.get(key)
|
|
88
|
+
if rec is None:
|
|
89
|
+
raise UnsupportedHostError(unsupported_message(os_name, cpu))
|
|
90
|
+
return {"key": key, **rec, "binary_name": binary_name(rec["windows"])}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# --- runtime host detection (the unsupported / sdist path) -------------------
|
|
94
|
+
|
|
95
|
+
def _normalize_machine(machine: str) -> str | None:
|
|
96
|
+
m = machine.lower()
|
|
97
|
+
if m in ("arm64", "aarch64"):
|
|
98
|
+
return "arm64"
|
|
99
|
+
if m in ("x86_64", "amd64", "x64"):
|
|
100
|
+
return "x64"
|
|
101
|
+
return None # i686/ppc64/etc. -> unsupported, surfaced clearly
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def is_musl_linux() -> bool:
|
|
105
|
+
"""True on a musl (non-glibc) Linux. Permissive: if we cannot tell, assume
|
|
106
|
+
glibc and let resolution fail loudly later (mirrors npm's isMuslLinux)."""
|
|
107
|
+
if sys.platform != "linux":
|
|
108
|
+
return False
|
|
109
|
+
try:
|
|
110
|
+
if "musl" in (sysconfig.get_platform() or ""):
|
|
111
|
+
return True
|
|
112
|
+
libc, _ver = _platform.libc_ver()
|
|
113
|
+
return libc != "" and "glibc" not in libc.lower()
|
|
114
|
+
except Exception:
|
|
115
|
+
return False
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def detect_host() -> dict:
|
|
119
|
+
"""Best-effort host classification for messaging. Returns a dict with `key`
|
|
120
|
+
(platform key or None), `os`, `cpu`, and `reason` ('musl' | 'arch' | None)."""
|
|
121
|
+
os_map = {"darwin": "darwin", "linux": "linux", "win32": "win32"}
|
|
122
|
+
os_name = os_map.get(sys.platform, sys.platform)
|
|
123
|
+
cpu = _normalize_machine(_platform.machine())
|
|
124
|
+
if os_name == "linux" and is_musl_linux():
|
|
125
|
+
return {"key": None, "os": os_name, "cpu": cpu or "?", "reason": "musl"}
|
|
126
|
+
if cpu is None or f"{os_name}-{cpu}" not in TARGETS:
|
|
127
|
+
return {"key": None, "os": os_name, "cpu": cpu or _platform.machine().lower(),
|
|
128
|
+
"reason": "arch"}
|
|
129
|
+
return {"key": f"{os_name}-{cpu}", "os": os_name, "cpu": cpu, "reason": None}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def unsupported_message(os_name: str, cpu: str, reason: str | None = None) -> str:
|
|
133
|
+
host = f"{os_name}-{cpu}" + (" (musl libc)" if reason == "musl" else "")
|
|
134
|
+
lines = [
|
|
135
|
+
f"spec-spine: no prebuilt binary for {host}.",
|
|
136
|
+
"Prebuilt wheels cover darwin-arm64, darwin-x64, linux-x64 (glibc),",
|
|
137
|
+
"linux-arm64 (glibc), and win32-x64. Install from source instead:",
|
|
138
|
+
" cargo install spec-spine-cli",
|
|
139
|
+
]
|
|
140
|
+
if reason == "musl":
|
|
141
|
+
lines.append(
|
|
142
|
+
"(Alpine/musl: use a glibc-based image, or cargo install spec-spine-cli.)"
|
|
143
|
+
)
|
|
144
|
+
lines.append(
|
|
145
|
+
"(If you are on a supported host and reached this message, you likely "
|
|
146
|
+
"installed with --no-binary; reinstall allowing wheels.)"
|
|
147
|
+
)
|
|
148
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spec-spine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The spec-spine CLI: compile a markdown spec corpus into a deterministic authority ledger and refuse code that drifts from its owning spec. Ships the prebuilt binary; no Rust toolchain required.
|
|
5
|
+
Author: The spec-spine Authors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/bartekus/spec-spine
|
|
8
|
+
Project-URL: Repository, https://github.com/bartekus/spec-spine
|
|
9
|
+
Project-URL: Issues, https://github.com/bartekus/spec-spine/issues
|
|
10
|
+
Keywords: spec,specification,authority,governance,coupling,cli,rust,deterministic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# spec-spine (Python / uvx)
|
|
21
|
+
|
|
22
|
+
The `spec-spine` CLI for Python users: compile a markdown spec corpus into a
|
|
23
|
+
deterministic authority ledger and refuse code that drifts from its owning spec.
|
|
24
|
+
Ships the prebuilt binary; **no Rust toolchain required**.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
uvx spec-spine check # run the CLI with no install
|
|
28
|
+
uv tool install spec-spine # or install it as a persistent tool
|
|
29
|
+
pip install spec-spine # or into a project/venv
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
|
|
34
|
+
This is a **binary distribution**, not a Python binding. There is no native
|
|
35
|
+
extension and the engine is never called from Python. The project publishes:
|
|
36
|
+
|
|
37
|
+
- **five platform wheels** — one per supported target, each carrying the prebuilt
|
|
38
|
+
`spec-spine` binary in the wheel's scripts directory. pip/uv select the one
|
|
39
|
+
matching your host by its platform tag and install the binary onto `PATH`. On a
|
|
40
|
+
supported host there is **no Python in the run path and no network at install**
|
|
41
|
+
beyond fetching the wheel itself; it works offline from a warm cache or a
|
|
42
|
+
private mirror, and under `--no-binary`-free resolution.
|
|
43
|
+
- **one sdist** — the unsupported-host fallback. It builds only when no wheel
|
|
44
|
+
matches (musl/Alpine, win-arm64, 32-bit), and its `spec-spine` command prints a
|
|
45
|
+
clear message pointing at `cargo install spec-spine-cli`.
|
|
46
|
+
|
|
47
|
+
This mirrors the npm shim (spec 007): npm uses `os`/`cpu`-gated
|
|
48
|
+
`optionalDependencies`; Python uses wheel platform tags. One project, many
|
|
49
|
+
wheels.
|
|
50
|
+
|
|
51
|
+
## Supported targets
|
|
52
|
+
|
|
53
|
+
| host | wheel platform tag | release triple |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| macOS arm64 | `macosx_11_0_arm64` | `aarch64-apple-darwin` |
|
|
56
|
+
| macOS x86_64 | `macosx_10_12_x86_64` | `x86_64-apple-darwin` |
|
|
57
|
+
| Linux x86_64 (glibc) | `manylinux_2_17_x86_64` | `x86_64-unknown-linux-gnu` |
|
|
58
|
+
| Linux arm64 (glibc) | `manylinux_2_17_aarch64` | `aarch64-unknown-linux-gnu` |
|
|
59
|
+
| Windows x86_64 | `win_amd64` | `x86_64-pc-windows-msvc` |
|
|
60
|
+
|
|
61
|
+
Linux binaries are **glibc**. Alpine/musl hosts have no wheel and must use
|
|
62
|
+
`cargo install spec-spine-cli` or a glibc-based image.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/spec_spine/__init__.py
|
|
5
|
+
src/spec_spine/_refuse.py
|
|
6
|
+
src/spec_spine/platform_map.py
|
|
7
|
+
src/spec_spine.egg-info/PKG-INFO
|
|
8
|
+
src/spec_spine.egg-info/SOURCES.txt
|
|
9
|
+
src/spec_spine.egg-info/dependency_links.txt
|
|
10
|
+
src/spec_spine.egg-info/entry_points.txt
|
|
11
|
+
src/spec_spine.egg-info/top_level.txt
|
|
12
|
+
test/test_platform_map.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
spec_spine
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Spec: specs/008-python-distribution/spec.md.
|
|
2
|
+
|
|
3
|
+
Network- and disk-free unit test of the (os, cpu) -> target mapping, the wheel
|
|
4
|
+
platform tags, and the unsupported-host refusal -- the Python parallel of
|
|
5
|
+
npm/test/platform.test.js. Stdlib unittest so it runs with no third-party deps:
|
|
6
|
+
`python -m unittest discover -s test`.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
from spec_spine import platform_map as pm
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PlatformMapTest(unittest.TestCase):
|
|
15
|
+
def test_maps_every_supported_target(self):
|
|
16
|
+
cases = [
|
|
17
|
+
("darwin", "arm64", "aarch64-apple-darwin", "macosx_11_0_arm64", "spec-spine"),
|
|
18
|
+
("darwin", "x64", "x86_64-apple-darwin", "macosx_10_12_x86_64", "spec-spine"),
|
|
19
|
+
("linux", "x64", "x86_64-unknown-linux-gnu", "manylinux_2_17_x86_64", "spec-spine"),
|
|
20
|
+
("linux", "arm64", "aarch64-unknown-linux-gnu", "manylinux_2_17_aarch64", "spec-spine"),
|
|
21
|
+
("win32", "x64", "x86_64-pc-windows-msvc", "win_amd64", "spec-spine.exe"),
|
|
22
|
+
]
|
|
23
|
+
for os_name, cpu, triple, wheel_plat, binname in cases:
|
|
24
|
+
t = pm.target_for(os_name, cpu)
|
|
25
|
+
self.assertEqual(t["triple"], triple, f"{os_name}-{cpu} triple")
|
|
26
|
+
self.assertEqual(t["wheel_platform"], wheel_plat, f"{os_name}-{cpu} wheel tag")
|
|
27
|
+
self.assertEqual(t["binary_name"], binname, f"{os_name}-{cpu} binary")
|
|
28
|
+
self.assertEqual(t["key"], f"{os_name}-{cpu}")
|
|
29
|
+
|
|
30
|
+
def test_table_is_exactly_the_five_release_triples(self):
|
|
31
|
+
self.assertEqual(
|
|
32
|
+
sorted(pm.TARGETS),
|
|
33
|
+
["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "win32-x64"],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def test_triples_match_release_yml_matrix(self):
|
|
37
|
+
# These five strings must equal release.yml's build matrix exactly.
|
|
38
|
+
self.assertEqual(
|
|
39
|
+
sorted(rec["triple"] for rec in pm.TARGETS.values()),
|
|
40
|
+
[
|
|
41
|
+
"aarch64-apple-darwin",
|
|
42
|
+
"aarch64-unknown-linux-gnu",
|
|
43
|
+
"x86_64-apple-darwin",
|
|
44
|
+
"x86_64-pc-windows-msvc",
|
|
45
|
+
"x86_64-unknown-linux-gnu",
|
|
46
|
+
],
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def test_refuses_unsupported_targets_with_source_hint(self):
|
|
50
|
+
for os_name, cpu in [("win32", "arm64"), ("linux", "ia32"),
|
|
51
|
+
("freebsd", "x64"), ("darwin", "ppc64")]:
|
|
52
|
+
with self.assertRaises(pm.UnsupportedHostError) as ctx:
|
|
53
|
+
pm.target_for(os_name, cpu)
|
|
54
|
+
msg = str(ctx.exception)
|
|
55
|
+
self.assertIn(f"{os_name}-{cpu}", msg)
|
|
56
|
+
self.assertIn("cargo install spec-spine-cli", msg)
|
|
57
|
+
|
|
58
|
+
def test_musl_message_mentions_glibc_image(self):
|
|
59
|
+
msg = pm.unsupported_message("linux", "x64", reason="musl")
|
|
60
|
+
self.assertIn("musl", msg)
|
|
61
|
+
self.assertIn("glibc-based image", msg)
|
|
62
|
+
self.assertIn("cargo install spec-spine-cli", msg)
|
|
63
|
+
|
|
64
|
+
def test_binary_name(self):
|
|
65
|
+
self.assertEqual(pm.binary_name(False), "spec-spine")
|
|
66
|
+
self.assertEqual(pm.binary_name(True), "spec-spine.exe")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
unittest.main()
|