Sphinx VTK XRef
sphinx-vtk-xref is a Sphinx extension for linking directly to VTK’s documentation using the :vtk: reference role.
Installation
Add sphinx-vtk-xref as a project dependency or install it with:
pip install sphinx-vtk-xrefAdd sphinx_vtk_xref as an extension in your conf.py file used by Sphinx. The exact setup depends on whether your documentation is written in reStructuredText or Markdown.
reStructuredText
extensions = [
...,
'sphinx_vtk_xref',
]
Markdown (MyST)
Markdown support requires MyST-Parser, which dispatches Sphinx roles like :vtk: using its own {vtk} syntax.
pip install myst-parser
extensions = [
...,
'sphinx_vtk_xref',
'myst_parser',
]
source_suffix = {
'.md': 'markdown',
}
Usage
Add links to VTK class documentation with the :vtk: role. For example, write :vtk:`vtkImageData` in docstrings to link directly to the vtkImageData documentation. This will render as vtkImageData.
If using MyST, use {vtk}`vtkImageData` instead.
Link directly to class members such as methods, enums, or enum values. For example, write :vtk:`vtkImageData.GetSpacing` to link directly to the GetSpacing method. This will render as vtkImageData.GetSpacing.
If using MyST, use {vtk}`vtkImageData.GetSpacing` instead.
Write enum values the way they appear in code: with or without their enum, and with either separator. All four of these link to the same COMPOSITE_BLEND anchor.
:vtk:`vtkVolumeMapper.COMPOSITE_BLEND` :vtk:`vtkVolumeMapper::COMPOSITE_BLEND` :vtk:`vtkVolumeMapper.BlendModes.COMPOSITE_BLEND` :vtk:`vtkVolumeMapper::BlendModes::COMPOSITE_BLEND`Naming the enum is required for a scoped enum class, where :vtk:`vtkProperty::Point2DShapeType::Round` is the only way to spell the value in C++.
. and :: are interchangeable separators, and a trailing argument list is ignored, so :vtk:`vtkImageData::GetSpacing()` and :vtk:`vtkImageData.GetSpacing` are the same reference.
Use ~ to shorten the title for the link and only show the class member after the period. For example, :vtk:`~vtkImageData.GetSpacing` will render as GetSpacing.
If using MyST, use {vtk}`~vtkImageData.GetSpacing` instead.
Provide a custom title for the reference. For example, :vtk:`Get Image Spacing <vtkImageData.GetSpacing>` will render as Get Image Spacing
If using MyST, use {vtk}`Get Image Spacing <vtkImageData.GetSpacing>` instead.
Python references to VTK classes also link to the class documentation, whatever module path they use. This covers type annotations such as -> vtkmodules.vtkCommonCore.vtkPoints in autodoc signatures, and docstring types such as points : vtkPoints. They are checked the same way as :vtk: class references.
Configuration
The following options can be set in conf.py:
- vtk_xref_nitpicky
Bool, default True. Set to False to disable :vtk: link checking. This is independent of Sphinx’s own nitpicky option, so you can turn off :vtk: link validation without affecting how the rest of your project handles missing references. When disabled, the :vtk: role skips the HTTP request used to validate class and member references (and to resolve member anchors) and instead links directly to the (unvalidated) class documentation page.
vtk_xref_nitpicky = False- vtk_xref_ignored_status_codes
Collection of HTTP status codes, default {429, 500, 502, 503, 504}. These codes typically indicate a transient server-side issue (rate limiting or upstream unavailability) rather than a genuinely-invalid class reference, so they are logged as info messages and do not fail the build, even with Sphinx’s -W flag. The role falls back to the (unvalidated) class URL in this case.
vtk_xref_ignored_status_codes = {404}
Notes
The URLs linking to the VTK documentation are checked to ensure they are valid references. A warning is emitted if the reference is invalid, but the role will still try to point to a valid URL where possible. Combine this with Sphinx’s own -W flag to fail the build on invalid links.
A reference is resolved from its most specific component that matches, so the class must come first. A module-qualified path such as :vtk:`vtk.vtkVolumeMapper.COMPOSITE_BLEND` is not supported, and reports vtk as an invalid class.
Metadata
Release files for sphinx-vtk-xref 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sphinx_vtk_xref-0.4.0.tar.gz | 22.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_vtk_xref-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.9 kB
Release files / sphinx_vtk_xref-0.4.0.tar.gz
| Download URL | sphinx_vtk_xref-0.4.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ce2d5032be7309faf3d2f56cd3e9eccfc7b61410917686023faff0c6d8ffbf8
|
|
BLAKE2b-256 checksum How to use checksums |
9b4e5a9e6d393f7e6fc61ee098e53da847921b7281e07cae70970fda47476b22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Sep 23, 2026.
Transparency logRelease files / sphinx_vtk_xref-0.4.0-py3-none-any.whl
| Download URL | sphinx_vtk_xref-0.4.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cee0fd8dc962d40c415ba7ae35137970501bcd4794d1b9bde7dbe069edd08cf
|
|
BLAKE2b-256 checksum How to use checksums |
69d10308899505bdcb89e4987b986ecef52296b1d39a47d2d6e2b485cda1a925
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Sep 23, 2026.
Transparency log