Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Oicana for Python

Generate PDFs in Python without a headless browser.

Python teams generating PDFs usually pick between a headless browser, HTML-to-PDF engines that fight page breaks and fonts, or low-level libraries that turn every layout into code. The abandoned wkhtmltopdf still shows up in production stacks.

Oicana compiles PDFs in process through native bindings instead. You design documents as Typst templates, load them once at startup, and render them from JSON in single-digit milliseconds. No browser process, no per-document fees, no document data leaving your infrastructure.

Free for noncommercial use. Commercial use is free for 30 days, then needs a per-application subscription with unlimited seats.

Installation

pip install oicana     # or: uv add oicana

Wheels are published for Linux, macOS, and Windows on Python 3.9 and newer.

Quick start

import json
from pathlib import Path

from oicana import Template

template_bytes = Path("invoice-0.1.0.zip").read_bytes()

with Template(template_bytes) as template:
    pdf = template.export(
        json_inputs={"invoice": json.dumps({
            "number": "2026-001",
            "customer": "Acme GmbH",
            "total": "€1,190.00",
        })},
    )

Path("invoice.pdf").write_bytes(pdf)

export returns the PDF bytes. export_png and export_svg produce the other formats, and Template.export_once renders a one-off template without registering it. The Template context manager frees native resources on exit.

What a template looks like

Templates are plain Typst projects. A typst.toml manifest names the entrypoint and declares the inputs your application passes in:

[package]
name = "invoice"
version = "0.1.0"
entrypoint = "main.typ"

[tool.oicana]
manifest_version = 1

[[tool.oicana.inputs]]
type = "json"
key = "invoice"
development = "invoice.json"

The entrypoint, main.typ, reads those inputs through the Oicana Typst package and lays out the document:

#import "@preview/oicana:0.2.0": setup

#let read-project-file(path) = read(path, encoding: none)
#let (input, oicana-image, oicana-config) = setup(read-project-file)

#set document(title: "Invoice", date: datetime.today())

= Invoice #input.invoice.number

Billed to: #input.invoice.customer

*Total: #input.invoice.total*

The development value lets the template preview with real data in any Typst editor. oicana pack turns the directory into invoice-0.1.0.zip, the archive every Oicana integration loads.

The Oicana CLI does the packing, so a layout change ships as a new asset, not a code change.

Running in a web service

Load the template once at startup and export per request; afterwards there is no file I/O on the hot path. The native calls release the GIL, so exports from several worker threads run in parallel.

Full type hints ship with the package, so Template, CompilationMode, ExportFormat, and the input types autocomplete and type-check.

Why Oicana

  • Runs in your infrastructure: PDFs are generated inside your own application. No data is sent to a third-party service.
  • Multi-platform: the same template works in the browser, Node.js, C#, Java, Rust, Python, and PHP.
  • Powerful layouting: templates have all of Typst, including its package ecosystem.
  • Performant: a warmed up template renders a PDF in single-digit milliseconds.
  • AI and version control ready: templates are text files. They live next to your code, and AI can help write them.
  • No proprietary format: templates are plain Typst projects. The Typst compiler is open source.

Where to go next

Licensing

Oicana is source-available under the PolyForm Noncommercial License 1.0.0 and free for noncommercial use. Commercial use is free for 30 days; see pricing for subscriptions, or write to hello@oicana.com.

Metadata

Release files for oicana 0.10.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oicana 0.10.0rc3
File Size Uploaded Provenance
oicana-0.10.0rc3.tar.gz 16.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for oicana 0.10.0rc3
File Interpreter ABI Platform
oicana-0.10.0rc3-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / oicana-0.10.0rc3.tar.gz

Download URL oicana-0.10.0rc3.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cafc53582b2575d3221daf110da7176edc54fcf8727ed4f94ddb6a6958b0a911
BLAKE2b-256 checksum
How to use checksums
d106a98d8a858838d299ef22676a8074dae7dac30ecda3f133c69c66df08107c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Release files / oicana-0.10.0rc3-py3-none-any.whl

Download URL oicana-0.10.0rc3-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2834f6ce8bbff516cb021931033863426091ac51f92d4083c128ba9b37c0bbf7
BLAKE2b-256 checksum
How to use checksums
6cb3cf7d16c4138402137076f2c893ef25f69ceccf7b73718ccc89236a2d08af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 20, 2026.

Transparency log

Security for oicana 0.10.0rc3

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for oicana-0.10.0rc3.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 Oct 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page