Skip to content

Commit b003a92

Browse files
authored
Add pygrep-hooks in .pre-commit-config.yaml to catch common mistakes in .rst files (#899)
* Copy pygrep-hooks from pybind11/.pre-commit-config.yaml * cleanup stray whitespace * Clean up cuda_core/DESCRIPTION.rst (piggy-back minor grammar fix) * Clean up cuda_python/DESCRIPTION.rst * Clean up cuda_core/docs/source/interoperability.rst * Clean up cuda_core/docs/source/release/*-notes.rst
1 parent 5307eec commit b003a92

File tree

8 files changed

+22
-14
lines changed

8 files changed

+22
-14
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
language: python
3131
additional_dependencies:
3232
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
33-
33+
3434
- id: no-markdown-in-docs-source
3535
name: Prevent markdown files in docs/source directories
3636
entry: bash -c
@@ -39,6 +39,14 @@ repos:
3939
pass_filenames: false
4040
always_run: true
4141

42+
# Checking for common mistakes
43+
- repo: https://github.com/pre-commit/pygrep-hooks
44+
rev: "v1.10.0"
45+
hooks:
46+
- id: rst-backticks
47+
- id: rst-directive-colons
48+
- id: rst-inline-touching-normal
49+
4250
- repo: https://github.com/PyCQA/bandit
4351
rev: 2d0b675b04c80ae42277e10500db06a0a37bae17 # frozen: 1.8.6
4452
hooks:

cuda_core/DESCRIPTION.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cuda-core: Pythonic access to CUDA core functionalities
1212
* `Examples <https://github.com/NVIDIA/cuda-python/tree/main/cuda_core/examples>`_
1313
* `Issue tracker <https://github.com/NVIDIA/cuda-python/issues/>`_
1414

15-
`cuda.core` is currently under active development. Any feedbacks or suggestions are welcomed!
15+
``cuda.core`` is currently under active development. Feedback and suggestions are welcome!
1616

1717

1818
Installation
@@ -22,4 +22,4 @@ Installation
2222
2323
pip install cuda-core[cu12]
2424
25-
Please refer to the `installation instructions <https://nvidia.github.io/cuda-python/cuda-core/latest/install.html>`_ for different ways of installing `cuda.core`, including building from source.
25+
Please refer to the `installation instructions <https://nvidia.github.io/cuda-python/cuda-core/latest/install.html>`_ for different ways of installing ``cuda.core``, including building from source.

cuda_core/docs/source/interoperability.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exposing their own stream types.
3838
To address this issue, we propose the :attr:`~_stream.IsStreamT.__cuda_stream__` protocol
3939
(currently version 0) as follows: For any Python objects that are meant to be interpreted
4040
as a stream, they should add a ``__cuda_stream__`` *method* that returns a 2-tuple: The
41-
version number (``0``) and the address of ``cudaStream_t`` (both as Python `int`):
41+
version number (``0``) and the address of ``cudaStream_t`` (both as Python ``int``):
4242

4343
.. code-block:: python
4444

cuda_core/docs/source/release/0.1.0-notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ Limitations
2020

2121
- All APIs are currently *experimental* and subject to change without deprecation notice.
2222
Please kindly share your feedback with us so that we can make ``cuda.core`` better!
23-
- Source code release only; `pip`/`conda` support is coming in a future release
23+
- Source code release only; ``pip``/``conda`` support is coming in a future release
2424
- Windows TCC mode is `not yet supported <https://github.com/NVIDIA/cuda-python/issues/206>`_

cuda_core/docs/source/release/0.1.1-notes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ Limitations
4545

4646
- All APIs are currently *experimental* and subject to change without deprecation notice.
4747
Please kindly share your feedback with us so that we can make ``cuda.core`` better!
48-
- Using ``cuda.core`` with NVRTC or nvJitLink installed from PyPI via `pip install` is currently
48+
- Using ``cuda.core`` with NVRTC or nvJitLink installed from PyPI via ``pip install`` is currently
4949
not supported. This will be fixed in a future release.
5050
- Some :class:`~LinkerOptions` are only available when using a modern version of CUDA. When using CUDA <12,
5151
the backend is the cuLink API which supports only a subset of the options that nvjitlink does.
5252
Further, some options aren't available on CUDA versions <12.6.
5353
- To use ``cuda.core`` with Python 3.13, it currently requires building ``cuda-python`` from source
54-
prior to `pip install`. This extra step will be fixed soon.
54+
prior to ``pip install``. This extra step will be fixed soon.

cuda_core/docs/source/release/0.3.0-notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ New features
3232

3333
- :class:`~_module.Kernel` adds :attr:`~_module.Kernel.num_arguments` and :attr:`~_module.Kernel.arguments_info` for introspection of kernel arguments. (#612)
3434
- Add pythonic access to kernel occupancy calculation functions via :attr:`Kernel.occupancy`. (#648)
35-
- Support launching cooperative kernels by setting :attr:`LaunchConfig.cooperative_launch` to `True`.
35+
- Support launching cooperative kernels by setting :attr:`LaunchConfig.cooperative_launch` to ``True``.
3636
- A name can be assigned to :class:`ObjectCode` instances generated by both :class:`Program` and :class:`Linker` through their respective options.
3737
- Expose :class:`Buffer`, :class:`DeviceMemoryResource`, :class:`LegacyPinnedMemoryResource`, and :class:`MemoryResource` to the top namespace.
3838
- Before this release, the internal :class:`Buffer` class had an ``__init__()`` constructor. To align with the design of cuda.core objects,

cuda_core/docs/source/release/0.X.Y-notes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Breaking Changes
1919
----------------
2020

2121
- **LaunchConfig grid parameter interpretation**: When :attr:`LaunchConfig.cluster` is specified, the :attr:`LaunchConfig.grid` parameter now correctly represents the number of clusters instead of blocks. Previously, the grid parameter was incorrectly interpreted as blocks, causing a mismatch with the expected C++ behavior. This change ensures that ``LaunchConfig(grid=4, cluster=2, block=32)`` correctly produces 4 clusters × 2 blocks/cluster = 8 total blocks, matching the C++ equivalent ``cudax::make_hierarchy(cudax::grid_dims(4), cudax::cluster_dims(2), cudax::block_dims(32))``.
22-
- When :class:`Buffer` is closed, :attr:`Buffer.handle` is now set to `None`. It was previously set to ``0`` by accident.
22+
- When :class:`Buffer` is closed, :attr:`Buffer.handle` is now set to ``None``. It was previously set to ``0`` by accident.
2323

2424

2525
New features

cuda_python/DESCRIPTION.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ CUDA Python is the home for accessing NVIDIA's CUDA platform from Python. It con
1010
* `cuda.core <https://nvidia.github.io/cuda-python/cuda-core/latest>`_: Pythonic access to CUDA Runtime and other core functionalities
1111
* `cuda.bindings <https://nvidia.github.io/cuda-python/cuda-bindings/latest>`_: Low-level Python bindings to CUDA C APIs
1212
* `cuda.cooperative <https://nvidia.github.io/cccl/python/cooperative>`_: A Python package providing CCCL's reusable block-wide and warp-wide *device* primitives for use within Numba CUDA kernels
13-
* `cuda.parallel <https://nvidia.github.io/cccl/python/parallel>`_: A Python package for easy access to CCCL's highly efficient and customizable parallel algorithms, like `sort`, `scan`, `reduce`, `transform`, etc, that are callable on the *host*
13+
* `cuda.parallel <https://nvidia.github.io/cccl/python/parallel>`_: A Python package for easy access to CCCL's highly efficient and customizable parallel algorithms, like ``sort``, ``scan``, ``reduce``, ``transform``, etc, that are callable on the *host*
1414
* `numba.cuda <https://nvidia.github.io/numba-cuda/>`_: Numba's target for CUDA GPU programming by directly compiling a restricted subset of Python code into CUDA kernels and device functions following the CUDA execution model.
1515

1616
For access to NVIDIA CPU & GPU Math Libraries, please refer to `nvmath-python <https://docs.nvidia.com/cuda/nvmath-python/latest>`_.
1717

18-
CUDA Python is currently undergoing an overhaul to improve existing and bring up new components. All of the previously available functionalities from the `cuda-python` package will continue to be available, please refer to the `cuda.bindings <https://nvidia.github.io/cuda-python/cuda-bindings/latest>`_ documentation for installation guide and further detail.
18+
CUDA Python is currently undergoing an overhaul to improve existing and bring up new components. All of the previously available functionalities from the ``cuda-python`` package will continue to be available, please refer to the `cuda.bindings <https://nvidia.github.io/cuda-python/cuda-bindings/latest>`_ documentation for installation guide and further detail.
1919

2020
cuda-python as a metapackage
2121
============================
2222

23-
`cuda-python` is now a metapackage that contains a collection of subpackages. Each subpackage is versioned independently, allowing installation of each component as needed.
23+
``cuda-python`` is now a metapackage that contains a collection of subpackages. Each subpackage is versioned independently, allowing installation of each component as needed.
2424

2525
Subpackage: cuda.core
2626
---------------------
2727

28-
The `cuda.core` package offers idiomatic, pythonic access to CUDA Runtime and other functionalities.
28+
The ``cuda.core`` package offers idiomatic, pythonic access to CUDA Runtime and other functionalities.
2929

3030
The goals are to
3131

@@ -38,7 +38,7 @@ The goals are to
3838
Subpackage: cuda.bindings
3939
-------------------------
4040

41-
The `cuda.bindings` package is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python.
41+
The ``cuda.bindings`` package is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python.
4242

4343
The list of available interfaces are:
4444

0 commit comments

Comments
 (0)