Skip to main content

sphinx-skos

Tests Build Publish Coverage PyPI Development status Python Ruff Licence

A Sphinx extension that builds SKOS vocabularies into a documentation site. Point it at your vocabulary files and Sphinx publishes one page for every vocabulary, every concept and every collection, with the RDF for each page beside it.

Why

A controlled vocabulary is published so that people can read it and machines can resolve it. Each concept has a URI, and that URI should lead somewhere useful: a page a person can read, and the same concept in RDF for software that asks for it.

Most tools that render a SKOS vocabulary produce one long page for the whole vocabulary, or are a site generator of their own with their own templates and theming. sphinx-skos does neither. It turns each concept into an ordinary Sphinx document, so a vocabulary site is a Sphinx site: it can hold prose pages next to the generated ones, link between them, and look however its Sphinx theme makes it look.

Status

Early. The package reads your vocabulary files and writes one Sphinx page for every vocabulary, concept and collection, each with its facts and links, and writes that resource's own RDF beside it in Turtle, JSON-LD, RDF/XML and N-Triples, named in the page's head with <link rel="alternate"> elements. Your own pages can show any resource with the skos:vocabulary, skos:concept and skos:collection directives.

Usage

Describe the site in pyproject.toml. Keep the vocabulary files outside the vocabularies/ directory, which holds the generated pages:

[tool.sphinx-skos]
title = "Example vocabularies"
base-uri = "https://w3id.org/example/vocabularies/"
vocabularies = ["data/*.ttl"]

Build the site with one command:

sphinx-skos build

The site is written to _build/site/, with a front page, a page for every vocabulary, concept and collection, and Furo as its theme. Add a docs/ directory for prose pages of your own, or a docs/conf.py to change any setting. A site that already has a conf.py can instead list sphinx_skos in its extensions, set skos_vocabularies and skos_base_uri, and build with sphinx-build -b dirhtml.

A concept's page lives at its URI with the base URI removed, so a redirect from the URI's domain to the site maps one address directly onto the other. See Publish vocabulary files as a site for the steps, RDF copies for the files written beside each page and Settings for what each setting accepts.

To publish the site to GitHub Pages, call the workflow this repository ships from a job in your own:

jobs:
  site:
    uses: FAIR-DM/sphinx-skos/.github/workflows/build-site.yml@v0.3.2
    permissions:
      contents: read
      pages: write
      id-token: write

See Publish a site to GitHub Pages for its inputs and for building pull requests without deploying them.

Scope & philosophy

What it is. A Sphinx extension that reads SKOS vocabulary files and turns them into Sphinx documents: one page per vocabulary, concept and collection, each with its RDF copies. It works for any vocabulary from any organisation.

What it is not.

  • Not a theme. Colours, fonts and layout come from Sphinx's own theme settings in your conf.py: html_theme, html_theme_options and the rest. The extension adds no look-and-feel option. It installs Furo and uses it when the site sets no theme, so a site looks finished without choosing one. A site's own title and logo can be named in the [tool.sphinx-skos] table, which passes them to Sphinx's html_title and html_logo. Requests to add a colour scheme or a layout option to this package will be closed with a pointer to Sphinx's HTML theming documentation.
  • Not a vocabulary editor. The Turtle files are the source. The extension reads them and never writes them back.
  • Not a SKOS validator. It renders what the files say. Checking a vocabulary's quality is the job of tools built for it.
  • Not a server. It writes static files. Resolving a URI to a page is done by a redirect service such as w3id.org or by your web server.

When choices collide:

  1. The vocabulary files are the truth. A page shows what they say, and the RDF copies contain what they contain, without anything added or dropped.
  2. A concept's address never changes because the extension changed.
  3. Anything a site can set in Sphinx itself stays in Sphinx.

Prior art

pyLODE renders a SKOS vocabulary or an OWL ontology as HTML and is well maintained. It produces a single page per vocabulary, which does not give each concept a page of its own to resolve to. sphinx-skos exists for the one-page-per-concept case.

Contributing

See CONTRIBUTING.md. The rules every change follows are in CONSTITUTION.md.

License

MIT. See LICENSE.

Metadata

Release files for sphinx-skos 0.4.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-skos 0.4.0
File Size Uploaded Provenance Actions
sphinx_skos-0.4.0.tar.gz 25.8 kB With provenance Details for sphinx_skos-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-skos 0.4.0
File Interpreter ABI Platform Actions
sphinx_skos-0.4.0-py3-none-any.whl Python 3 none any Details for sphinx_skos-0.4.0-py3-none-any.whl

Total release size: 55.6 kB

Release files / sphinx_skos-0.4.0.tar.gz

Download URL sphinx_skos-0.4.0.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
907ee79d5e9f8fd1a7e10de44b0f0e010d655a978edc3d62c65d2a3f86ae1adc
BLAKE2b-256 checksum
How to use checksums
fb4ba754d766ab0071a70fa352262fa3291b1e609f1487e80aac736a6fb5a15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / sphinx_skos-0.4.0-py3-none-any.whl

Download URL sphinx_skos-0.4.0-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bbe30c007804bb4d9deaa21276a9adc4ef3b356482ba6806d4e8f992a0af0a6
BLAKE2b-256 checksum
How to use checksums
0a2b542b39ac81c4562fa30e7ab58ae14eb9a148552dfd2bd387bf662b51b036
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for sphinx-skos 0.4.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sphinx_skos-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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