Skip to content

Conversation

@kkraus14
Copy link
Collaborator

@kkraus14 kkraus14 commented Jan 9, 2026

This PR addresses two documentation issues:

Fix Cython class documentation (Fixes #1215)

Cython cdef class types and Python classes inheriting from them were not being documented correctly. The cyclass.rst template uses autoattribute instead of autoproperty because Cython extension types don't expose their properties the same way as pure Python classes.

Enable class members in sidebar navigation (Fixes #1100)

The "On This Page" sidebar was not showing class methods and attributes. Fixed with multiple configuration changes.

Changes

1. Sphinx TOC configuration (conf.py files)

  • toc_object_entries = True - Sphinx 5.1+ option to add object descriptions to TOC
  • toc_object_entries_show_parents = "domain" - Shows class-prefixed names in sidebar
  • "show_toc_level": 3 - pydata-sphinx-theme option to show more TOC levels
  • "secondary_sidebar_items": ["page-toc"] - Explicit secondary sidebar configuration

2. Template assignments

Applied cyclass.rst template to all Cython cdef class types and Python classes that inherit from them:

Template Classes
cyclass.rst Buffer, Stream, Event, MemoryResource, DeviceMemoryResource, GraphMemoryResource, PinnedMemoryResource, ManagedMemoryResource, LegacyPinnedMemoryResource, VirtualMemoryResource, DeviceProperties, IPCAllocationHandle, IPCBufferDescriptor, system.Device, StridedMemoryView
dataclass.rst DeviceMemoryResourceOptions, PinnedMemoryResourceOptions, ManagedMemoryResourceOptions, EventOptions, StreamOptions, LaunchConfig, GraphCompleteOptions, GraphDebugPrintOptions, VirtualMemoryResourceOptions
Default (class.rst) Device, Graph, GraphBuilder, Kernel, ObjectCode, Program, Linker, etc.

3. Template improvements

  • cyclass.rst: Added .. rubric:: Attributes header for consistency with Methods section
  • cyclass.rst: Reordered to list Methods before Attributes (matching class.rst)

Result

  • Cython class properties and attributes are now properly documented
  • The "On This Page" sidebar now shows class methods and attributes nested under the class name, similar to older versions with the furo theme

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Jan 9, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@github-actions

This comment has been minimized.

@kkraus14 kkraus14 force-pushed the fix-device-properties-docs branch from 28a91ab to 13292b1 Compare January 9, 2026 02:38
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14 kkraus14 marked this pull request as draft January 9, 2026 03:11
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Jan 9, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@kkraus14 kkraus14 changed the title Fix documentation to properly show class methods and attributes Fix documentation: DeviceProperties display and sidebar navigation Jan 9, 2026
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14 kkraus14 force-pushed the fix-device-properties-docs branch 2 times, most recently from 50b6537 to 18fe7df Compare January 9, 2026 03:44
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

1 similar comment
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14 kkraus14 force-pushed the fix-device-properties-docs branch from 14b4c8b to b2d165f Compare January 9, 2026 04:16
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

7 similar comments
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14 kkraus14 marked this pull request as ready for review January 9, 2026 06:29
DeviceProperties is a Cython cdef class, but was being documented
without specifying the cyclass.rst template. This caused Sphinx to
use the default class template which uses autoproperty, which doesn't
work correctly with Cython extension types.

The cyclass.rst template uses autoattribute instead, which properly
documents the properties of Cython classes.

Fixes NVIDIA#1215
Add toc_object_entries=True to all conf.py files to include object
descriptions (methods, attributes, etc.) in the table of contents.
This is a Sphinx 5.1+ feature that should enable the 'On This Page'
sidebar to show class methods and properties.

Also set toc_object_entries_show_parents='hide' for cleaner display
without redundant parent class names.

Partially addresses NVIDIA#1100
…templates

Update autosummary templates (class.rst, cyclass.rst, protocol.rst) to
list methods and attributes directly under the class without separate
section headings. Methods are listed first, followed by attributes.

Combined with toc_object_entries=True in conf.py, individual methods
and attributes will appear directly in the 'On This Page' sidebar,
providing navigation similar to what was available in older versions
with the furo theme.

Fixes NVIDIA#1100
Change toc_object_entries_show_parents from 'hide' to 'domain' so that
the sidebar TOC shows class-prefixed names (e.g., Device.allocate())
while the main documentation shows just the method/attribute names.

Fixed template indentation to ensure automethod/autoattribute directives
are properly nested inside the autoclass block.
This restores the original template formatting where Methods and Attributes
are organized under rubric headings (which don't appear in TOC).

Note: pydata-sphinx-theme's secondary sidebar only shows document headings,
not autodoc entries. Methods/attributes won't appear in the sidebar without
using actual section headings, which would add extra headers to the main body.
- Add secondary_sidebar_items with page-toc and sourcelink
- Set show_toc_level: 3 to show more TOC levels by default
- Keep toc_object_entries = True for Sphinx to add object entries to TOC

This should make autodoc entries appear in the secondary sidebar if
Sphinx's toc_object_entries properly populates the page TOC.
Public API Cython classes now using cyclass.rst:
- Buffer, MemoryResource
- Stream, StreamOptions
- Event, EventOptions
- DeviceMemoryResource, DeviceMemoryResourceOptions
- PinnedMemoryResource, PinnedMemoryResourceOptions
- ManagedMemoryResource, ManagedMemoryResourceOptions
- LaunchConfig

Private API Cython classes now using cyclass.rst:
- IPCAllocationHandle, IPCBufferDescriptor
- DeviceProperties (already was)
- Cython dataclasses (StreamOptions, EventOptions, *ResourceOptions)
  stay under dataclass.rst template
- Pure Cython cdef classes (Buffer, Stream, Event, MemoryResource,
  LaunchConfig) use cyclass.rst template
- Classes inheriting from Cython (GraphMemoryResource,
  LegacyPinnedMemoryResource, VirtualMemoryResource) use cyclass.rst
- Restored original ordering
- Device, Graph, GraphBuilder are regular Python classes (use default)
- LaunchConfig uses dataclass template per project convention
@kkraus14 kkraus14 force-pushed the fix-device-properties-docs branch from 1c7cb4a to 0ad1a8a Compare January 9, 2026 06:30
@kkraus14 kkraus14 added the documentation Improvements or additions to documentation label Jan 9, 2026
@kkraus14 kkraus14 self-assigned this Jan 9, 2026
@kkraus14
Copy link
Collaborator Author

kkraus14 commented Jan 9, 2026

/ok to test

@kkraus14 kkraus14 merged commit 3722ea4 into NVIDIA:main Jan 10, 2026
81 checks passed
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

@kkraus14
Copy link
Collaborator Author

Should probably backport the toc level fixes here to 12.9.x as well.

@leofang leofang added this to the cuda.core beta 11 milestone Jan 12, 2026
@leofang leofang added the bug Something isn't working label Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Device properties docs are broken [DOC]: The new theme does not list any class methods on the right

3 participants