Skip to main content

pyfulgur

Python bindings for fulgur — an offline, deterministic HTML/CSS to PDF conversion library written in Rust.

Status

Alpha (v0.0.2). Core Engine / AssetBundle / PageSize / Margin / render_html API is available. Batch rendering, sandboxing, and template engine wiring are planned for later releases.

Install

Note: v0.0.2 is an early alpha. Pre-built wheels are not yet published to PyPI; install from source for now.

# From a checkout of the fulgur repository
pip install maturin
maturin develop --release -m crates/pyfulgur/Cargo.toml

Pre-built wheels for manylinux / macOS / Windows will be published in a later release.

Quick start

from pyfulgur import AssetBundle, Engine, PageSize

bundle = AssetBundle()
bundle.add_css("body { font-family: sans-serif; }")

engine = Engine(page_size=PageSize.A4, assets=bundle)
pdf_bytes = engine.render_html("<h1>Hello, world!</h1>")

with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)

Builder style:

engine = (
    Engine.builder()
    .page_size(PageSize.A4)
    .landscape(False)
    .title("My doc")
    .assets(bundle)
    .build()
)
engine.render_html_to_file("<h1>Hi</h1>", "out.pdf")

API surface

  • Engine(**kwargs) / Engine.builder() → EngineBuilder
  • Engine.render_html(html: str) -> bytes — render to PDF bytes (releases the GIL)
  • Engine.render_html_to_file(html: str, path: str | os.PathLike) -> None — render to a file
  • AssetBundle: add_css, add_css_file, add_font_file, add_image, add_image_file
  • PageSize: A3, A4, A5, B4, B5, JIS_B4, JIS_B5, LETTER, LEGAL, LEDGER, custom(w_mm, h_mm), .landscape()
  • Margin: Margin(top, right, bottom, left), Margin.uniform(pt), Margin.symmetric(v, h), Margin.uniform_mm(mm)
  • Exceptions: FileNotFoundError, ValueError, pyfulgur.RenderError

Type stubs

pyfulgur ships PEP 561 type stubs (py.typed + __init__.pyi) so mypy, pyright, and IDEs can type-check call sites against the native API. Docstrings live in the Rust source and are exposed via __doc__ for help(), Jupyter ?, and griffe / mkdocstrings inspection.

Known limitation: blitz parse-error noise on stdout

The underlying blitz-dom parser writes non-fatal html5ever parse errors directly to the process's stdout via println!. These fire for browser-tolerated but technically invalid HTML — documents without a <!DOCTYPE>, missing <html>/<body> wrappers, or structural quirks that browsers silently auto-correct — and show up as ERROR: ... noise in Jupyter notebooks or any environment that captures stdout. The PDF bytes returned by render_html are not affected; only the caller's terminal is polluted.

pyfulgur intentionally does not redirect fd 1 from inside the binding: process-wide fd manipulation in a multi-threaded library context races with concurrent render_html calls from other threads (mixed suppress / non-suppress callers would silently lose stdout during a suppressed window). Correctness and parallelism take priority over cosmetic stdout cleanliness.

If you need clean stdout:

  • Redirect at the caller side with a Python contextlib.redirect_stdout for Python-level writes, or os.dup2 for fd-level writes. This keeps the fd manipulation scoped to your own call site where you can guarantee single-threaded use.
  • Run renders in a subprocess via multiprocessing (each worker has its own fd 1).
  • Use the fulgur CLI (which handles stdout isolation internally) invoked via subprocess.run when cold-start cost is acceptable.

A wrapper-style Python package that shells out to the fulgur CLI (clean stdout, parallel via process isolation, no native build required) is on the roadmap as a complement to this native binding.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Metadata

Release files for pyfulgur 0.41.0

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

Source distribution (sdist)

Source distribution for pyfulgur 0.41.0
File Size Uploaded Provenance Actions
pyfulgur-0.41.0.tar.gz 1.5 MB With provenance Details for pyfulgur-0.41.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyfulgur 0.41.0
File Actions
pyfulgur-0.41.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pyfulgur-0.41.0-cp39-abi3-win_amd64.whl
pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_x86_64.whl
pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_aarch64.whl
pyfulgur-0.41.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for pyfulgur-0.41.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pyfulgur-0.41.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for pyfulgur-0.41.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pyfulgur-0.41.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pyfulgur-0.41.0-cp39-abi3-macosx_11_0_arm64.whl
pyfulgur-0.41.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for pyfulgur-0.41.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 52.8 MB

Release files / pyfulgur-0.41.0.tar.gz

Download URL pyfulgur-0.41.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
b9895b199a28d0400ace20c77a13f6fc4711c3d54cbce8cdd4781385bc1f2491
BLAKE2b-256 checksum
How to use checksums
46898ae470ca980b4731f2e309dcc1e33bcc478016760773b2c824cfaf5c7d20
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-win_amd64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-win_amd64.whl
Size 7.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e6eec52069adc26ac84be4fa6b8507e9560ae12ba75120f06b8a7d79911c35aa
BLAKE2b-256 checksum
How to use checksums
9e4386607bca53d16f7decd9b09b73089aa7b96528994182217dbbdfa621454f
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 7.8 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
13b5d7f8dcfb3affc2fb739a6689c67429cc09c24ae3d5473d7a097ef924f1bb
BLAKE2b-256 checksum
How to use checksums
3e8406d83fb8e033bb1d31197733b47a4c9b6bfced710d93b6f4c8794656fa18
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 7.4 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
038ba66f26d94400eaa9c27d7e01fef58e939d53ccc8852aadc7f0751d4d086f
BLAKE2b-256 checksum
How to use checksums
f1af0cffcd1a2c561c161b60b4cc21dd0ba9f24f72050ef24d645d610fa0716f
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 7.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
850d11761f7b1cdaf401713820a3d3f5e926b2b88b82f238440bf01dc9166eda
BLAKE2b-256 checksum
How to use checksums
48c9244d8b01ea6094ee6c85b0eb78a47773c4fda4744b6de3d7946f04cfe736
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 7.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c3a21556598532259b44e734f990e43798a43f8091ac212b495338775e0be563
BLAKE2b-256 checksum
How to use checksums
3812e9c6a32ba335939a394542b95b5934d1ce0f47adc19c5ef95613af8d3a64
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-macosx_11_0_arm64.whl
Size 6.9 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e439718f897ca36b03c009c4184b2910fe6f241bce89ae9c3eeed9de0fe962d0
BLAKE2b-256 checksum
How to use checksums
b69464d90b21a248b4b66fb9dd89d7048c2747b51aa7c3d432d588d3d8d64186
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 Nov 1, 2026.

Transparency log

Release files / pyfulgur-0.41.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyfulgur-0.41.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 7.1 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6d34efc9c33563420872f03a6d1080bd589f844ed480d1626ccddf231c9fb301
BLAKE2b-256 checksum
How to use checksums
ad1326db7d9e950ebe6c4d181f955880f4ee0678fe4c05e62ea11c372e317159
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 Nov 1, 2026.

Transparency log

Security for pyfulgur 0.41.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 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for pyfulgur-0.41.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 1, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.41.0 This release

8 release files Full provenance

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