Installation#
Not published yet
math-spec is on the alpha stream, and nothing is published yet. The commands below are what the first release will look like. Until then, install from a checkout or a git reference.
math-spec needs Python 3.12 or above. Install it into a dedicated
environment:
To develop against a clone instead:
git clone https://github.com/energy-models/math-spec
cd math-spec
pixi run pre-commit-install
pixi run test
Contributing has the rest.
Editor completion and offline checking#
The YAML keys ship as a JSON Schema,
schema/math-spec.schema.json.
An editor reads it for key completion, and a job with no Python reads it for a
structure check.
Map the schema in VS Code#
Install the Red Hat YAML extension, then map the schema per workspace:
// .vscode/settings.json
"yaml.schemas": { "https://raw.githubusercontent.com/energy-models/math-spec/main/schema/math-spec.schema.json": ["*.model.yaml"] }
or per file, with a modeline on its first line:
# yaml-language-server: $schema=https://raw.githubusercontent.com/energy-models/math-spec/main/schema/math-spec.schema.json
Check a file without Python#
For a pre-commit hook or a non-Python CI job:
uvx check-jsonschema --schemafile https://raw.githubusercontent.com/energy-models/math-spec/main/schema/math-spec.schema.json model.yaml
The schema validates structure only. The math inside expression: and
where: is checked by to_spec.