takumi-py
English | 简体中文
Render social cards, reports, and other images from Python using the Takumi Rust renderer. Turn node trees, HTML, or Jinja templates into raster images, SVG, and animations without a browser runtime.
Requires Python 3.11+. Published versions are listed on PyPI and in GitHub Releases.
Features
- Three input models: typed node trees, HTML parsed in Rust, and Jinja templates with custom filters or a caller-owned environment.
- Static output: PNG, JPEG, WebP, ICO, raw RGBA, and SVG; layout measurement returns a typed tree.
- Animation: sample CSS or structured keyframes, render scene sequences, or encode raw frames as WebP, APNG, and GIF.
- Fonts and images: explicit image bytes, raw RGBA sources, font subsets, fallback stacks, and language-aware text shaping.
- Reuse and caching: compiled nodes and stylesheets, budgeted image and font caches, and a configurable process-wide glyph cache.
- Python typing: PEP 561 support and native-extension stubs.
Installation
uv add takumi-py
Or install into an existing Python environment with pip:
python -m pip install takumi-py
These commands install the latest published release. To use the current source, follow Development.
Installing a compatible wheel does not require Rust. Source builds require Rust 1.91 or later and a native build toolchain. See the support matrix for platform compatibility and the installation guide for source builds.
Quickstart
Save this as render.py and run it with uv run python render.py (or
python render.py in the environment where you installed the package):
from pathlib import Path
from takumi_py import Renderer
png = Renderer().render_html(
'<main class="card">Hello from Python</main>',
stylesheets=[
"""
.card {
width: 1200px;
height: 630px;
display: flex;
align-items: center;
justify-content: center;
color: white;
background: #111827;
font-size: 72px;
}
"""
],
width=1200,
height=630,
)
Path("out.png").write_bytes(png)
The example writes a 1200 by 630 PNG to out.png.
- Pass document-level CSS through
stylesheets. Inlinestyleattributes work, but<style>elements in the HTML are ignored. - The bundled Geist fallback covers Latin text. Register suitable fonts for Chinese, Japanese, Korean, emoji, or other scripts.
- The renderer never fetches resources over the network. Supply image bytes through
imagesand register fonts on the renderer.
See Fonts and images
for resource setup, and examples/
for runnable node, HTML, template, resource, measurement, and animation scripts.
Documentation
The links below open the dev documentation built from main, in English and
Simplified Chinese. It can describe
changes that are not yet on PyPI. For a published package, select its version on the
documentation site.
| Task | Documentation |
|---|---|
| Render your first image | Quickstart |
| Choose inputs and outputs | Rendering model, HTML and CSS, Output formats |
| Render dynamic content | Jinja templates, Animation |
| Look up signatures and behavior | API reference, Exceptions |
| Check compatibility and API policy | Support matrix |
Documentation sources live in docs/.
English is the source of truth; Chinese mirrors its pages and code samples.
Upgrading to 0.4.0
- Python 3.11+ is required; Python 3.10 support is removed.
- Replace the resource APIs deprecated in 0.2.0 with per-render
imagesandregister_font/register_fonts. - Review font subsets, dithering, animation frame-rate limits, and rendering changes when moving from Takumi 2.5 to 2.17.
Follow the Takumi v2 migration and Takumi 2.17 migration, and read the changelog.
Development
Install uv and Rust, then clone with the Takumi submodule:
git clone --recurse-submodules https://github.com/BalconyJH/takumi-py.git
cd takumi-py
make sync
make check
make docs-build
make check runs linting, type checks, Python tests, and Rust checks, rebuilding the
native extension for runtime checks.
Use make docs-serve or make docs-serve-zh to preview documentation locally.
The development guide
covers checks and Takumi upgrades; the
release guide
describes the automated release pipeline.
License
takumi-py is licensed under GPL-3.0-or-later. See
LICENSE.
This repository includes takumi as a git submodule. takumi is licensed separately
under MIT OR Apache-2.0; see
THIRD_PARTY_NOTICES.md.
Metadata
Release files for takumi-py 0.4.0
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 |
|---|---|---|---|---|
| takumi_py-0.4.0.tar.gz | 8.0 MB | With provenance | Details for takumi_py-0.4.0.tar.gz |
Built distributions (wheels)
Total release size: 51.0 MB
Release files / takumi_py-0.4.0.tar.gz
| Download URL | takumi_py-0.4.0.tar.gz |
|---|---|
| Size | 8.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c67165751d3f6eaa6519235bf52b4b82d45d53f6c24d9c713c21537833eef797
|
|
BLAKE2b-256 checksum How to use checksums |
55ac0531313f71d92e34797542f48fa3a50d9fc5b358a68cf11e7dbc346e4130
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-win_arm64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ff463e927b592fb397f9e0886f719f22924857c7c48edfc9b9fcd27f4390b5ef
|
|
BLAKE2b-256 checksum How to use checksums |
00cc333a029bcea89de3878caf64c05c7dd793c77fa5180fa742745b14b0534a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-win_amd64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0f73d5763b3875c836379f984296583220dfbcc74e67e82a6d8e4f8b3f0e82a5
|
|
BLAKE2b-256 checksum How to use checksums |
591470f5361e4d3d8d4df03b2ac6f8993294155363d43cd29f772bc44f954b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7cc68c738c969fca9bdc6d0b1e8d98800e5854f246912153c0006e4aacbc20b6
|
|
BLAKE2b-256 checksum How to use checksums |
e6403c63d105c8f58da63c217b8346bc85cc15762d8413c0953bbb0055588cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e912cdd71f2f89a3099a6173ba87f9956787d5e431c95163ed1aaed3195d54a3
|
|
BLAKE2b-256 checksum How to use checksums |
b15357f8a4f6d822baea865c5a5aad04b435e0592511a72083d24d028c7569b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8bef71f4755a067e3934bc051ef1f75937d2d8f69cb983011a25d97a58f4c6ce
|
|
BLAKE2b-256 checksum How to use checksums |
9d3c168382dd8f3a2ec7c750f5698be594dbeb84b2b9162689bebec51737e846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f8e2ae4871d8af1a2260b50448dff59454f99c443efa690582e5356bf03654b7
|
|
BLAKE2b-256 checksum How to use checksums |
6cc55d512093ef0467b51846feab84fc578018594df4a6b01ea998dc01cf8c4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d4628ae13433e7aa8dd0bad03b5c43b0d28961c009fa77bbaf116dbf62fab461
|
|
BLAKE2b-256 checksum How to use checksums |
a95ddd6e5e2b95cda3b087baf57404b74fb5d135918aaaf921b3cce9dd516e82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / takumi_py-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | takumi_py-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ed0045f8237cd2c92718c9c278d521fe6aa3621a3a0017b053eefe3c36c22c7a
|
|
BLAKE2b-256 checksum How to use checksums |
24219d0843b031125c50ffacc96f173b115c6b5fd079aed28500982b105acde4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for takumi-py 0.4.0
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.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for takumi_py-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA 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.