tailmeta 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.
- tailmeta-0.1.0/.github/workflows/publish.yml +108 -0
- tailmeta-0.1.0/.gitignore +44 -0
- tailmeta-0.1.0/LICENSE +21 -0
- tailmeta-0.1.0/MANIFEST.in +5 -0
- tailmeta-0.1.0/Makefile +53 -0
- tailmeta-0.1.0/PKG-INFO +245 -0
- tailmeta-0.1.0/README.md +229 -0
- tailmeta-0.1.0/ci/check_dist.py +43 -0
- tailmeta-0.1.0/ci/test_wheel.py +21 -0
- tailmeta-0.1.0/examples/nuitka/main.py +23 -0
- tailmeta-0.1.0/examples/nuitka/test_onefile.py +83 -0
- tailmeta-0.1.0/pyproject.toml +30 -0
- tailmeta-0.1.0/setup.cfg +4 -0
- tailmeta-0.1.0/src/tailmeta/__init__.py +5 -0
- tailmeta-0.1.0/src/tailmeta/__main__.py +4 -0
- tailmeta-0.1.0/src/tailmeta/_core.py +155 -0
- tailmeta-0.1.0/src/tailmeta/_version.py +24 -0
- tailmeta-0.1.0/src/tailmeta/cli.py +45 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/PKG-INFO +245 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/SOURCES.txt +26 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/dependency_links.txt +1 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/entry_points.txt +2 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/requires.txt +3 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/scm_file_list.json +21 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/scm_version.json +8 -0
- tailmeta-0.1.0/src/tailmeta.egg-info/top_level.txt +1 -0
- tailmeta-0.1.0/tests/test_cli.py +25 -0
- tailmeta-0.1.0/tests/test_tailmeta.py +103 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: Test and publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ['**']
|
|
6
|
+
tags: ['v*']
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: tailmeta-${{ github.workflow }}-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.12'
|
|
28
|
+
- name: Install build tools
|
|
29
|
+
run: python -m pip install build twine
|
|
30
|
+
- name: Build sdist and wheel
|
|
31
|
+
run: python -m build --outdir packages
|
|
32
|
+
- name: Check distributions and release version
|
|
33
|
+
run: |
|
|
34
|
+
python -m twine check --strict packages/*
|
|
35
|
+
python ci/check_dist.py
|
|
36
|
+
- uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: distributions
|
|
39
|
+
path: packages/*
|
|
40
|
+
if-no-files-found: error
|
|
41
|
+
|
|
42
|
+
test:
|
|
43
|
+
needs: build
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
49
|
+
signing: ['no', 'yes']
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
with:
|
|
53
|
+
persist-credentials: false
|
|
54
|
+
- uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: ${{ matrix.python }}
|
|
57
|
+
- uses: actions/download-artifact@v4
|
|
58
|
+
with:
|
|
59
|
+
name: distributions
|
|
60
|
+
path: packages
|
|
61
|
+
- name: Install and test the built wheel in an isolated environment
|
|
62
|
+
env:
|
|
63
|
+
TAILMETA_TEST_SIGNING: ${{ matrix.signing }}
|
|
64
|
+
run: python ci/test_wheel.py
|
|
65
|
+
|
|
66
|
+
nuitka:
|
|
67
|
+
needs: build
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
with:
|
|
72
|
+
persist-credentials: false
|
|
73
|
+
- uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: '3.12'
|
|
76
|
+
- uses: actions/download-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: distributions
|
|
79
|
+
path: packages
|
|
80
|
+
- name: Install onefile dependencies
|
|
81
|
+
run: |
|
|
82
|
+
sudo apt-get update
|
|
83
|
+
sudo apt-get install -y patchelf
|
|
84
|
+
python -m pip install nuitka zstandard ordered-set cryptography
|
|
85
|
+
python -m pip install packages/*.whl
|
|
86
|
+
- name: Build and test a real onefile executable
|
|
87
|
+
run: |
|
|
88
|
+
python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist examples/nuitka/main.py
|
|
89
|
+
python examples/nuitka/test_onefile.py dist/main.bin
|
|
90
|
+
|
|
91
|
+
publish:
|
|
92
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
93
|
+
needs: [build, test, nuitka]
|
|
94
|
+
runs-on: ubuntu-latest
|
|
95
|
+
environment:
|
|
96
|
+
name: pypi
|
|
97
|
+
url: https://pypi.org/project/tailmeta/
|
|
98
|
+
permissions:
|
|
99
|
+
id-token: write
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/download-artifact@v4
|
|
102
|
+
with:
|
|
103
|
+
name: distributions
|
|
104
|
+
path: packages
|
|
105
|
+
- name: Publish to PyPI using Trusted Publishing
|
|
106
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
107
|
+
with:
|
|
108
|
+
packages-dir: packages/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Python environments and caches
|
|
2
|
+
.venv/
|
|
3
|
+
venv/
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.mypy_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.coverage
|
|
10
|
+
.coverage.*
|
|
11
|
+
htmlcov/
|
|
12
|
+
|
|
13
|
+
# Package and Nuitka build outputs
|
|
14
|
+
/build/
|
|
15
|
+
/dist/
|
|
16
|
+
/packages/
|
|
17
|
+
*.egg-info/
|
|
18
|
+
*.build/
|
|
19
|
+
*.dist/
|
|
20
|
+
*.onefile-build/
|
|
21
|
+
/src/tailmeta/_version.py
|
|
22
|
+
/nuitka-crash-report.xml
|
|
23
|
+
|
|
24
|
+
# Locally downloaded tools
|
|
25
|
+
/tools/
|
|
26
|
+
|
|
27
|
+
# Signing keys and local secrets
|
|
28
|
+
/demo-keys/
|
|
29
|
+
*.pem
|
|
30
|
+
*.key
|
|
31
|
+
.env
|
|
32
|
+
.env.*
|
|
33
|
+
!.env.example
|
|
34
|
+
|
|
35
|
+
# Local editor and agent configuration
|
|
36
|
+
/.agents/
|
|
37
|
+
/.codex/
|
|
38
|
+
/.claude/
|
|
39
|
+
/.cursor/
|
|
40
|
+
/.idea/
|
|
41
|
+
/.vscode/
|
|
42
|
+
.DS_Store
|
|
43
|
+
*~
|
|
44
|
+
*.swp
|
tailmeta-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vpuhoff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tailmeta-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
PYTHON := .venv/bin/python
|
|
2
|
+
PIP := .venv/bin/pip
|
|
3
|
+
SRC := examples/nuitka/main.py
|
|
4
|
+
OUT_DIR := dist
|
|
5
|
+
BIN := $(OUT_DIR)/main.bin
|
|
6
|
+
VERSION ?= 1.2.4
|
|
7
|
+
PRIVATE_KEY ?= demo-keys/private.pem
|
|
8
|
+
PUBLIC_KEY ?= demo-keys/public.pem
|
|
9
|
+
|
|
10
|
+
.PHONY: all venv deps build stamp run version verify keygen sign test clean
|
|
11
|
+
|
|
12
|
+
all: build stamp
|
|
13
|
+
|
|
14
|
+
venv:
|
|
15
|
+
python3 -m venv .venv
|
|
16
|
+
|
|
17
|
+
deps: venv
|
|
18
|
+
$(PIP) install -U pip
|
|
19
|
+
$(PIP) install nuitka zstandard ordered-set
|
|
20
|
+
$(PIP) install -e ".[signing]"
|
|
21
|
+
|
|
22
|
+
build:
|
|
23
|
+
$(PYTHON) -m nuitka \
|
|
24
|
+
--onefile \
|
|
25
|
+
--assume-yes-for-downloads \
|
|
26
|
+
--output-dir=$(OUT_DIR) \
|
|
27
|
+
$(SRC)
|
|
28
|
+
|
|
29
|
+
stamp: $(BIN)
|
|
30
|
+
$(PYTHON) -m tailmeta stamp $(BIN) --version "$(VERSION)"
|
|
31
|
+
|
|
32
|
+
sign: $(BIN)
|
|
33
|
+
$(PYTHON) -m tailmeta stamp $(BIN) --version "$(VERSION)" --private-key "$(PRIVATE_KEY)"
|
|
34
|
+
|
|
35
|
+
keygen:
|
|
36
|
+
mkdir -p "$(dir $(PRIVATE_KEY))" "$(dir $(PUBLIC_KEY))"
|
|
37
|
+
$(PYTHON) -m tailmeta keygen --private-key "$(PRIVATE_KEY)" --public-key "$(PUBLIC_KEY)"
|
|
38
|
+
|
|
39
|
+
verify: $(BIN)
|
|
40
|
+
$(PYTHON) -m tailmeta verify $(BIN) --public-key "$(PUBLIC_KEY)"
|
|
41
|
+
|
|
42
|
+
run: $(BIN)
|
|
43
|
+
./$(BIN)
|
|
44
|
+
|
|
45
|
+
version: $(BIN)
|
|
46
|
+
@$(PYTHON) -m tailmeta read $(BIN) --version-only
|
|
47
|
+
|
|
48
|
+
test: build
|
|
49
|
+
$(PYTHON) -m unittest discover -s tests -v
|
|
50
|
+
$(PYTHON) examples/nuitka/test_onefile.py $(BIN)
|
|
51
|
+
|
|
52
|
+
clean:
|
|
53
|
+
rm -rf $(OUT_DIR) main.build main.dist main.onefile-build
|
tailmeta-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tailmeta
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Read and update version metadata in file trailers, with optional Ed25519 signatures
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Keywords: version,metadata,binary,trailer,nuitka
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Provides-Extra: signing
|
|
14
|
+
Requires-Dist: cryptography>=41; extra == "signing"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# tailmeta
|
|
18
|
+
|
|
19
|
+
Store version information and metadata in the trailer of a built file. Assign
|
|
20
|
+
versions after building, read them without running the application, and update
|
|
21
|
+
them without rebuilding. Ed25519 signing is optional.
|
|
22
|
+
|
|
23
|
+
Requires Python 3.10+. The base installation has no third-party dependencies.
|
|
24
|
+
The package is currently available locally and has not been published to PyPI.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
From the project directory:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m pip install .
|
|
32
|
+
# With signing support:
|
|
33
|
+
python -m pip install '.[signing]'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
From a built wheel:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m pip install packages/tailmeta-*.whl
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Command-line usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python -m tailmeta stamp app.bin --version 1.2.4
|
|
46
|
+
python -m tailmeta read app.bin
|
|
47
|
+
python -m tailmeta read app.bin --version-only
|
|
48
|
+
python -m tailmeta stamp app.bin --version 1.2.5 --channel stable --commit abc123
|
|
49
|
+
python -m tailmeta --version
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Installation also provides the `tailmeta` command with the same arguments.
|
|
53
|
+
`stamp` requires an existing file, preserves its original bytes, and replaces
|
|
54
|
+
any previous tailmeta trailer. Repeated writes do not accumulate metadata.
|
|
55
|
+
`read` does not verify authenticity, even when the trailer is signed.
|
|
56
|
+
The `read` command exits with code 1 when metadata is absent. File, format,
|
|
57
|
+
and verification errors also produce exit code 1.
|
|
58
|
+
|
|
59
|
+
## Python API
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from tailmeta import read_metadata, stamp
|
|
63
|
+
|
|
64
|
+
stamp("app.bin", {"version": "1.2.4", "channel": "stable"})
|
|
65
|
+
metadata = read_metadata("app.bin")
|
|
66
|
+
print(metadata["version"] if metadata else "unknown")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`stamp(path, metadata, private_key=None)` accepts a dictionary containing a
|
|
70
|
+
required nonempty `version` string and optional additional JSON fields.
|
|
71
|
+
`sha256` and `signature` are reserved and generated during signing.
|
|
72
|
+
`read_metadata(path)` returns a dictionary, or `None` if no trailer is found.
|
|
73
|
+
A recognized but malformed trailer raises `ValueError`; file errors raise
|
|
74
|
+
`OSError`. Paths may be strings or `pathlib.Path` objects.
|
|
75
|
+
|
|
76
|
+
## Optional signing
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
python -m tailmeta keygen --private-key private.pem --public-key public.pem
|
|
80
|
+
python -m tailmeta stamp app.bin --version 1.2.4 --private-key private.pem
|
|
81
|
+
python -m tailmeta verify app.bin --public-key public.pem
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from tailmeta import generate_keys, stamp, verify
|
|
86
|
+
|
|
87
|
+
generate_keys("private.pem", "public.pem")
|
|
88
|
+
stamp("app.bin", {"version": "1.2.4"}, private_key="private.pem")
|
|
89
|
+
metadata = verify("app.bin", public_key="public.pem")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Install the `signing` extra to use these operations. Without it, version reads
|
|
93
|
+
and writes still work; signing operations report the missing dependency.
|
|
94
|
+
`verify` checks the signature over all metadata fields and the SHA-256 hash of
|
|
95
|
+
the original file content, then returns the verified fields without
|
|
96
|
+
`signature`. Unsigned files are rejected.
|
|
97
|
+
|
|
98
|
+
Ed25519 keys use PEM encoding. Private keys are created unencrypted with mode
|
|
99
|
+
0600. `keygen` refuses to overwrite existing keys.
|
|
100
|
+
Running `stamp` again without a key replaces a signed trailer with an unsigned
|
|
101
|
+
one. Signing authenticates the current bytes without checking any previous
|
|
102
|
+
signature.
|
|
103
|
+
|
|
104
|
+
## Trailer format v1
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
[original file][UTF-8 JSON][JSON length: uint32 big endian][TAILMETA: 8 bytes]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The trailer ends with the eight magic bytes `TAILMETA`.
|
|
111
|
+
JSON is limited to 1 MiB. Keys are sorted, and serialization uses
|
|
112
|
+
`ensure_ascii=False`, `allow_nan=False`, and `separators=(",", ":")`.
|
|
113
|
+
The signed message is `b"TAILMETA\x00" + JSON`, excluding the `signature` field.
|
|
114
|
+
This uses Python JSON serialization, not JCS. The signature is Base64-encoded;
|
|
115
|
+
`sha256` is the hexadecimal SHA-256 digest of the original content before the
|
|
116
|
+
JSON trailer.
|
|
117
|
+
|
|
118
|
+
Writing copies the original content into a temporary file in the same directory
|
|
119
|
+
and atomically replaces the destination, preserving its permission bits.
|
|
120
|
+
Symbolic links are resolved to their targets. Ownership, ACLs, extended
|
|
121
|
+
attributes, and hard-link relationships are not explicitly preserved.
|
|
122
|
+
Concurrent writes are unsupported. Damaged magic bytes cannot be distinguished
|
|
123
|
+
from an absent trailer.
|
|
124
|
+
|
|
125
|
+
## Nuitka example
|
|
126
|
+
|
|
127
|
+
`examples/nuitka/main.py` reads the version of its own onefile executable and
|
|
128
|
+
prints `unknown` when metadata is absent. Signature verification is enabled
|
|
129
|
+
explicitly with `--public-key`.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
make deps
|
|
133
|
+
make build
|
|
134
|
+
make stamp VERSION=1.2.4
|
|
135
|
+
make version
|
|
136
|
+
make run
|
|
137
|
+
|
|
138
|
+
# Optional: generate demo keys and sign the executable.
|
|
139
|
+
make keygen
|
|
140
|
+
make sign VERSION=1.2.4
|
|
141
|
+
make verify
|
|
142
|
+
./dist/main.bin --public-key demo-keys/public.pem
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The Makefile uses `.venv/bin/python`. `make deps` installs the package in editable
|
|
146
|
+
mode with the `signing` extra, along with the tools for the Nuitka example.
|
|
147
|
+
The example requires gcc and a system installation of `patchelf`
|
|
148
|
+
(on Ubuntu: `sudo apt-get install gcc patchelf`).
|
|
149
|
+
|
|
150
|
+
## Development and packaging
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
python -m pip install -e '.[signing]'
|
|
154
|
+
python -m unittest discover -s tests -v
|
|
155
|
+
python -m pip install build
|
|
156
|
+
python -m build --outdir packages
|
|
157
|
+
make test # Also rebuild and test a real onefile executable.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The wheel contains only `tailmeta`, without test keys, compiled executables,
|
|
161
|
+
or Nuitka. `make test` uses temporary copies to test unsigned versions,
|
|
162
|
+
signatures, modified data, and incorrect keys. It leaves a freshly built
|
|
163
|
+
executable without a trailer. `make clean` removes `dist`; demo keys remain
|
|
164
|
+
in `demo-keys/`.
|
|
165
|
+
|
|
166
|
+
If system cache directories are not writable:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
mkdir -p /tmp/nuitka-version-test-ccache-tmp
|
|
170
|
+
NUITKA_CACHE_DIR=/tmp/nuitka-version-test-cache \
|
|
171
|
+
CCACHE_DIR=/tmp/nuitka-version-test-ccache \
|
|
172
|
+
CCACHE_TEMPDIR=/tmp/nuitka-version-test-ccache-tmp make test
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Compatibility
|
|
176
|
+
|
|
177
|
+
Append trailers only to formats that tolerate extra bytes at the end of the
|
|
178
|
+
file. Nuitka onefile behavior is tested on Linux; this does not guarantee
|
|
179
|
+
compatibility with every executable format. Repeat the integration test when
|
|
180
|
+
updating the loader.
|
|
181
|
+
|
|
182
|
+
Apply platform signatures and compute whole-file hashes after writing the
|
|
183
|
+
trailer. Deployment must establish trust in the public key and verification
|
|
184
|
+
code. Self-verification does not replace verification by a trusted launcher
|
|
185
|
+
before execution.
|
|
186
|
+
|
|
187
|
+
## GitHub Actions and PyPI
|
|
188
|
+
|
|
189
|
+
The workflow in `.github/workflows/publish.yml` runs on pushes, pull requests,
|
|
190
|
+
and manual dispatches. It builds the wheel **from the sdist**, validates package
|
|
191
|
+
metadata with `twine check --strict`, and tests that wheel in clean environments
|
|
192
|
+
on Python 3.10–3.14, both with and without the `signing` extra. A separate job
|
|
193
|
+
builds a real Nuitka onefile executable on Linux and tests version reading and
|
|
194
|
+
signature verification.
|
|
195
|
+
|
|
196
|
+
Publishing runs only when a `vX.Y.Z` tag is pushed and all checks have passed.
|
|
197
|
+
Prerelease tags such as `v0.2.0rc1` are also supported. The published artifacts
|
|
198
|
+
are the same ones that passed the tests. Only the publishing job receives the
|
|
199
|
+
OIDC permission `id-token: write`; no PyPI API token is required. Manual workflow
|
|
200
|
+
runs and ordinary branch commits do not publish packages.
|
|
201
|
+
|
|
202
|
+
### Automatic versioning
|
|
203
|
+
|
|
204
|
+
`setuptools-scm` derives the version from Git tags, so there is no need to edit
|
|
205
|
+
versions manually in `pyproject.toml` or Python code. Versioning is **tag-based**:
|
|
206
|
+
the workflow does not create tags or choose major, minor, or patch increments.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
git tag v0.1.0
|
|
210
|
+
git push origin v0.1.0
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
This tag produces version `0.1.0`. Commits between tags receive an automatically
|
|
214
|
+
calculated development version. Building generates `src/tailmeta/_version.py`,
|
|
215
|
+
which is included in the package and works inside Nuitka without Git or
|
|
216
|
+
setuptools-scm at runtime. Do not commit this generated file.
|
|
217
|
+
|
|
218
|
+
Source trees without Git history or sdist version metadata use the fallback
|
|
219
|
+
`0.0.0.dev0`; this fallback will not pass the release-tag check. The installed
|
|
220
|
+
package version is available through `tailmeta.__version__` and
|
|
221
|
+
`python -m tailmeta --version`.
|
|
222
|
+
|
|
223
|
+
### One-time Trusted Publishing setup
|
|
224
|
+
|
|
225
|
+
1. Host the project on GitHub and create an environment named **`pypi`** in the
|
|
226
|
+
repository settings. Restrict it to release tags if needed.
|
|
227
|
+
2. On PyPI, add a Trusted Publisher to an existing `tailmeta` project, or create
|
|
228
|
+
a Pending Publisher for the first release through the
|
|
229
|
+
[publishing settings](https://pypi.org/manage/account/publishing/).
|
|
230
|
+
Use the following values:
|
|
231
|
+
|
|
232
|
+
| Setting | Value |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| PyPI project name | `tailmeta` |
|
|
235
|
+
| GitHub owner and repository | Your actual repository owner and name |
|
|
236
|
+
| Workflow filename | `publish.yml` |
|
|
237
|
+
| Environment name | `pypi` |
|
|
238
|
+
|
|
239
|
+
3. Push a release tag. GitHub Actions will run the tests and publish the package.
|
|
240
|
+
|
|
241
|
+
Adding the workflow does not register a Trusted Publisher in your PyPI account.
|
|
242
|
+
Published PyPI versions cannot be overwritten; create a new tag for each
|
|
243
|
+
subsequent release. See the
|
|
244
|
+
[Trusted Publishing documentation](https://docs.pypi.org/trusted-publishers/using-a-publisher/)
|
|
245
|
+
for details.
|