DSL + Manim + Python

Write Math.
Animate It.

MathViz is a modern domain-specific language designed for mathematical animations. Write clean, expressive code that compiles to Python and integrates seamlessly with Manim.

.mviz
File Extension
Python
Compiles To
Desktop
Editor Available
circle_animation.mviz
// Create an animated circle scene
scene CircleAnimation {
    fn construct(self) {
        let circle = Circle(radius: 2.0)
        circle.set_color(BLUE)

        let label = MathTex("A = \\pi r^2")
        label.next_to(circle, DOWN)

        play(Create(circle))
        play(Write(label))
        wait(2.0)

        play(circle.animate.scale(1.5))
        play(FadeOut(circle, label))
    }
}

fn main() {
    println("MathViz Animation Ready!")
}
Features

Why MathViz?

A production-ready language designed for clarity, performance, and seamless integration with the Python ecosystem.

Math-First Syntax

Unicode operators, set operations, and mathematical notation built into the language. Write code that reads like math.

let A = {1, 2, 3} ∪ {3, 4, 5}

Compiles to Python

Generated Python code is clean and readable. Full interoperability with the entire Python ecosystem.

mathviz compile file.mviz -o output.py

Manim Integration

Scene blocks compile directly to Manim classes. Create beautiful animations with a clean, declarative syntax.

scene MyAnimation { ... }

Complete Tooling

Type checking, linting, formatting, analysis, and watch mode. Everything you need to develop efficiently.

mathviz watch src/

Module System

Organize code with modules. Use pub for exports, use for imports. Clean architecture for any project size.

use geometry.distance

Desktop Editor

Native desktop editor built with Tauri and Monaco. Syntax highlighting, preview, and integrated tooling.

Win / macOS / Linux

VS Code Extension

Full syntax highlighting, 18 code snippets, bracket matching, and Tokyo Night theme support for VS Code.

.mviz / .mvz

Auto-Update

Built-in update detection checks PyPI automatically. Get notified of new versions without leaving the terminal.

pipx upgrade mathviz

Quick Installation

Install MathViz with a single command. Use pipx for isolated installation or uv for development.

File Extension

MathViz source files use the .mviz extension.

pipx Recommended
pipx install mathviz
pip
pip install mathviz
uv (Development)
git clone https://github.com/CyberSnakeH/MathViz.git && cd MathViz && uv sync --dev
Verify Installation
mathviz --version
Run an Example
mathviz run examples/hello_world.mviz
Editor

MathViz Desktop Editor

A native desktop editor with syntax highlighting, live preview, and integrated tooling.

Source Code
use geometry

fn main() {
    let d = geometry.distance(0, 0, 3, 4)
    println("Distance: {}", d)

    let area = PI * 5.0 ^ 2
    println("Circle area: {}", area)
}

@njit(parallel=true)
fn compute_sum(arr: List[Float]) -> Float {
    let total = 0.0
    for x in arr {
        total += x * x
    }
    return total
}
Compiled Output
import numpy as np
from numba import njit, prange

def main():
    d = geometry_distance(0, 0, 3, 4)
    print(f"Distance: {d}")

    area = np.pi * 5.0 ** 2
    print(f"Circle area: {area}")

@njit(parallel=True, cache=True)
def compute_sum(arr):
    total = 0.0
    for x in prange(len(arr)):
        total += arr[x] * arr[x]
    return total
CLI

Powerful Command Line

Everything you need to compile, run, analyze, and format your MathViz code.

Compile
mathviz compile animation.mviz -o output.py
Run with Manim
mathviz run animation.mviz -q h --preview
Type Check
mathviz typecheck src/*.mviz --strict
Format
mathviz fmt src/ --write
Analyze
mathviz analyze src/main.mviz --json
Watch Mode
mathviz watch src/ -o build/