Skip to main content

tess-utils

Shared converters for the Tesserae projects (tess-shell, Tesserae UI). It is on PyPI as tesserae-utils (the repository is tess-utils), and its converters have no dependencies (only decode_image needs Pillow, see below): tre stays a rendering engine with one entry form, and the forms a TDL file writes (colours, four-sided values, corner radii, enum words) are turned into that form here, once.

Import name tess_utils. Python 3.14 or later. MIT.

from tess_utils import expand_radius, expand_sides, parse_color, to_tre_order, to_tre_word

parse_color("#89b4fa80")                 # (137, 180, 250, 128)
to_tre_order(expand_sides({"Left": 24})) # (0.0, 0.0, 0.0, 24.0)
expand_radius([0, 0, 8, 8])              # (0.0, 0.0, 8.0, 8.0)
to_tre_word("SPACE_BETWEEN")             # "space_between"

decode_image(data, max_side=4096) turns the bytes of a PNG, JPEG, GIF or WebP file into (width, height, rgba) (straight-alpha RGBA8, top row first: tre's image node). Pillow is imported inside the function, so import tess_utils never loads it, and it is not in the compiled file: the caller installs it (pip install tesserae-utils[image], Pillow>=11). A side over max_side is refused from the header, before any pixel is decoded; every failure is a ValueError.

What belongs here

A function is added when at least two projects use it, it is a few lines of our own code (a mapped library only for work that would be a project of its own, ADR-0019), it imports no Tesserae package, it has no dependency and no UI or schema meaning, and it has tests. Schema, typing and UI meaning stay in the projects.

Development

UV_PROJECT_ENVIRONMENT=~/Projects/pyDev/pyEnvs/tess-utils uv sync
uv run ruff check src tests && uv run mypy && uv run pytest -q

Versions are git tags (v0.1.0) and CHANGELOG.md. A release is published to PyPI as tesserae-utils by .github/workflows/release.yml (Trusted Publishing, on a vX.Y.Z tag, with an approval in the pypi environment). Separately, the Tesserae consumers carry a compiled copy (maintainer, 2026-11-08): one .so (mypyc), a file on a GitHub release, which each consumer downloads, checks against its SHA-256 and carries in _vendor/ with a stamp. See tools/build_so.py.

The sync script that copies a release into a consumer (vendor.json manifest plus a short script in each consumer, the vault's recommendation C) is not written yet: it is open question 3 of the tess-utils Brief, and the first consumer, tess-shell, writes it when it takes the file. The build tool's stamp (build/so/tess_utils.stamp.json: version, Python tag, platform, SHA-256) is what that script checks.

A compiled file raises TypeError for a wrongly typed argument, which the source would not, so the public functions take object and validate: the source and the .so raise the same ValueError (the tests run against both: uv run python tools/build_so.py --test).

Metadata

Release files for tesserae-utils 0.2.1

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

Source distribution (sdist)

Source distribution for tesserae-utils 0.2.1
File Size Uploaded Provenance Actions
tesserae_utils-0.2.1.tar.gz 81.7 kB With provenance Details for tesserae_utils-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tesserae-utils 0.2.1
File Interpreter ABI Platform Actions
tesserae_utils-0.2.1-py3-none-any.whl Python 3 none any Details for tesserae_utils-0.2.1-py3-none-any.whl

Total release size: 91.3 kB

Release files / tesserae_utils-0.2.1.tar.gz

Download URL tesserae_utils-0.2.1.tar.gz
Size 81.7 kB
Tags Source
SHA-256 checksum
How to use checksums
80972ff3d3a0481c09e0d916e521b4311b802e8d243a30c15b9918969d419123
BLAKE2b-256 checksum
How to use checksums
22647aae61373067073f148b988873b5e075bf3c565a757f2261a44ae04100a4
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 15, 2026.

Transparency log

Release files / tesserae_utils-0.2.1-py3-none-any.whl

Download URL tesserae_utils-0.2.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3ffcdb78a5102219bd14136f2d6469c1d953818e93082e170e190a368f27f44
BLAKE2b-256 checksum
How to use checksums
09617ea8686c07457063bf574a10c96ae471cdeac9910dcaf470152d8c110af3
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 15, 2026.

Transparency log

Security for tesserae-utils 0.2.1

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 tesserae_utils-0.2.1.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 15, 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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

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