Skip to main content

sutl-py

sutl-py is the dependency-free Python implementation of sUTL 1.0, the sUTL Universal Transform Language (“subtle”). sUTL programs are JSON-compatible values that transform maps, lists, strings, numbers, booleans, and null.

The normative language specification and conformance corpus live in sutl-language.

Install

python -m pip install sutl-py

Python 3.9 or later is required.

Python API

from sutl import Runner, compilelib, evaluate, truthy

result = evaluate(
    {"person": {"name": "Ada"}},
    {"name": "^$.person.name"},
)
assert result == {"name": "Ada"}

evaluate(source, transform, library=None) creates a runner for one evaluation. Reuse Runner().evaluate(...) when making repeated calls. compile_limited(transform, library, limits) and program.run(source) apply host limits (max_steps, max_depth, and an optional cancel callable). A result inside the budget is unchanged. Exceeding a limit raises LimitError. compilelib(...) resolves declaration requirements into a transform library. truthy(value) exposes sUTL truthiness.

The public API is typed and the distribution includes py.typed.

Command line

The sutl command accepts JSON literals directly:

sutl '{"value":4}' '["&+","^$.value",1]'
5

Prefix an argument with @ to read JSON from a UTF-8 file. Use - as the source to read it from standard input:

sutl @source.json @transform.json --library @library.json --pretty

python -m sutl provides the same interface.

Development

python -m pip install -e ".[test,build]"
python -m pytest
python -m build
python -m twine check dist/*

The tests vendor the exact sUTL 1.0 contract, all 88 conformance cases, and all 44 Studio fixtures. They also verify the corpus SHA-256 checksum pinned by the contract.

License

Apache-2.0.

Metadata

Release files for sutl-py 1.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 sutl-py 1.1.0
File Size Uploaded Provenance Actions
sutl_py-1.1.0.tar.gz 330.8 kB Without provenance Details for sutl_py-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sutl-py 1.1.0
File Interpreter ABI Platform Actions
sutl_py-1.1.0-py3-none-any.whl Python 3 none any Details for sutl_py-1.1.0-py3-none-any.whl

Total release size: 344.8 kB

Release files / sutl_py-1.1.0.tar.gz

Download URL sutl_py-1.1.0.tar.gz
Size 330.8 kB
Tags Source
SHA-256 checksum
How to use checksums
282872e2a9b849c396f475a688c4a7b2fd512f74650802f41cb31f7e761ad649
BLAKE2b-256 checksum
How to use checksums
ac75251379e2c1fd0b188ecb4f1d49286030c72563a9538f28626d18a691b4ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / sutl_py-1.1.0-py3-none-any.whl

Download URL sutl_py-1.1.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c77e273eb2fbe2837d077433603c0fcb379ab1fe20f84c2f630136dda84f8c6
BLAKE2b-256 checksum
How to use checksums
8b4c0d0f327714c222e364a60e0e88ecd2bced24e01f25bcda564a421e892677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for sutl-py 1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

1.1.0 This release

2 release files No 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