{"id":42774929,"url":"https://github.com/apiad/tesserax","last_synced_at":"2026-07-02T15:01:12.441Z","repository":{"id":335356930,"uuid":"1145450746","full_name":"apiad/tesserax","owner":"apiad","description":"A Pythonic library for scientific visualization in SVG","archived":false,"fork":false,"pushed_at":"2026-03-30T15:53:10.000Z","size":8827,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-30T17:39:27.983Z","etag":null,"topics":["animation-engine","scalable-vector-graphics","scientific-visualization"],"latest_commit_sha":null,"homepage":"https://apiad.github.io/tesserax/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apiad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-29T20:21:10.000Z","updated_at":"2026-03-30T15:52:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/apiad/tesserax","commit_stats":null,"previous_names":["apiad/tesserax"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/apiad/tesserax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiad%2Ftesserax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiad%2Ftesserax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiad%2Ftesserax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiad%2Ftesserax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apiad","download_url":"https://codeload.github.com/apiad/tesserax/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiad%2Ftesserax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35051884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation-engine","scalable-vector-graphics","scientific-visualization"],"created_at":"2026-01-29T22:05:01.546Z","updated_at":"2026-07-02T15:01:12.428Z","avatar_url":"https://github.com/apiad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tesserax: A Lightweight SVG Rendering Library\n\n[![PyPI version](https://img.shields.io/pypi/v/tesserax.svg)](https://pypi.org/project/tesserax/)\n[![Python versions](https://img.shields.io/pypi/pyversions/tesserax.svg)](https://pypi.org/project/tesserax/)\n[![Tests](https://github.com/apiad/tesserax/actions/workflows/tests.yaml/badge.svg)](https://github.com/apiad/tesserax/actions/workflows/tests.yaml)\n[![Coverage](https://img.shields.io/badge/coverage-90%25-brightgreen)](#)\n[![Downloads](https://pepy.tech/badge/tesserax)](https://pepy.tech/project/tesserax)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTesserax is a modern Python 3.12 library designed for programmatic SVG generation with a focus on ease of use, layout management, and flexible geometric primitives. It is particularly well-suited for visualizing data structures, algorithms, and technical diagrams.\n\nBeyond static diagrams, Tesserax now includes a **deterministic physics engine** and a **cinematic animation system**, making it a complete toolkit for scientific communication.\n\n## Key Features\n\n* **Rich Primitives**: Includes standard shapes (`Rect`, `Circle`) plus advanced procedural geometry like `Polyline` with smoothing and subdivision support.\n* **Declarative Layouts**: Effortlessly arrange shapes in `Row`, `Column`, or `Grid` containers, or use algorithmic layouts like `Tree` and `Force`.\n* **Smart Canvas**: Automatically fit the canvas viewport to the content with adjustable padding.\n* **Anchor System**: Connect shapes using semantic anchors like `top`, `bottom`, `left`, `right`, and `center`.\n* **Cinematic Animations**: Create complex motion graphics using a declarative, code-first API that supports keyframes, morphing, and warping.\n* **Physics Simulation**: Bake high-precision rigid body simulations directly into your animations using the built-in `World` and `Body` primitives.\n* **Reactive Statistical Visualization**: Build data-driven graphics with an Altair-inspired API that supports automatic axis generation and seamless **Enter-Update-Exit** animations.\n* **Rock-Solid Reliability**: 90% test coverage ensuring predictable behavior across all geometric, layout, and animation systems.\n\n## Installation\n\nTesserax has zero dependencies (literally). It's 100% pure Python, and can be easily installed with `pip`:\n\n```bash\npip install tesserax\n```\n\nOr if you're one of the cool kids, using `uv`:\n\n```bash\nuv add tesserax\n```\n\nIf you want support for saving PNG files, install with the `export` extra:\n\n```bash\npip install tesserax[export]\n```\n\n## Quick Start\n\nThe following example demonstrates how to create a simple logo and highlights the most basic functionality of **Tesserax**.\n\n```python\nimport math\nfrom tesserax import Canvas, Square, Circle, Text, Polyline, Point, Group\nfrom tesserax.layout import RowLayout\n\nwith Canvas() as canvas:\n    # We use a top-level row layout\n    with RowLayout(align=\"end\") as logo:\n        # Left Block\n        r = Square(30, fill=\"green\", stroke=\"none\")\n\n        # Center Text\n        t = Text(\n            \"tesserax\",\n            size=48,\n            font=\"sans-serif\",\n            fill=\"navyblue\",\n            anchor=\"middle\",\n            baseline=\"bottom\",\n        )\n\n        # Right Circle\n        c = Circle(20, fill=\"red\", stroke=\"none\")\n\n    # Create the \"Squiggly\" Underline\n    Polyline(\n        [\n            r.anchor(\"bottom\").dy(10),\n            c.anchor(\"bottom\").dy(10),\n        ],\n        smoothness=1.0,\n        stroke=\"black\",\n        marker_end=\"arrow\",\n    ).subdivide(5).apply(\n        lambda p: p.dy(math.sin((p.x / logo.bounds().width * 20 + 5)) * 5)\n    )\n\n# Use fit() to frame the logo perfectly\ncanvas.fit(padding=10).display()\n```\n\n![](example.svg)\n\n\nThe `display()` method in the `Canvas` class is an IPython/Jupyter/Quarto compatible  shortcut to automatically include the rendered SVG (in all its beautiful vectorial glory) directly in a notebook. But you can also use `Canvas.save()` to generate a plain old, boring SVG file on this, and `str(canvas)` to get the actual SVG code as a plain string.\n\n## Deep Dive: Beyond the Basics\n\nTesserax scales from simple scripts to complex simulations. Here is an overview of the advanced capabilities available.\n\n### Geometric Primitives \u0026 Procedural Shapes\n\nTesserax provides a robust suite of atoms like `Rect`, `Circle`, `Ellipse`, and `Arrow`.\n\n* **Polyline API**: The `Polyline` class supports `smoothing` (Bezier interpolation), `subdivision` (increasing resolution), and `simplification` (reducing vertices).\n* **Path API**: For low-level control, use the `Path` class with standard SVG commands (`move_to`, `cubic_to`, `arc`).\n\n### The Layout Engine\n\nForget manual pixel pushing. Tesserax offers a hierarchy of layout engines:\n\n* **Standard Layouts**: `Row`, `Column`, and `Grid` automatically position elements based on gaps and alignment.\n* **Hierarchical Layout**: Automatically draws Trees and Directed Acyclic Graphs (DAGs).\n* **Force-Directed Layout**: Simulates physical forces to arrange arbitrary network graphs.\n\n### Cinematic Animation\n\nThe animation system is designed for **storytelling**, not just movement.\n\n* **Declarative API**: Compose animations using `parallel (|)` and `sequential (+)` operators.\n* **Keyframes**: Define complex multi-stage timelines for any property (position, rotation, color).\n* **Morphing \u0026 Warping**: Smoothly transform one shape into another or apply wave functions to geometry.\n\n### Physics Engine\n\nTesserax includes a **baked physics engine** for high-precision rigid body simulations.\n\n* **Deterministic**: Define a `World`, add `Body` objects, and apply `Field`s like Gravity or Drag.\n* **Baked Playback**: The simulation is calculated upfront and converted into standard keyframes, allowing high-resolution physics (e.g., 1000 steps/sec) to play back smoothly at any framerate.\n* **Interoperable**: Physics animations can be mixed and matched with standard tweens.\n\n### Statistical Visualization\n\nBridging the gap between diagrams and plots, Tesserax offers a grammar-of-graphics charting API.\n\n* **Altair-lite API**: Define a `Chart`, select a `Mark` (bar, point), and `encode` visual channels like `x`, `y`, and `color`.\n* **Automated Scales**: Includes built-in `Linear`, `Band`, and `Color` scales that automatically map data values to pixels and palettes.\n* **Integrated Axes**: Effortlessly add titles, ticks, and gridlines with smart coordinate management.\n\n## Why Tesserax?\n\nIn the Python ecosystem, there is a clear divide between **data visualization** (plotting numbers) and **diagrammatic representation** (drawing concepts).\n\nTesserax is for **Scientific Drawing**---providing the low-level primitives needed for total layout authority.\n\nLibraries like **Matplotlib** map data to charts. Tesserax maps concepts to geometry. Use Tesserax for the schematics, geometric proofs, and algorithmic walkthroughs in your papers.\n\n**TikZ** is the industry standard for academic figures but uses a cryptic macro language. Tesserax brings that same \"total-control\" philosophy to **Python 3.12**, giving you coordinate-invariant precision with the power of Python's loops and types.\n\n## Contribution\n\nTesserax is free as in both free beer and free speech. License is MIT.\n\nContributions are always welcomed! Fork, clone, and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiad%2Ftesserax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiad%2Ftesserax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiad%2Ftesserax/lists"}