Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ ultraplot/_version.py

# Nox build directories
.nox/*

# Generated docs and draw.io assets. The edited diagram remains a repository asset.
tools/cheatsheet/assets/
docs/_static/plot_types/
tools/cheatsheet/ultraplot_cheatsheet.png
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Cheatsheet sources and exports are repository assets, not pip distribution files.
prune tools/cheatsheet
34 changes: 34 additions & 0 deletions docs/_scripts/build_plot_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""
Regenerate the visual plot-type index before a documentation build.

Run from ``conf.py`` the same way ``fetch_releases.py`` is: the page and its
thumbnails are generated artefacts, so a clean checkout builds them rather than
carrying 60-odd PNGs in the repository. Rendering is skipped when the icons are
already present, so a local rebuild costs nothing.
"""

import os
import sys

HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
GENERATOR = os.path.join(ROOT, "tools", "cheatsheet")

sys.path.insert(0, GENERATOR)


def main():
try:
import docs_index
except ImportError as error: # the tools folder is not shipped in sdists
print(f"plot-type index skipped: {error}")
return
try:
docs_index.main()
except Exception as error: # never fail the docs build over a thumbnail
print(f"plot-type index skipped: {type(error).__name__}: {error}")


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def __getattr__(self, name):
}
if not FAST_PREVIEW:
run([sys.executable, "_scripts/fetch_releases.py"], check=False)
# Visual plot-type index: thumbnails plus the page that arranges them.
run([sys.executable, "_scripts/build_plot_types.py"], check=False)

# Docs theme selector. Default to Shibuya, but keep env override for A/B checks.
DOCS_THEME = os.environ.get("UPLT_DOCS_THEME", "shibuya").strip().lower()
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ For more details, check the full :doc:`User guide <usage>` and :doc:`API Referen
:hidden:

basics
plot_types
subplots
cartesian
networks
Expand Down
Loading