Skip to main content

sphinx-vtk-xref is a Sphinx extension for linking directly to VTK’s documentation using the :vtk: reference role.

Installation

  1. Add sphinx-vtk-xref as a project dependency or install it with:

    pip install sphinx-vtk-xref
  2. Add 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.

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.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-vtk-xref 0.3.0
File Size Uploaded
sphinx_vtk_xref-0.3.0.tar.gz 17.7 kB Details

Built distribution (wheel)

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

Total release size: 25.4 kB

Release files / sphinx_vtk_xref-0.3.0.tar.gz

Download URL sphinx_vtk_xref-0.3.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
527043d16d01d02faef1fbf72d1b5c354667d25623a2a05db85847a56d732b01
BLAKE2b-256 checksum
How to use checksums
afd0ea8dbcd86e94141507e9ce04b31c9b64701f7417773333a804b89127f8df
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 Aug 28, 2026.

Transparency log

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

Download URL sphinx_vtk_xref-0.3.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd357c4acc1e41eb2f0c7a180956bd24ac92ef5fd01c7479e170747604c7c538
BLAKE2b-256 checksum
How to use checksums
92683344db6c485254e31ec3e29ec2b39628fa0c8c649cda5ae32d509b804c55
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 Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.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