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

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.5
File Size Uploaded Provenance Actions
zallery-0.0.5.tar.gz 59.7 kB Without provenance Details for zallery-0.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 128.9 kB

Release files / zallery-0.0.5.tar.gz

Download URL zallery-0.0.5.tar.gz
Size 59.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d0e62838bcc912c729fb8607aa308ae09ab73df5777184ce3c52bf06ecee2456
BLAKE2b-256 checksum
How to use checksums
042939ee5582dab1645c93a2ad59fb41099e8f4f03e4555638aadf8f59f65e4a
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.5-py3-none-any.whl

Download URL zallery-0.0.5-py3-none-any.whl
Size 69.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd856bc937a1bcc74ca1f620e6f0656a80683c863f1c8d8fd43615101f706155
BLAKE2b-256 checksum
How to use checksums
9858335be69fdda0a450a21fb7081da22d42696b8bf8bde0614b20a5dcc9ffb5
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.5

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