Skip to main content

PyPI version Python versions License Binder

Zallery

Zallery builds an example gallery for Zensical documentation sites from plain Python scripts.

Each example is a jupytext percent-format .py file. Zallery runs it once in a Jupyter kernel, renders it as a notebook-style Markdown page with code, outputs, and .py/.ipynb downloads, and writes an index page with one card per example. Every figure comes out twice, for the light and the dark color scheme, from that single run.

Installation

uv add --dev zallery

Or with pip:

pip install zallery

Quick start

Add a [tool.zallery] section to the project's pyproject.toml (an empty section is enough):

[tool.zallery]
examples = "docs/examples"

Create a section with one example:

mkdir -p docs/examples/my-section
printf '# My section\n\nIntro.\n' > docs/examples/my-section/_section.md
cat > docs/examples/my-section/hello.py <<'EOF'
# %% [markdown]
# # My example
#
# Short description.

# %%
print("hi")
EOF

Build the gallery from anywhere inside the project:

uv run zallery

This writes docs/examples/index.md (the card index) and docs/examples/_built/my-section/hello.md with its images and downloads. Add them to the site navigation like any other page; both are generated, so keep them and the cache directory out of version control.

Command line

zallery [--no-run] [--no-cache] [--abort-on-error] [EXAMPLE ...]
  • With no arguments, every example is executed, or restored from cache.
zallery
  • With specific paths to run only those. The whole gallery is still rendered: the others are restored from cache if present, or rendered without execution.
zallery path/to/example_1.py path/to/example_2.py
  • --no-run restored from cache if present, or rendered without execution.
  • --no-cache executes the selected examples even when a cached result exists; the result replaces the cache entry.
  • --abort-on-error stops the build at the first cell that raises, prints its traceback and exits with status 1. Without it, the traceback is rendered on the page of the example and the build goes on.
    • The examples after that cell are not built and the index page is not written.
    • A cell tagged raises-exception may raise: it does not stop the build.
    • An example whose cached result shows an error is run again, so that an error does not pass because it is in the cache.

python -m zallery is equivalent.

User guide

The user guide has one page for each topic:

Relationship to ConfUSIus

Zallery is extracted from ConfUSIus, where it builds the documentation's example gallery. It does not depend on ConfUSIus and makes no assumption about what the examples compute.

Development

uv sync            # install dependencies
just test          # run tests
just pre-commit    # run lint, format, type checks, docstring checks
just serve-docs    # build the example gallery in docs/examples and serve the docs

License

BSD-3-Clause. See LICENSE.

Metadata

Release files for zallery 0.0.4

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

Source distribution (sdist)

Source distribution for zallery 0.0.4
File Size Uploaded Provenance Actions
zallery-0.0.4.tar.gz 56.4 kB Without provenance Details for zallery-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zallery 0.0.4
File Interpreter ABI Platform Actions
zallery-0.0.4-py3-none-any.whl Python 3 none any Details for zallery-0.0.4-py3-none-any.whl

Total release size: 121.9 kB

Release files / zallery-0.0.4.tar.gz

Download URL zallery-0.0.4.tar.gz
Size 56.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d487ce0669f37cb48b3834e5e19992f98618d7cd460d74cffc5d6d3a52aa5a1c
BLAKE2b-256 checksum
How to use checksums
a255f2e7743fe3b5429e6a53ab90319bd26ee74b226847c4d82ae4495023f400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zallery-0.0.4-py3-none-any.whl

Download URL zallery-0.0.4-py3-none-any.whl
Size 65.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9190d7be2f78234edf0f8d4c67686fb22ba02879b9a9af9b201852f00ae46e4
BLAKE2b-256 checksum
How to use checksums
72e5cf9b9f077907db9633d0384d8f7854f9a8ae9691f68d0291a40b1db8f177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for zallery 0.0.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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