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. Outputs have extensible built-in support for light and dark color scheme.

Installation

uv add --dev zallery

Or with pip:

pip install zallery

Quick start

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

[tool.zallery]
gallery_root = "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 generates docs/examples/index.md (the card index), docs/examples/_built/my-section/hello.md with its images and downloads, and docs/examples/_built/my-section/index.md (the page of the section). Add them to the site navigation in zensical.toml like any other page.

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:

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.6

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.6
File Size Uploaded Provenance Actions
zallery-0.0.6.tar.gz 61.2 kB Without provenance Details for zallery-0.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 132.3 kB

Release files / zallery-0.0.6.tar.gz

Download URL zallery-0.0.6.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1d5ee1b3f22b65b379fadc9ec064da526b001997b4c3c6597e1da799b7f8daa9
BLAKE2b-256 checksum
How to use checksums
3f1190e0f8fa7bdda4bbc90ea3cee4a4e72a702df8b60cc97bf0217eac8484f0
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.6-py3-none-any.whl

Download URL zallery-0.0.6-py3-none-any.whl
Size 71.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59ff57d091ece2d75e220c8cd88fe2728590470045a7085323456f2482d2711a
BLAKE2b-256 checksum
How to use checksums
e78ac2e3a80866497e6eff9af9a122225609f62f61947e9eb1ca3151ef70eac1
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.6

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