Skip to main content
PyPI version

A Sphinx extension to embed Bioschemas profiles or any Schema.org structured metadata into your Sphinx documentation as <script type="application/ld+json"> tags.

  • Supports YAML and JSON formats

  • Embed metadata inline or load from an external file

  • Apply markup per-page (via directive) or globally for all pages (via conf.py)

  • Works with MyST for Markdown-based Sphinx projects

  • Optional Bioschemas profile validation against each profile’s $validation JSON Schema

Installation

$ pip install sphinx-bioschemas

Then enable the extension in your conf.py:

extensions = ['sphinx_bioschemas']

Quick start

Per-page (in a .rst file):

.. bioschemas::
   :format: yaml

   "@context": https://schema.org/
   "@type": LearningResource
   name: My Tutorial
   ...

Or load from a file:

.. bioschemas:: bioschemas.yaml

Global (in conf.py):

bioschemas = ["bioschemas.yaml"]

Validation (optional)

Markup can be checked against schema.org/JSON-LD basics and, for records that declare a Bioschemas profile via conformsTo, against that profile’s own machine-readable $validation JSON Schema (missing Minimum properties, missing Recommended properties, and type/shape errors).

$ pip install "sphinx-bioschemas[validate]"
# conf.py
bioschemas_validate = "warn"                 # False (default) | "info" | "warn" | "strict"
bioschemas_validate_profile_dir = "_profiles" # local dir of downloaded profile spec JSON files

Findings are reported through Sphinx’s own warning system (sphinx-build -W gates them; suppress_warnings = ["bioschemas.recommended"] etc. filters them).

Config value

Default

Meaning

bioschemas_validate

False

False/"off" disables; True/"warn", "info", or "strict" set the severity.

bioschemas_validate_recommended

"info"

Severity for missing Recommended properties: "ignore", "info", or "warn".

bioschemas_validate_profile_dir

None

Local directory (or list of directories) of downloaded profile spec JSON files, checked before any network fetch.

bioschemas_validate_fetch

False

Allow downloading a profile spec from GitHub when not found locally. Off by default so builds stay hermetic; results are cached to disk once fetched.

bioschemas_validate_cache_dir

None

Where fetched profile specs are cached. Defaults to an XDG cache directory.

bioschemas_validate_timeout

10.0

Network timeout (seconds) for fetching.

The .. bioschemas:: directive also accepts :validate: (info/warn/strict/off, overriding the site-wide setting for that record) and :no-validate: (always skip).

Full documentation

https://biocorecrg.github.io/sphinx-bioschemas/

Metadata

Release files for sphinx-bioschemas 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-bioschemas 0.3.0
File Size Uploaded
sphinx_bioschemas-0.3.0.tar.gz 27.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-bioschemas 0.3.0
File Interpreter ABI Platform
sphinx_bioschemas-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.0 kB

Release files / sphinx_bioschemas-0.3.0.tar.gz

Download URL sphinx_bioschemas-0.3.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7cf3acad981e6b8dd6516913da12104ef2afb5c267b1a50cfbce27e5646c071f
BLAKE2b-256 checksum
How to use checksums
43481452154678e5da838f59ab656177c2e9d8ecffafcd4ce07ff39dc7ae6cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / sphinx_bioschemas-0.3.0-py3-none-any.whl

Download URL sphinx_bioschemas-0.3.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40daa5a720ecba5e00072f4233dc79bddd255418c43810dfd4f2d380df1ad0f9
BLAKE2b-256 checksum
How to use checksums
da38c47e766e8332f8f7c616681b3e49e8180b57f4cb88d1d1435af7029cf1a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

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