Stixis
Stixis (stixis) is a spec-driven, zero-dependency CSS serializer and validator for Python 3.14+ that generates its grammar tables and TypedDict definitions from W3C @webref/css (ed/css/*.json) and its conformance test suites from Web Platform Tests (WPT) and Hypothesis.
Highlights
- 100%
@webref/cssproperty & descriptor coverage: Compiles W3C Value Definition Syntax (|,||,&&, juxtaposition,?,*,+,#,{A,B},[...]!,<type [min,max]>,<'prop'>) into a dual-modeValueNodeevaluator that serializes structured Python objects (serialize_value) and canonicalizes raw CSS token streams (canonicalize). - Eagerly validated immutable AST nodes:
FontFace,StyleRule,AtRule,StyleSheet,CommentNode, andRawDeclaration(dataclass(frozen=True, slots=True)) validate selectors, preludes, descriptors, and declarations inside__post_init__. - First-class Python 3.14+ PEP 750
Template(t"...") support: Separates static CSS syntax from dynamicInterpolationslots, applying context-aware escaping inside comments (/* ... */), strings,url(...), and numeric slots before validating the resulting token stream against theValueNodegrammar. - Five built-in CSS microsyntaxes:
<urange>(parse_urange,format_urange, andbisect-based cascade-shadowing range compactioncompact_urange).<opentype-tag>(font-feature-settings,font-variation-settings,font-language-override).<font-src-list>(FontSrc,Url,LocalFontwithformat()->tech()ordering and keyword validation).<family-name>&<generic-family>(safe default quoting of Pythonstrfamily names, explicitgeneric("serif")/Keyword("serif"), and WPTfont-family-serialization-001.htmlconformance).{1,2}descriptor and property ranges (font-weight,font-width/font-stretch,font-style: oblique, metric overrides).
- Agent-first read-only CLI:
stixis inspectandstixis checkwith deterministic exit codes (0valid,1invalid value,2usage error,4unknown target).
Quickstart
from stixis import (
Deg,
FontFace,
FontSrc,
Pct,
Px,
SerializationOptions,
StyleRule,
StyleSheet,
compact_urange,
dumps,
generic,
)
if __name__ == "__main__":
woff2_url = "https://example.com/fonts/noto-sans-jp-slice0.woff2"
slice_id = "kana"
size_kb = 18.4
urange = compact_urange(
sorted_target_cps=[0x3000, 0x3041, 0x3042, 0x3044],
forbidden_sorted=[0x3043],
max_gap=0x80,
)
sheet = StyleSheet(
header_comment="Generated by Stixis",
rules=[
FontFace(
comment=t"Slice [{slice_id}] ({size_kb:.1f} KB)",
font_family="Noto Sans JP",
font_style=("oblique", Deg(-10), Deg(20)),
font_weight=(100, 900),
font_width=(Pct(75), Pct(125)),
font_display="swap",
src=t"url({woff2_url}) format(woff2) tech(variations)",
unicode_range=urange,
),
StyleRule(
"body",
{
"font_family": ["Noto Sans JP", generic("sans-serif")],
"font_feature_settings": {"liga": True, "dlig": False},
"margin": Px(0),
},
),
],
)
print(dumps(sheet))
print(dumps(sheet, options=SerializationOptions.cleome()))
CLI Usage
# Inspect an at-rule, property, or <type>
uv run stixis inspect @font-face
uv run stixis inspect font-style --json
uv run stixis inspect "<font-src>"
# Validate and canonicalize CSS values
uv run stixis check font-weight "100 900" --at-rule @font-face
uv run stixis check unicode-range "u+3040-309f" --at-rule @font-face
Development & Verification
uv sync
uv run python codegen/gen_specs.py --check
uv run python codegen/gen_wpt_tests.py --check
uv run pytest
uv run ruff check
Metadata
Release files for stixis 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| stixis-0.1.1.tar.gz | 139.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stixis-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 223.7 kB
Release files / stixis-0.1.1.tar.gz
| Download URL | stixis-0.1.1.tar.gz |
|---|---|
| Size | 139.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da78d4526353cc095ca89c02147727c29d8f80ba9c4bc79f439d5a9230b90004
|
|
BLAKE2b-256 checksum How to use checksums |
d220da337d6408448417995f3a2bc3f3f54f5309f4dbc11eb356fe39747d0591
|
| 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 Oct 25, 2026.
Transparency logRelease files / stixis-0.1.1-py3-none-any.whl
| Download URL | stixis-0.1.1-py3-none-any.whl |
|---|---|
| Size | 84.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1848561b35f76f8b132a203bc68c06527f588c16a50c9dc6cad9dce40ec94d8b
|
|
BLAKE2b-256 checksum How to use checksums |
3905478097636f0a026a5adaa0725eb11e57211512cafafbfc4ec0f2564ab679
|
| 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 Oct 25, 2026.
Transparency logSecurity for stixis 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for stixis-0.1.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 Oct 25, 2026.
Transparency logA 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.