Skip to main content

tailmeta

Store version information and metadata in the trailer of a built file. Assign versions after building, read them without running the application, and update them without rebuilding. Ed25519 signing is optional.

Requires Python 3.10+. The base installation has no third-party dependencies. The package is currently available locally and has not been published to PyPI.

Installation

From the project directory:

python -m pip install .
# With signing support:
python -m pip install '.[signing]'

From a built wheel:

python -m pip install packages/tailmeta-*.whl

Command-line usage

python -m tailmeta stamp app.bin --version 1.2.4
python -m tailmeta read app.bin
python -m tailmeta read app.bin --version-only
python -m tailmeta stamp app.bin --version 1.2.5 --channel stable --commit abc123
python -m tailmeta --version

Installation also provides the tailmeta command with the same arguments. stamp requires an existing file, preserves its original bytes, and replaces any previous tailmeta trailer. Repeated writes do not accumulate metadata. read does not verify authenticity, even when the trailer is signed. The read command exits with code 1 when metadata is absent. File, format, and verification errors also produce exit code 1.

Python API

from tailmeta import read_metadata, stamp

stamp("app.bin", {"version": "1.2.4", "channel": "stable"})
metadata = read_metadata("app.bin")
print(metadata["version"] if metadata else "unknown")

stamp(path, metadata, private_key=None) accepts a dictionary containing a required nonempty version string and optional additional JSON fields. sha256 and signature are reserved and generated during signing. read_metadata(path) returns a dictionary, or None if no trailer is found. A recognized but malformed trailer raises ValueError; file errors raise OSError. Paths may be strings or pathlib.Path objects.

Optional signing

python -m tailmeta keygen --private-key private.pem --public-key public.pem
python -m tailmeta stamp app.bin --version 1.2.4 --private-key private.pem
python -m tailmeta verify app.bin --public-key public.pem
from tailmeta import generate_keys, stamp, verify

generate_keys("private.pem", "public.pem")
stamp("app.bin", {"version": "1.2.4"}, private_key="private.pem")
metadata = verify("app.bin", public_key="public.pem")

Install the signing extra to use these operations. Without it, version reads and writes still work; signing operations report the missing dependency. verify checks the signature over all metadata fields and the SHA-256 hash of the original file content, then returns the verified fields without signature. Unsigned files are rejected.

Ed25519 keys use PEM encoding. Private keys are created unencrypted with mode 0600. keygen refuses to overwrite existing keys. Running stamp again without a key replaces a signed trailer with an unsigned one. Signing authenticates the current bytes without checking any previous signature.

Trailer format v1

[original file][UTF-8 JSON][JSON length: uint32 big endian][TAILMETA: 8 bytes]

The trailer ends with the eight magic bytes TAILMETA. JSON is limited to 1 MiB. Keys are sorted, and serialization uses ensure_ascii=False, allow_nan=False, and separators=(",", ":"). The signed message is b"TAILMETA\x00" + JSON, excluding the signature field. This uses Python JSON serialization, not JCS. The signature is Base64-encoded; sha256 is the hexadecimal SHA-256 digest of the original content before the JSON trailer.

Writing copies the original content into a temporary file in the same directory and atomically replaces the destination, preserving its permission bits. Symbolic links are resolved to their targets. Ownership, ACLs, extended attributes, and hard-link relationships are not explicitly preserved. Concurrent writes are unsupported. Damaged magic bytes cannot be distinguished from an absent trailer.

Nuitka example

examples/nuitka/main.py reads the version of its own onefile executable and prints unknown when metadata is absent. Signature verification is enabled explicitly with --public-key.

make deps
make build
make stamp VERSION=1.2.4
make version
make run

# Optional: generate demo keys and sign the executable.
make keygen
make sign VERSION=1.2.4
make verify
./dist/main.bin --public-key demo-keys/public.pem

The Makefile uses .venv/bin/python. make deps installs the package in editable mode with the signing extra, along with the tools for the Nuitka example. The example requires gcc and a system installation of patchelf (on Ubuntu: sudo apt-get install gcc patchelf).

Development and packaging

python -m pip install -e '.[signing]'
python -m unittest discover -s tests -v
python -m pip install build
python -m build --outdir packages
make test  # Also rebuild and test a real onefile executable.

The wheel contains only tailmeta, without test keys, compiled executables, or Nuitka. make test uses temporary copies to test unsigned versions, signatures, modified data, and incorrect keys. It leaves a freshly built executable without a trailer. make clean removes dist; demo keys remain in demo-keys/.

If system cache directories are not writable:

mkdir -p /tmp/nuitka-version-test-ccache-tmp
NUITKA_CACHE_DIR=/tmp/nuitka-version-test-cache \
CCACHE_DIR=/tmp/nuitka-version-test-ccache \
CCACHE_TEMPDIR=/tmp/nuitka-version-test-ccache-tmp make test

Compatibility

Append trailers only to formats that tolerate extra bytes at the end of the file. Nuitka onefile behavior is tested on Linux; this does not guarantee compatibility with every executable format. Repeat the integration test when updating the loader.

Apply platform signatures and compute whole-file hashes after writing the trailer. Deployment must establish trust in the public key and verification code. Self-verification does not replace verification by a trusted launcher before execution.

GitHub Actions and PyPI

The workflow in .github/workflows/publish.yml runs on pushes, pull requests, and manual dispatches. It builds the wheel from the sdist, validates package metadata with twine check --strict, and tests that wheel in clean environments on Python 3.10–3.14, both with and without the signing extra. A separate job builds a real Nuitka onefile executable on Linux and tests version reading and signature verification.

Publishing runs only when a vX.Y.Z tag is pushed and all checks have passed. Prerelease tags such as v0.2.0rc1 are also supported. The published artifacts are the same ones that passed the tests. Only the publishing job receives the OIDC permission id-token: write; no PyPI API token is required. Manual workflow runs and ordinary branch commits do not publish packages.

Automatic versioning

setuptools-scm derives the version from Git tags, so there is no need to edit versions manually in pyproject.toml or Python code. Versioning is tag-based: the workflow does not create tags or choose major, minor, or patch increments.

git tag v0.1.0
git push origin v0.1.0

This tag produces version 0.1.0. Commits between tags receive an automatically calculated development version. Building generates src/tailmeta/_version.py, which is included in the package and works inside Nuitka without Git or setuptools-scm at runtime. Do not commit this generated file.

Source trees without Git history or sdist version metadata use the fallback 0.0.0.dev0; this fallback will not pass the release-tag check. The installed package version is available through tailmeta.__version__ and python -m tailmeta --version.

One-time Trusted Publishing setup

  1. Host the project on GitHub and create an environment named pypi in the repository settings. Restrict it to release tags if needed.

  2. On PyPI, add a Trusted Publisher to an existing tailmeta project, or create a Pending Publisher for the first release through the publishing settings. Use the following values:

    Setting Value
    PyPI project name tailmeta
    GitHub owner and repository Your actual repository owner and name
    Workflow filename publish.yml
    Environment name pypi
  3. Push a release tag. GitHub Actions will run the tests and publish the package.

Adding the workflow does not register a Trusted Publisher in your PyPI account. Published PyPI versions cannot be overwritten; create a new tag for each subsequent release. See the Trusted Publishing documentation for details.

Metadata

Release files for tailmeta 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tailmeta 0.1.0
File Size Uploaded Provenance Actions
tailmeta-0.1.0.tar.gz 18.9 kB With provenance Details for tailmeta-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tailmeta 0.1.0
File Interpreter ABI Platform Actions
tailmeta-0.1.0-py3-none-any.whl Python 3 none any Details for tailmeta-0.1.0-py3-none-any.whl

Total release size: 29.1 kB

Release files / tailmeta-0.1.0.tar.gz

Download URL tailmeta-0.1.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
47f511cf302b54089a791be9cbd79d8a4af0a52749544c4fb2125f28b239dcb1
BLAKE2b-256 checksum
How to use checksums
74a0862467875e99a8a5de3d1e12c4b0a494200b63025c97d9c930538a143147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / tailmeta-0.1.0-py3-none-any.whl

Download URL tailmeta-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d11aa0d47b79ea3412a9b81f938ea66ab6db40b2661d472b9a64a3f21f0c24c6
BLAKE2b-256 checksum
How to use checksums
9586cbe7196eb323797733dd3afdf7f3f91b9580398da39172f31966a6a086eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for tailmeta 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tailmeta-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page