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.

The build also writes a stylesheet, docs/examples/_built/zallery.css. List it in zensical.toml, with its path from the docs folder:

extra_css = ["examples/_built/zallery.css"]

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

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

Built distribution (wheel)

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

Total release size: 138.7 kB

Release files / zallery-0.0.7.tar.gz

Download URL zallery-0.0.7.tar.gz
Size 64.3 kB
Tags Source
SHA-256 checksum
How to use checksums
449db8270af1d7eaaa37a4e61e1f25785078abd74883edb9027dafd445c3f591
BLAKE2b-256 checksum
How to use checksums
520b0069a72bb6df673e1e5e53c10b7a657ca9baa0aa87fbbaf5dd08e79b09b0
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.7-py3-none-any.whl

Download URL zallery-0.0.7-py3-none-any.whl
Size 74.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a73e5a025404bc6c612e813525e8b5e8ab41be585317524130d11cac6eb90aa
BLAKE2b-256 checksum
How to use checksums
fc76b2662045a062b4de97b41657359a2f615637d0acbe850432bc329b9a4aa8
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.7

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