Skip to content

test(core): add cuda.core.__all__ vs public docs consistency check#2347

Open
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:test/api-docs-consistency-2326
Open

test(core): add cuda.core.__all__ vs public docs consistency check#2347
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:test/api-docs-consistency-2326

Conversation

@aryanputta

Copy link
Copy Markdown
Contributor

Description

Closes #2326.

Adds cuda_core/tests/test_api_docs_consistency.py, the follow-on consistency check requested in the #2300 review.

What it checks

  • test_all_exports_resolve: every name in cuda.core.__all__ resolves via hasattr (the stale-name guard suggested in the review).
  • test_public_symbols_are_documented: fails with "public by cuda.core.__all__ but missing from public docs (api.rst)" plus the offending names.
  • test_documented_symbols_are_exported: fails with "documented as public in api.rst but not exported by cuda.core.__all__" plus the offending names.

How the docs are parsed

  • .. module:: and .. currentmodule:: directives are tracked, so only autosummary entries and .. data:: directives active under cuda.core count. Entries under cuda.core.utils or cuda.core.texture are excluded automatically.
  • Dotted entries such as graph.Graph or checkpoint.Process are submodule namespaces, not flat cuda.core names, and are excluded.
  • Symbols documented in api_private.rst are accepted as documented by their trailing name, so returned helpers such as _device_resources.DeviceResources do not fail the public-docs direction.

Ordering with #2300

The tests skip when cuda.core.__all__ is not defined, so this is safe to land before #2300 and activates once #2300 merges. The docs fixture also skips when docs sources are unavailable (installed-wheel test runs).

Validation

I do not have a CUDA-capable machine available, so I validated with a stubbed cuda.core module against the real RST files in this repo:

ruff check and ruff format pass.

Closes NVIDIA#2326.

Parses docs/source/api.rst (autosummary entries and data directives while
cuda.core is the active module) and compares the flat public names against
cuda.core.__all__ in both directions. Dotted entries such as graph.Graph or
checkpoint.Process are submodule namespaces and are excluded. Symbols
documented in api_private.rst are accepted as documented so returned-helper
docs do not fail the check.

The tests skip when cuda.core.__all__ is not defined, so this lands
independently of NVIDIA#2300 and activates once NVIDIA#2300 merges. Also adds the
__all__-names-resolve guard suggested in the NVIDIA#2300 review.

Signed-off-by: Aryan <aryansputta@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA]: Add a consistency check for cuda.core.__all__ vs cuda_core/docs/source/api.rst

1 participant