Repository navigation
refactor(api)!: the top level holds what you call, and spec, program and errors hold what you get back or catch - #837
Merged
Conversation
…nd errors hold what you get back or catch `Spec` and its blocks move to `mathspec.spec`, `Advice` and `AdviceKind` to `mathspec.program`, `BUILTIN_NAMES` to `mathspec.spec`, and the error tree and `did_you_mean` to `mathspec.errors`. `FORMATS` leaves the top level for `FormatName`. `tests/test_public_surface.py` holds each module to its rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ew8pe1gYVe8MS1ywtF8qUg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ew8pe1gYVe8MS1ywtF8qUg
Documentation build overview
62 files changed ·
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ew8pe1gYVe8MS1ywtF8qUg
Contributor
Author
|
@FabianHofmann We didn't talk about this yet. I think it really cleans up things, but we should discuss it before merging it. |
The mask blocks join mathspec.spec, test_masks imports LanguageError from mathspec.errors and FORMATS from mathspec.typesetting.
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
The following content was generated by AI.
The top level now holds only what you call. Types move to
mathspec.specandmathspec.program, and errors move tomathspec.errors.tests/test_public_surface.pyholds each module to its rule. This is a breaking change for imports.What moved, what stayed, and why
mathspecto_spec,merge,override,advice,typeset,typeset_declaration,to_latex,to_typst,to_markdown, plusSymbolTableandFormatName, which you build or name to pass inmathspec.specSpec, its 21 block classes (the mask blocks frommainincluded),Formulation,Curvature,BUILTIN_NAMESmathspec.programAdviceandAdviceKind(now defined there)mathspec.errorsMathSpecError,LanguageError,SchemaError,DimensionError,did_you_meanThe top level goes from 21 names to 14, and 3 of those are the modules.
FORMATSleft the top level forFormatName.mathspec.typesmodule.programalready is the module for what mathspec gives back. A second such module would draw a line betweenSpecandProgramthat a caller cannot predict.Specdoes not go intoprogram.spec.pyimportsprogram, soprogramcannot re-exportSpecwithout an import cycle.BUILTIN_NAMESgoes tospec, notprogram. It is the set of operators a file may write. AProgramholds no builtin calls.Specalready handed them out through its fields, but no__all__named them.Nothing in
programwas removed. I checked what specsolve uses:parameters_of(4 files undersrc/) andis_quadratic,walk,assumption_message(alsosrc/).variables_of,carries_variableandchildren, used by the linopy reference lane undertests/.where_childrenandwalk_regionshave no use in specsolve, butreading.mddocuments them as the traversal API.Kept on request:
to_latex,to_typstandto_markdown.Not done:
Specdocstring still names three constructors (to_spec,model_validateandSpec(...)).mathspec==0.2.1, so it moves when this is released. That needs a minor version bump.<type>/<topic>worktree.Docs:
api.mdlists the top level anderrors.spec.mdpage, the Spec API, next to the Program API page.what-counts-as-public-api.md.Spec.*links now point atspec.md.Gates
Merged
origin/main(1d8ff20: #810, #849, #850) at cbb0614. Conflicts:CHANGELOG.md(both kept) and an import line intests/test_composition.py. Schema, golden output and the generated pages were regenerated and gave no further diff. The newMissing,MissingReading,RelationMissingandVariableMissingstay inprogram.__all__.pixi run lint: clean.pixi run ci: clean (2839 passed, 1 skipped; docs-build strict, compile-tex of 54 documents).Mutation table for the new guards
Each change below was made by hand on the committed tree. I then ran
tests/test_public_surface.pyandtests/test_docs.py, and restored withgit checkout --, removing__pycache__on both sides. The tree was clean after every probe.Specback at the top level, withSURFACEupdated to matchtest_the_top_level_is_what_a_consumer_calls,test_every_name_the_package_exports_has_an_entry_on_an_api_pagespec.pythat is not exportedtest_the_spec_module_exports_every_class_it_definesspecre-exportsdid_you_meanwithout a pintest_the_spec_module_exports_every_class_it_defineserrors.pythat is not exportedtest_the_errors_module_exports_the_error_treeerrorsexports a helper besidesdid_you_meantest_the_errors_module_exports_the_error_treetypesetting, with both pins updatedtest_the_top_level_is_what_a_consumer_calls,test_every_name_the_package_exports_has_an_entry_on_an_api_page🤖 Generated with Claude Code
https://claude.ai/code/session_01Ew8pe1gYVe8MS1ywtF8qUg