Repository navigation
v0.2.0
This release migrates every quivers value type onto didactic Models, delegates .qvr parsing to panproto via a new in-tree tree-sitter grammar, lifts every compiled program to a panproto Schema, and ships a formal denotational semantics for the DSL.
Highlights
- Every record-shaped value type is a
dx.Model. AST nodes (38 classes),Token, the 5-variantCategoryunion,RuleSystem,FinSet/ProductSet/CoproductSet/FreeMonoid,Euclidean/Simplex/PositiveReals/ProductSpace/UnitInterval, andDiagram. Recursive sums (TypeExpr,CatPattern,SpaceExpr,Expr,LetExprNode,ProgramStep,Statement) aredx.TaggedUnionroots discriminated bykind: Literal[...]. JSON round-trips viamodel_dump_json/model_validate_jsonare now uniformly available. - QVR has a tree-sitter grammar.
grammars/qvr/ships the grammar source and generated artefacts; it is registered inpanproto-grammars-alland consumed at runtime byquivers.dsl.parser. The hand-written lexer and recursive-descent parser are removed. - Resolution is a
dx.Lensfamily.quivers.dsl.resolutionexposesTypeExprToSetObject(env)andSpaceExprToContinuousSpace(env_spaces, env_objects, name)asdx.Lensinstances. The resolution environment is carried on the lens instance — the dependent-optics shape — and the GetPut / PutGet round-trip laws hold by construction. - Programs are panproto schemas.
quivers.dsl.program_theorydefinesQVR_PROGRAM_PROTOCOL(a panproto protocol enumerating everySetObject/ContinuousSpacevariant plus the QVR declaration variants) andextract_program_schema, which walks a compiled environment and emits apanproto.Schema.panproto schema diff,panproto lens generate, and the rest of the panproto toolbox now apply to.qvrprograms out of the box. - Cross-field axioms on
RuleSystem.binary_weights/unary_weightslengths must matchbinary_rules/unary_ruleswhen supplied, enforced via__axioms__. - Formal denotational semantics. New documentation section under
docs/semantics/gives a compositional semantics for the DSL across the discrete, stochastic, and continuous strata: setting and notation, quantales and base change, types and spaces, morphisms, expressions, programs (Giry-monadic), the grammar fragment (categorial grammars + chart parsers), the program theory, and an adequacy theorem connecting the compiler implementation to the denotation.
Breaking changes
- Python 3.14+ required (was 3.13).
- Variadic constructors removed.
ProductSet(A, B, C)→ProductSet(components=(A, B, C)). Same forCoproductSet. The flattening converter preserves prior behaviour: nested products / coproducts collapse on construction. - Public field names on continuous spaces.
Euclidean(_name=..., _dim=...)→Euclidean(name=..., dim=...). Same forSimplex,PositiveReals,ProductSpace,UnitInterval. LexErrorremoved. Lexical errors now surface asParseError(tree-sitter integrates lexing with parsing).quivers.dsl.lexerandquivers.dsl.tokensremoved. Usequivers.dsl.parserdirectly;from quivers.dsl import parse, parse_file, loads, load.
Pre-1.0 policy: clean breaking changes, no compat shims.
Dependencies
torch >= 2.0didactic >= 0.6.0panproto >= 0.45.0panproto-grammars-all >= 0.45.0
Infrastructure
- Release workflow at
.github/workflows/release.ymlbuilds an sdist + wheel onv*tag push and publishes to PyPI via the FACTSlab/quivers OIDC trusted publisher (no API tokens). - Pull request template at
.github/PULL_REQUEST_TEMPLATE.md. - Issue templates at
.github/ISSUE_TEMPLATE/{bug_report,feature_request,config}.yml. - Pyright configuration in
pyproject.tomlsuppresses upstream torch typing noise (reportPrivateImportUsage) and demotes didactic-FieldValue-widening symptoms to warnings.
Issues filed upstream during the migration
- panproto/panproto#86 — anonymous-token field-value access in tree-sitter grammars.
- panproto/didactic#30 — union of TaggedUnion roots (fixed in 0.6.0).
- panproto/didactic#31 —
axiomnull literal + class-level validators (fixed in 0.6.0). - panproto/didactic#33 — V-enriched / quantale lenses (open;
enriched/optics.pykeeps its bespoke optic hierarchy until this lands).
Test surface
- 940 tests pass; 0 xfail; 0 errors.
- New test files:
tests/test_resolution_lenses.py(49 lens tests),tests/test_program_theory.py(36 schema-extraction tests),tests/test_model_roundtrips.py(57 JSON round-trip cases for every migrateddx.Model). - Tree-sitter fixtures under
grammars/qvr/test/corpus/cover every example insrc/quivers/dsl/examples/.
Documentation
Links
- Pull request: #1
- Full diff: v0.1.0...v0.2.0
- PyPI: https://pypi.org/project/quivers/0.2.0/