sphinx-vtk-xref 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,107 @@
1
+ name: CI
2
+
3
+ # zizmor ignore note: the release job only consumes artifacts built by the
4
+ # `test` job in this same run, never a cache populated by an earlier/forked
5
+ # run, so opting setup-python into pip caching here is not exploitable.
6
+ on: # zizmor: ignore[cache-poisoning]
7
+ pull_request:
8
+ push:
9
+ tags:
10
+ - '*'
11
+ branches:
12
+ - main
13
+ workflow_dispatch:
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ lint:
21
+ permissions:
22
+ contents: read
23
+ runs-on: ubuntu-24.04
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ with:
27
+ persist-credentials: false
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: '3.13'
32
+ cache: pip
33
+ - name: Run pre-commit
34
+ run: |
35
+ pip install --upgrade pip pre-commit
36
+ pre-commit run --all-files --show-diff-on-failure
37
+ env:
38
+ # no-commit-to-branch only makes sense as a local git hook, so skip in CI
39
+ SKIP: no-commit-to-branch
40
+
41
+ test:
42
+ permissions:
43
+ contents: read
44
+ runs-on: ubuntu-24.04
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ with:
52
+ persist-credentials: false
53
+ fetch-depth: 0
54
+ - name: Set up Python
55
+ uses: actions/setup-python@v5
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+ cache: pip
59
+ - name: Install dependencies
60
+ run: |
61
+ pip install --upgrade pip
62
+ pip install . --group dev
63
+ - name: Run tests
64
+ run: pytest -v
65
+ # Pure-Python package: every matrix leg would build an identical wheel, so
66
+ # only build/upload once (on the newest Python) to avoid duplicate
67
+ # dist-artifacts uploads colliding.
68
+ - name: Build wheel and sdist
69
+ if: matrix.python-version == '3.14'
70
+ run: |
71
+ pip install build
72
+ python -m build
73
+ - name: Upload build artifacts
74
+ if: matrix.python-version == '3.14'
75
+ uses: actions/upload-artifact@v4
76
+ with:
77
+ name: dist-artifacts
78
+ path: dist/
79
+
80
+ release:
81
+ name: Release
82
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
83
+ needs: [lint, test]
84
+ runs-on: ubuntu-24.04
85
+ environment:
86
+ name: pypi
87
+ url: https://pypi.org/p/sphinx-vtk-xref
88
+ permissions:
89
+ id-token: write # this permission is mandatory for trusted publishing
90
+ contents: write # required to create a release
91
+ steps:
92
+ - uses: actions/download-artifact@v4
93
+ - name: Flatten directory structure
94
+ run: |
95
+ mkdir -p dist/
96
+ find . -name '*.whl' -exec mv {} dist/ \;
97
+ find . -name '*.tar.gz' -exec mv {} dist/ \;
98
+ - name: Publish package distributions to PyPI
99
+ uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
100
+ with:
101
+ verbose: true
102
+ - name: Create GitHub Release
103
+ uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
104
+ with:
105
+ generate_release_notes: true
106
+ files: |
107
+ ./**/*.whl
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .idea/
3
+ sphinx_vtk_xref.egg-info/
4
+ __pycache__/
5
+ #*.
6
+ tests/tinypages/_build
7
+ .coverage
8
+ .coverage.*
9
+ dist
@@ -0,0 +1,42 @@
1
+ # Integration with GitHub Actions
2
+ # See https://pre-commit.ci/
3
+ ci:
4
+ autoupdate_commit_msg: 'chore: update pre-commit hooks'
5
+ autofix_prs: true
6
+ autoupdate_schedule: quarterly
7
+
8
+ repos:
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v5.0.0
11
+ hooks:
12
+ - id: check-merge-conflict
13
+ - id: debug-statements
14
+ - id: no-commit-to-branch
15
+ args: [--branch, main]
16
+
17
+ - repo: https://github.com/python-jsonschema/check-jsonschema
18
+ rev: 0.33.2
19
+ hooks:
20
+ - id: check-github-workflows
21
+
22
+ - repo: https://github.com/astral-sh/ruff-pre-commit
23
+ rev: v0.12.8
24
+ hooks:
25
+ - id: ruff-check
26
+ args: [--fix, --show-fixes]
27
+ exclude: tests/core/typing
28
+ - id: ruff-format
29
+ exclude: tests/core/typing
30
+
31
+ - repo: https://github.com/zizmorcore/zizmor-pre-commit
32
+ rev: v1.11.0
33
+ hooks:
34
+ - id: zizmor
35
+
36
+ - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
37
+ rev: v2.15.0
38
+ hooks:
39
+ - id: pretty-format-toml
40
+ args: [--autofix]
41
+ - id: pretty-format-yaml
42
+ args: [--autofix, --indent, '2']
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PyVista
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-vtk-xref
3
+ Version: 0.2.1
4
+ Summary: Sphinx extension for linking to VTK class documentation.
5
+ Author-email: PyVista Developers <info@pyvista.org>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/pyvista/sphinx-vtk-xref
8
+ Classifier: Framework :: Sphinx :: Extension
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/x-rst
12
+ License-File: LICENSE
13
+ Requires-Dist: sphinx>=8.1
14
+ Requires-Dist: beautifulsoup4
15
+ Requires-Dist: requests
16
+ Dynamic: license-file
17
+
18
+ Sphinx VTK XRef
19
+ ===============
20
+
21
+ ``sphinx-vtk-xref`` is a Sphinx extension for linking directly to
22
+ `VTK's documentation <https://vtk.org/doc/nightly/html/index.html>`_
23
+ using the ``:vtk:`` reference role.
24
+
25
+ Installation
26
+ ------------
27
+
28
+ #. Add ``sphinx-vtk-xref`` as a project dependency or install it with:
29
+
30
+ .. code-block:: bash
31
+
32
+ pip install sphinx-vtk-xref
33
+
34
+ #. Add ``sphinx_vtk_xref`` as an extension in your ``conf.py`` file used by
35
+ Sphinx. The exact setup depends on whether your documentation is written
36
+ in reStructuredText or Markdown.
37
+
38
+ reStructuredText
39
+ ~~~~~~~~~~~~~~~~
40
+
41
+ .. code-block:: python
42
+
43
+ extensions = [
44
+ ...,
45
+ 'sphinx_vtk_xref',
46
+ ]
47
+
48
+ Markdown (MyST)
49
+ ~~~~~~~~~~~~~~~
50
+
51
+ Markdown support requires `MyST-Parser <https://myst-parser.readthedocs.io>`_,
52
+ which dispatches Sphinx roles like ``:vtk:`` using its own ``{vtk}`` syntax.
53
+
54
+ .. code-block:: bash
55
+
56
+ pip install myst-parser
57
+
58
+ .. code-block:: python
59
+
60
+ extensions = [
61
+ ...,
62
+ 'sphinx_vtk_xref',
63
+ 'myst_parser',
64
+ ]
65
+ source_suffix = {
66
+ '.md': 'markdown',
67
+ }
68
+
69
+ Usage
70
+ -----
71
+
72
+ - Add links to VTK class documentation with the ``:vtk:`` role. For
73
+ example, write ``:vtk:`vtkImageData``` in docstrings to link directly
74
+ to the ``vtkImageData`` documentation. This will render as
75
+ `vtkImageData <https://vtk.org/doc/nightly/html/classvtkImageData.html>`_.
76
+
77
+ If using MyST, use ``{vtk}`vtkImageData``` instead.
78
+
79
+ - Link directly to class members such as methods or enums. For example,
80
+ write ``:vtk:`vtkImageData.GetSpacing``` to link directly to the
81
+ ``GetSpacing`` method. This will render as
82
+ `vtkImageData.GetSpacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_.
83
+
84
+ If using MyST, use ``{vtk}`vtkImageData.GetSpacing``` instead.
85
+
86
+ - Use ``~`` to shorten the title for the link and only show the class member
87
+ after the period. For example, ``:vtk:`~vtkImageData.GetSpacing```
88
+ will render as
89
+ `GetSpacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_.
90
+
91
+ If using MyST, use ``{vtk}`~vtkImageData.GetSpacing``` instead.
92
+
93
+ - Provide a custom title for the reference. For example,
94
+ ``:vtk:`Get Image Spacing <vtkImageData.GetSpacing>```
95
+ will render as
96
+ `Get Image Spacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_
97
+
98
+ If using MyST, use ``{vtk}`Get Image Spacing <vtkImageData.GetSpacing>```
99
+ instead.
100
+
101
+ Configuration
102
+ -------------
103
+
104
+ The following options can be set in ``conf.py``:
105
+
106
+ ``sphinx_vtk_xref_nitpicky``
107
+ Bool, default ``True``. Set to ``False`` to disable ``:vtk:`` link
108
+ checking. This is independent of Sphinx's own ``nitpicky`` option, so
109
+ you can turn off ``:vtk:`` link validation without affecting how the rest
110
+ of your project handles missing references. When disabled, the ``:vtk:``
111
+ role skips the HTTP request used to validate class and member references
112
+ (and to resolve member anchors) and instead links directly to the
113
+ (unvalidated) class documentation page.
114
+
115
+ .. code-block:: python
116
+
117
+ sphinx_vtk_xref_nitpicky = False
118
+
119
+ ``sphinx_vtk_xref_ignored_status_codes``
120
+ Collection of HTTP status codes, default ``{429, 500, 502, 503, 504}``.
121
+ These codes typically indicate a transient server-side issue (rate
122
+ limiting or upstream unavailability) rather than a genuinely-invalid
123
+ class reference, so they are logged as info messages and do not fail the
124
+ build, even with Sphinx's ``-W`` flag. The role falls back to the
125
+ (unvalidated) class URL in this case.
126
+
127
+ .. code-block:: python
128
+
129
+ sphinx_vtk_xref_ignored_status_codes = {404}
130
+
131
+ Notes
132
+ -----
133
+
134
+ - The URLs linking to the VTK documentation are checked to ensure they are valid
135
+ references. A warning is emitted if the reference is invalid, but the role
136
+ will still try to point to a valid URL where possible. Combine this with
137
+ Sphinx's own ``-W`` flag to fail the build on invalid links.
138
+
139
+ - The role does not currently support linking to nested members. For example,
140
+ linking to an enum member with ``:vtk:`vtkCommand.EventIds``` works,
141
+ but linking to a specific enum value with ``:vtk:`vtkCommand.EventIds.PickEvent```
142
+ does not.
@@ -0,0 +1,125 @@
1
+ Sphinx VTK XRef
2
+ ===============
3
+
4
+ ``sphinx-vtk-xref`` is a Sphinx extension for linking directly to
5
+ `VTK's documentation <https://vtk.org/doc/nightly/html/index.html>`_
6
+ using the ``:vtk:`` reference role.
7
+
8
+ Installation
9
+ ------------
10
+
11
+ #. Add ``sphinx-vtk-xref`` as a project dependency or install it with:
12
+
13
+ .. code-block:: bash
14
+
15
+ pip install sphinx-vtk-xref
16
+
17
+ #. Add ``sphinx_vtk_xref`` as an extension in your ``conf.py`` file used by
18
+ Sphinx. The exact setup depends on whether your documentation is written
19
+ in reStructuredText or Markdown.
20
+
21
+ reStructuredText
22
+ ~~~~~~~~~~~~~~~~
23
+
24
+ .. code-block:: python
25
+
26
+ extensions = [
27
+ ...,
28
+ 'sphinx_vtk_xref',
29
+ ]
30
+
31
+ Markdown (MyST)
32
+ ~~~~~~~~~~~~~~~
33
+
34
+ Markdown support requires `MyST-Parser <https://myst-parser.readthedocs.io>`_,
35
+ which dispatches Sphinx roles like ``:vtk:`` using its own ``{vtk}`` syntax.
36
+
37
+ .. code-block:: bash
38
+
39
+ pip install myst-parser
40
+
41
+ .. code-block:: python
42
+
43
+ extensions = [
44
+ ...,
45
+ 'sphinx_vtk_xref',
46
+ 'myst_parser',
47
+ ]
48
+ source_suffix = {
49
+ '.md': 'markdown',
50
+ }
51
+
52
+ Usage
53
+ -----
54
+
55
+ - Add links to VTK class documentation with the ``:vtk:`` role. For
56
+ example, write ``:vtk:`vtkImageData``` in docstrings to link directly
57
+ to the ``vtkImageData`` documentation. This will render as
58
+ `vtkImageData <https://vtk.org/doc/nightly/html/classvtkImageData.html>`_.
59
+
60
+ If using MyST, use ``{vtk}`vtkImageData``` instead.
61
+
62
+ - Link directly to class members such as methods or enums. For example,
63
+ write ``:vtk:`vtkImageData.GetSpacing``` to link directly to the
64
+ ``GetSpacing`` method. This will render as
65
+ `vtkImageData.GetSpacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_.
66
+
67
+ If using MyST, use ``{vtk}`vtkImageData.GetSpacing``` instead.
68
+
69
+ - Use ``~`` to shorten the title for the link and only show the class member
70
+ after the period. For example, ``:vtk:`~vtkImageData.GetSpacing```
71
+ will render as
72
+ `GetSpacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_.
73
+
74
+ If using MyST, use ``{vtk}`~vtkImageData.GetSpacing``` instead.
75
+
76
+ - Provide a custom title for the reference. For example,
77
+ ``:vtk:`Get Image Spacing <vtkImageData.GetSpacing>```
78
+ will render as
79
+ `Get Image Spacing <https://vtk.org/doc/nightly/html/classvtkImageData.html#ae6ebee83577b2d58c393a0df2f15b67d>`_
80
+
81
+ If using MyST, use ``{vtk}`Get Image Spacing <vtkImageData.GetSpacing>```
82
+ instead.
83
+
84
+ Configuration
85
+ -------------
86
+
87
+ The following options can be set in ``conf.py``:
88
+
89
+ ``sphinx_vtk_xref_nitpicky``
90
+ Bool, default ``True``. Set to ``False`` to disable ``:vtk:`` link
91
+ checking. This is independent of Sphinx's own ``nitpicky`` option, so
92
+ you can turn off ``:vtk:`` link validation without affecting how the rest
93
+ of your project handles missing references. When disabled, the ``:vtk:``
94
+ role skips the HTTP request used to validate class and member references
95
+ (and to resolve member anchors) and instead links directly to the
96
+ (unvalidated) class documentation page.
97
+
98
+ .. code-block:: python
99
+
100
+ sphinx_vtk_xref_nitpicky = False
101
+
102
+ ``sphinx_vtk_xref_ignored_status_codes``
103
+ Collection of HTTP status codes, default ``{429, 500, 502, 503, 504}``.
104
+ These codes typically indicate a transient server-side issue (rate
105
+ limiting or upstream unavailability) rather than a genuinely-invalid
106
+ class reference, so they are logged as info messages and do not fail the
107
+ build, even with Sphinx's ``-W`` flag. The role falls back to the
108
+ (unvalidated) class URL in this case.
109
+
110
+ .. code-block:: python
111
+
112
+ sphinx_vtk_xref_ignored_status_codes = {404}
113
+
114
+ Notes
115
+ -----
116
+
117
+ - The URLs linking to the VTK documentation are checked to ensure they are valid
118
+ references. A warning is emitted if the reference is invalid, but the role
119
+ will still try to point to a valid URL where possible. Combine this with
120
+ Sphinx's own ``-W`` flag to fail the build on invalid links.
121
+
122
+ - The role does not currently support linking to nested members. For example,
123
+ linking to an enum member with ``:vtk:`vtkCommand.EventIds``` works,
124
+ but linking to a specific enum value with ``:vtk:`vtkCommand.EventIds.PickEvent```
125
+ does not.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ build-backend = 'setuptools.build_meta'
3
+ requires = ['setuptools>=64', 'setuptools_scm>=8']
4
+
5
+ [dependency-groups]
6
+ dev = ['pytest', 'pytest-cov', 'pre-commit', 'myst-parser']
7
+
8
+ [project]
9
+ authors = [{name = 'PyVista Developers', email = 'info@pyvista.org'}]
10
+ classifiers = [
11
+ "Framework :: Sphinx :: Extension",
12
+ "License :: OSI Approved :: MIT License"
13
+ ]
14
+ dependencies = [
15
+ 'sphinx>=8.1',
16
+ 'beautifulsoup4',
17
+ 'requests'
18
+ ]
19
+ description = 'Sphinx extension for linking to VTK class documentation.'
20
+ dynamic = ['version']
21
+ license = {text = 'MIT'}
22
+ name = 'sphinx-vtk-xref'
23
+ readme = 'README.rst'
24
+ requires-python = '>=3.10'
25
+
26
+ [project.urls]
27
+ Homepage = 'https://github.com/pyvista/sphinx-vtk-xref'
28
+
29
+ [tool.coverage.run]
30
+ parallel = true
31
+ # The test suite spawns sphinx-build as a subprocess via ``sys.executable``;
32
+ # parallel mode + COVERAGE_PROCESS_START (set in tests/conftest.py) let the
33
+ # ``:vtk:`` role code be measured from inside those subprocesses.
34
+ source = ['sphinx_vtk_xref']
35
+
36
+ [tool.pytest.ini_options]
37
+ addopts = "--cov=sphinx_vtk_xref --cov-fail-under=85"
38
+ testpaths = 'tests'
39
+
40
+ [tool.ruff]
41
+ line-length = 100
42
+
43
+ [tool.setuptools]
44
+ packages = ['sphinx_vtk_xref']
45
+
46
+ [tool.setuptools_scm]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+