MathViz
A domain-specific language for mathematical animations
Website • Features • Installation • Quick Start • Editor • Contributing
MathViz is a modern programming language designed specifically for creating mathematical animations. It extends Python with a clean, math-first syntax and compiles to pure Python with first-class Manim integration.
Features
- Unicode Math Operators — Write math naturally:
∈,⊆,∪,∩,∞,π,≤,≥,≠ - Clean Syntax — Modern block syntax with
let,fn,scene, and pattern matching - Manim Integration — First-class support for creating mathematical animations
- Static Analysis — Built-in
check,analyze,typecheck,lint, andfmtcommands - Module System — Multi-file projects with
useimports - Desktop Editor — Cross-platform editor with live preview (Tauri + React)
- Fast Iteration — REPL mode and file watcher for rapid development
Installation
Using pipx (Recommended)
pipx install git+https://github.com/CyberSnakeH/MathViz.git
Using uv
git clone https://github.com/CyberSnakeH/MathViz.git
cd MathViz
uv sync --dev
Using pip
git clone https://github.com/CyberSnakeH/MathViz.git
cd MathViz
pip install -e ".[dev]"
Prerequisites
Quick Start
Hello World
Create a file hello.mviz:
fn main() {
println("Hello, MathViz!")
}
Run it:
mathviz exec hello.mviz
Your First Animation
Create animation.mviz:
from manim import Circle, Create, FadeOut
scene CircleAnimation {
fn construct(self) {
let circle = Circle()
circle.set_color(BLUE)
self.play(Create(circle))
self.wait(1)
self.play(FadeOut(circle))
}
}
Run with preview:
mathviz run animation.mviz --preview
Language Features
// Variables with type inference
let x = 42
let name = "MathViz"
let pi = 3.14159
// Functions with type annotations
fn add(a: int, b: int) -> int {
return a + b
}
// Pattern matching
let result = match x {
0 -> "zero"
1 -> "one"
_ -> "other"
}
// For loops with ranges
for i in 0..10 {
println(i)
}
// List comprehensions
let squares = [x^2 for x in 1..=10]
// Unicode math
let is_member = 5 ∈ {1, 2, 3, 4, 5}
let union = {1, 2} ∪ {3, 4}
CLI Reference
# Compile to Python
mathviz compile file.mviz -o output.py
# Run with Manim (animations)
mathviz run file.mviz --preview
# Execute script (no Manim)
mathviz exec file.mviz
# Static analysis
mathviz check file.mviz # Syntax check
mathviz typecheck file.mviz # Type check
mathviz analyze file.mviz # Full analysis
mathviz lint file.mviz # Linter
# Formatting
mathviz fmt file.mviz
# Development
mathviz watch src/ # Watch mode
mathviz repl # Interactive REPL
# Project management
mathviz new my-project # Create new project
mathviz build # Build project
mathviz test # Run tests
Editor
MathViz includes a cross-platform desktop editor built with Tauri and React.
Features
- Syntax highlighting for
.mvizfiles - Live animation preview
- Integrated terminal
- File explorer
- Command palette (
Ctrl+P)
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
F5 |
Run with Manim |
F6 |
Execute script |
F8 |
Compile only |
Ctrl+S |
Save |
Ctrl+P |
Command palette |
Ctrl+B |
Toggle sidebar |
Ctrl+J |
Toggle terminal |
Running the Editor
cd editor
npm install
npm run tauri dev
Building
npm run tauri build
Binaries will be in editor/src-tauri/target/release/bundle/.
Project Structure
MathViz/
├── src/mathviz/ # Compiler and runtime
│ ├── compiler/ # Lexer, parser, codegen
│ ├── utils/ # Errors, diagnostics
│ └── cli.py # CLI entry point
├── editor/ # Desktop editor (Tauri)
│ ├── src/ # React frontend
│ └── src-tauri/ # Rust backend
├── examples/ # Example programs
├── tests/ # Test suite
└── docs/ # Documentation
Examples
Explore the examples/ directory:
hello_world.mviz— Basic syntaxcircle_animation.mviz— Simple animationset_operations.mviz— Unicode mathvenn_diagram.mviz— Complex animationmultimodule/— Multi-file project
Development
Running Tests
uv run pytest
Code Quality
# Format
uv run ruff format src tests
# Lint
uv run ruff check src tests
# Type check
uv run mypy src
Language Server
pip install -e ".[lsp]"
mathviz-lsp
Contributing
Contributions are welcome! Please read our Contributing Guide for details on:
- Development environment setup
- Code style and conventions
- Commit message guidelines
- Testing requirements
- Pull request process
Quick start:
# Fork and clone
git clone https://github.com/CyberSnakeH/MathViz.git
cd MathViz
# Create a branch
git checkout -b feature/my-feature
# Make changes, then submit a PR
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Manim Community — The animation engine
- Tauri — Desktop app framework
- Monaco Editor — Code editor
Made with ❤️ by CyberSnakeH
Metadata
Release files for mathviz 0.1.7
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 | Actions |
|---|---|---|---|---|
| mathviz-0.1.7.tar.gz | 969.2 kB | Without provenance | Details for mathviz-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mathviz-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for mathviz-0.1.7-py3-none-any.whl |
Total release size: 1.3 MB
Release files / mathviz-0.1.7.tar.gz
| Download URL | mathviz-0.1.7.tar.gz |
|---|---|
| Size | 969.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57424c7a8753b9320b973e1e00157fe35cc89e9b039fdd9795e966393a4a66bf
|
|
BLAKE2b-256 checksum How to use checksums |
bc589175791a1d5dfeaa4a02c4c73b2a50318cdb3567921d4a73fc0649e83abe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / mathviz-0.1.7-py3-none-any.whl
| Download URL | mathviz-0.1.7-py3-none-any.whl |
|---|---|
| Size | 304.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
798cba457e800adb9745f389dde1566c83d9a76a6a8885502debd53988fb0d65
|
|
BLAKE2b-256 checksum How to use checksums |
457c096f4b39db00759185bbbbe4ed31a7305e5ce0bf38c68c079334ef0e5854
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for mathviz 0.1.7
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.