Skip to main content
Ctrl+K
scikit-plots homepage scikit-plots homepage
  • Introduction
  • User Guide
  • APIs Reference
  • Tutorials
  • Learn
  • Tags
    • Affiliated Packages
    • Code of Conduct
    • Community
    • Developer's Guide
    • Governance Process
    • Release History
    • Roadmap
    • About Us | Project
  • Social Media Platforms
  • PyPI
  • GitHub
  • Introduction
  • User Guide
  • APIs Reference
  • Tutorials
  • Learn
  • Tags
  • Affiliated Packages
  • Code of Conduct
  • Community
  • Developer's Guide
  • Governance Process
  • Release History
  • Roadmap
  • About Us | Project
  • Social Media Platforms
  • PyPI
  • GitHub

Section Navigation

  • ANNoy
    • Getting started
    • Architecture
    • Persistence and I/O
    • Performance and threads
    • Python API
    • Limits and troubleshooting
    • Vector Similarity Search and Vector Database
    • Annoy Index class Inheritance Diagrams (MRO)
    • ANNoy Cython
  • Metric Performance
    • Decomposition
    • Estimators
    • Metrics
  • CleanPrompt
    • Getting started
    • How it works
    • The Python API
    • The command line
    • Names, organisations and places
    • Files, records, packs and plans
    • Models, tools and agents
    • The web page and containers
    • What it protects, and what it does not
    • Troubleshooting and questions
  • Corpus
    • Getting started
    • Architecture
    • Readers, backends, and readiness
    • Fluent configuration and policies
    • Customization
    • Downloads and network boundaries
    • Retrieval and similarity
    • Formats, structured evidence, and export
    • Security and limits
    • Troubleshooting
  • Cython
    • Getting started
    • Trust and security
    • Build, cache, and import
    • Profiles and toolchains
    • Packages, templates, and workflows
    • Cache, pins, and garbage collection
    • Python API
    • Troubleshooting
    • Cython templates
      • basic_cython
      • basic_python
      • complex_cython
      • complex_python
      • devel_cython
      • devel_numcpp_cpp_api_cython
      • devel_numcpp_cpp_api_python
      • devel_numpy_c_api_cython
      • devel_numpy_c_api_python
      • devel_python
      • easy_cython
      • easy_python
      • hard_cython
      • hard_python
      • medium_cython
      • medium_python
      • mixed
      • module_cython
      • module_python
  • Decile analysis
    • Getting started
    • KDS functions
    • ModelPlotPy
    • Business and financial plots
    • Compatibility and limits
  • Missing-value imputation
    • Getting started
    • Standard imputers
    • ANNImputer
    • Index access and privacy
    • Python API
    • Limits and troubleshooting
  • Levenshtein
    • Getting started
    • How it works
    • Backends and fallback
    • Ranking and matching
    • Corpus integration
    • Performance and limits
    • Troubleshooting
  • Logging
    • Getting started
    • Levels and loggers
    • Formatting and helpers
    • Python API
    • Known limits and troubleshooting
  • MemMap
    • Getting started
    • Lifecycle and I/O
    • Protection, sync, and locking
    • Python API
    • Platform and limits
  • Mcp
    • Getting started
    • Architecture
    • Retrieval and fusion
    • Corpus and Annoy
    • Capabilities and runtime
    • Server, CLI, and security
    • Deployment and operations
    • Python API
    • Troubleshooting
    • Model Context Protocol (MCP)
  • MLflow
    • Getting started
    • Project configuration
    • Sessions and facades
    • Server and CLI
    • Providers and workflows
    • Security and readiness
    • Python API
    • Troubleshooting
  • Nc
  • Categorical preprocessing
    • Getting started
    • GetDummies
    • DummyCodeEncoder
    • Scikit-learn integration
    • Python API
    • Known limits and troubleshooting
  • KISS random number generation
    • Getting started
    • Generators and seeding
    • State and serialization
    • NumPy interop and reproducibility
    • Python API
    • Limits and troubleshooting
  • Rank-BM25
    • Getting started
    • Recipes and tokenization
    • Retrieval and identity
    • Persistence and reproducibility
    • Performance and scaling
    • Python API
    • Troubleshooting
    • Rank-BM25 Usage Scenarios
  • Seaborn
    • Getting started
    • AUC and evaluation
    • Decile and model plots
    • Data semantics and styling
    • Python API
    • Known limits and troubleshooting
  • Stats
  • Keras architecture visualization
    • Getting started
    • Layered view
    • Graph view
    • Styling and spacing
    • Python API
    • Dependencies and limits
    • Troubleshooting
  • Array API support
  • Brand
    • CLI Banner
    • Logo

development

  • C-Experimental (experimental)
  • C-Externals (experimental)
    • spotify/ANNoy Vector Index DB
    • Astropy (experimental)
    • f2py (experimental)
    • NumCpp
    • LightNumPy (experimental)
  • Experimental (experimental)
    • Pipeline
    • Do-Re-Mi
  • Externals (experimental)
    • array_api_compat
    • array_api_extra
    • Probability Plots (experimental)
    • Seaborn (experimental)
    • Matplotlib Sphinx Ext
    • Tweedie Family
  • Externals (experimental)
    • Jupyter Ext
    • Sphinx Ext
      • ANSI Sanitizer
      • PyData Component List
      • Sphinx AI Assistant
      • Sphinx AI Learn
      • Sphinx Collection
      • Sphinx Feedback
      • Sphinx Gallery Grid
      • Sphinx-Gallery JupyterLite
      • Sphinx Jinja Render
      • Sphinx LLM
      • Sphinx YouTube Core
      • Sphinx YouTube Gallery
      • Sphinx Video Directives
  • User Guide
  • Externals (experimental)
  • Bundled Sphinx extensions (experimental)
  • Sphinx-Gallery JupyterLite helpers

Sphinx-Gallery JupyterLite helpers#

_sphinx_gallery_jupyterlite has two independent roles:

  • a Sphinx extension that injects the documentation release value into the JupyterLite warning/bootstrap content; and

  • public helper callables used from sphinx_gallery_conf to prepare notebooks and reset optional library state between gallery examples.

Enable the release-version hook#

extensions += [
    "scikitplot._externals._sphinx_ext._sphinx_gallery_jupyterlite",
]

At builder-inited the extension uses app.config.release as the authoritative documentation version when it is non-empty. Outside a Sphinx build it falls back to installed scikit-plots package metadata and finally to "unknown" with a warning.

Connect it to Sphinx-Gallery#

The helper callables are referenced by dotted path:

sphinx_gallery_conf = {
    "reset_modules": (
        "scikitplot._externals._sphinx_ext._sphinx_gallery_jupyterlite.reset_others",
        "matplotlib",
        "seaborn",
    ),
    "jupyterlite": {
        "notebook_modification_function": (
            "scikitplot._externals._sphinx_ext._sphinx_gallery_jupyterlite."
            "notebook_modification_function"
        ),
    },
}

notebook_modification_function#

The notebook hook prepends the generated JupyterLite notebook with the Scikit-Plots environment/bootstrap cells needed by the current source. It uses explicit detection tokens for optional packages and dataset-fetching patterns rather than installing every optional dependency unconditionally.

The function asserts the Sphinx-Gallery notebook-cell helper contract after prepending its cells so an incompatible upstream API change fails visibly instead of quietly producing a malformed notebook.

reset_others#

The reset hook runs garbage collection and, when the optional libraries are installed, restores the library state the gallery relies on. The current implementation has explicit handling for scikit-learn, Plotly and PyVista. Missing optional packages are not treated as errors.

Customization boundary#

The module exposes its behavior through documented module-level constants for package-detection tokens, HTTP setup and Pyodide base imports. Override those constants before Sphinx begins processing notebooks if a documentation project needs a different JupyterLite bootstrap policy.

This helper is for documentation builds. It should not become a runtime requirement of ordinary Scikit-Plots plotting code.

previous

Sphinx Gallery Grid

next

Sphinx Jinja RST renderer

On this page
  • Enable the release-version hook
  • Connect it to Sphinx-Gallery
  • notebook_modification_function
  • reset_others
  • Customization boundary
Edit on GitHub
Show Source

© Copyright 2024 - 2026 scikit-plots developers (BSD-3 Clause License) 0.5.dev0+git.20261011.0ec25c0 2026-10-11T11:42Z.