tenant-tail 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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: tenant-tail
3
+ Version: 0.1.0
4
+ Summary: The tenant-tail verification toolkit: re-check a factory's run-side paperwork (governance certificate, provenance) with no trust in the producer. Ships the prebuilt binary; no Rust toolchain required.
5
+ Author: The tenant-tail Authors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/bartekus/tenant-tail
8
+ Project-URL: Repository, https://github.com/bartekus/tenant-tail
9
+ Project-URL: Issues, https://github.com/bartekus/tenant-tail/issues
10
+ Keywords: governance,verification,certificate,provenance,attestation,cli,rust,tenant
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
+ # tenant-tail (Python / uvx)
21
+
22
+ The `tenant-tail` verification toolkit for Python users: re-check a factory's
23
+ run-side paperwork (governance certificate, provenance) with no trust in the
24
+ producer. Ships the prebuilt binary; **no Rust toolchain required**.
25
+
26
+ ```sh
27
+ uvx tenant-tail verify-certificate # run the CLI with no install
28
+ uv tool install tenant-tail # or install it as a persistent tool
29
+ pip install tenant-tail # 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
+ `tenant-tail` 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 `tenant-tail` command prints a
45
+ clear message pointing at `cargo install tenant-tail-cli`.
46
+
47
+ This mirrors the npm shim (spec 003): 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 tenant-tail-cli` or a glibc-based image.
63
+
64
+ ## License
65
+
66
+ Apache-2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,47 @@
1
+ # tenant-tail (Python / uvx)
2
+
3
+ The `tenant-tail` verification toolkit for Python users: re-check a factory's
4
+ run-side paperwork (governance certificate, provenance) with no trust in the
5
+ producer. Ships the prebuilt binary; **no Rust toolchain required**.
6
+
7
+ ```sh
8
+ uvx tenant-tail verify-certificate # run the CLI with no install
9
+ uv tool install tenant-tail # or install it as a persistent tool
10
+ pip install tenant-tail # 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
+ `tenant-tail` 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 `tenant-tail` command prints a
26
+ clear message pointing at `cargo install tenant-tail-cli`.
27
+
28
+ This mirrors the npm shim (spec 003): 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 tenant-tail-cli` or a glibc-based image.
44
+
45
+ ## License
46
+
47
+ Apache-2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,57 @@
1
+ # Spec: specs/003-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 `tenant-tail` 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 = "tenant-tail"
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). Tracks the workspace version; bumped in lockstep with
22
+ # Cargo.toml and npm/package.json.
23
+ version = "0.1.0"
24
+ description = "The tenant-tail verification toolkit: re-check a factory's run-side paperwork (governance certificate, provenance) with no trust in the producer. Ships the prebuilt binary; no Rust toolchain required."
25
+ readme = "README.md"
26
+ license = "Apache-2.0"
27
+ license-files = ["LICENSE"]
28
+ authors = [{ name = "The tenant-tail Authors" }]
29
+ keywords = ["governance", "verification", "certificate", "provenance", "attestation", "cli", "rust", "tenant"]
30
+ # Honest floor for the tiny Python that the sdist actually runs. The platform
31
+ # wheels declare a more permissive floor (set in generate_wheels.py) so a Python
32
+ # version mismatch never pushes a supported host onto this sdist.
33
+ requires-python = ">=3.9"
34
+ classifiers = [
35
+ "Development Status :: 4 - Beta",
36
+ "Environment :: Console",
37
+ "Programming Language :: Rust",
38
+ "Topic :: Software Development :: Quality Assurance",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/bartekus/tenant-tail"
43
+ Repository = "https://github.com/bartekus/tenant-tail"
44
+ Issues = "https://github.com/bartekus/tenant-tail/issues"
45
+
46
+ # Same command name on every host. On a supported host the platform wheel's
47
+ # bundled binary provides `tenant-tail`; on an unsupported host this sdist
48
+ # provides `tenant-tail` -> the refusal. Only one is ever installed per host, so
49
+ # the names never collide.
50
+ [project.scripts]
51
+ tenant-tail = "tenant_tail._refuse:main"
52
+
53
+ [tool.setuptools]
54
+ package-dir = { "" = "src" }
55
+
56
+ [tool.setuptools.packages.find]
57
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ """tenant-tail: 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 `tenant-tail` binary in the wheel's
5
+ scripts directory, so `tenant-tail`/`uvx tenant-tail` 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
+ `tenant-tail` entry point prints a clear refusal (see _refuse.py). Spec:
9
+ specs/003-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("tenant-tail")
18
+ except Exception: # pragma: no cover - not installed as a dist
19
+ __version__ = "0+unknown"
@@ -0,0 +1,28 @@
1
+ """Spec: specs/003-distribution/spec.md (unsupported hosts fail clearly).
2
+
3
+ The `tenant-tail` 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 `tenant-tail` 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 tenant_tail._refuse`
28
+ raise SystemExit(main())
@@ -0,0 +1,148 @@
1
+ """Spec: specs/003-distribution/spec.md.
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 platform table in spec 003: 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, and npm/lib/platform.js is a governed change
9
+ (spec 003, 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 "tenant-tail" <-> "tenant_tail"; the .data/scripts and .dist-info
68
+ # directories inside a wheel use the underscore form.
69
+ DIST_NAME = "tenant-tail"
70
+ DIST_STEM = "tenant_tail"
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 "tenant-tail.exe" if windows else "tenant-tail"
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"tenant-tail: 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 tenant-tail-cli",
139
+ ]
140
+ if reason == "musl":
141
+ lines.append(
142
+ "(Alpine/musl: use a glibc-based image, or cargo install tenant-tail-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: tenant-tail
3
+ Version: 0.1.0
4
+ Summary: The tenant-tail verification toolkit: re-check a factory's run-side paperwork (governance certificate, provenance) with no trust in the producer. Ships the prebuilt binary; no Rust toolchain required.
5
+ Author: The tenant-tail Authors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/bartekus/tenant-tail
8
+ Project-URL: Repository, https://github.com/bartekus/tenant-tail
9
+ Project-URL: Issues, https://github.com/bartekus/tenant-tail/issues
10
+ Keywords: governance,verification,certificate,provenance,attestation,cli,rust,tenant
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
+ # tenant-tail (Python / uvx)
21
+
22
+ The `tenant-tail` verification toolkit for Python users: re-check a factory's
23
+ run-side paperwork (governance certificate, provenance) with no trust in the
24
+ producer. Ships the prebuilt binary; **no Rust toolchain required**.
25
+
26
+ ```sh
27
+ uvx tenant-tail verify-certificate # run the CLI with no install
28
+ uv tool install tenant-tail # or install it as a persistent tool
29
+ pip install tenant-tail # 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
+ `tenant-tail` 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 `tenant-tail` command prints a
45
+ clear message pointing at `cargo install tenant-tail-cli`.
46
+
47
+ This mirrors the npm shim (spec 003): 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 tenant-tail-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/tenant_tail/__init__.py
5
+ src/tenant_tail/_refuse.py
6
+ src/tenant_tail/platform_map.py
7
+ src/tenant_tail.egg-info/PKG-INFO
8
+ src/tenant_tail.egg-info/SOURCES.txt
9
+ src/tenant_tail.egg-info/dependency_links.txt
10
+ src/tenant_tail.egg-info/entry_points.txt
11
+ src/tenant_tail.egg-info/top_level.txt
12
+ test/test_platform_map.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ tenant-tail = tenant_tail._refuse:main
@@ -0,0 +1 @@
1
+ tenant_tail
@@ -0,0 +1,70 @@
1
+ """Spec: specs/003-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 tenant_tail 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", "tenant-tail"),
18
+ ("darwin", "x64", "x86_64-apple-darwin", "macosx_10_12_x86_64", "tenant-tail"),
19
+ ("linux", "x64", "x86_64-unknown-linux-gnu", "manylinux_2_17_x86_64", "tenant-tail"),
20
+ ("linux", "arm64", "aarch64-unknown-linux-gnu", "manylinux_2_17_aarch64", "tenant-tail"),
21
+ ("win32", "x64", "x86_64-pc-windows-msvc", "win_amd64", "tenant-tail.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 tenant-tail-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 tenant-tail-cli", msg)
63
+
64
+ def test_binary_name(self):
65
+ self.assertEqual(pm.binary_name(False), "tenant-tail")
66
+ self.assertEqual(pm.binary_name(True), "tenant-tail.exe")
67
+
68
+
69
+ if __name__ == "__main__":
70
+ unittest.main()