Skip to content

Restructure graph/ subpackage to use __all__ and star imports#1944

Open
mdboom wants to merge 1 commit intoNVIDIA:mainfrom
mdboom:graph-subpackage-star-imports
Open

Restructure graph/ subpackage to use __all__ and star imports#1944
mdboom wants to merge 1 commit intoNVIDIA:mainfrom
mdboom:graph-subpackage-star-imports

Conversation

@mdboom
Copy link
Copy Markdown
Contributor

@mdboom mdboom commented Apr 17, 2026

Migrate the graph/ subpackage to follow the same pattern used by _memory/ and system/:

  • Each submodule defines its own __all__ list
  • The subpackage __init__.py uses from ._module import * to assemble the package namespace

Changes:

  • _graph_builder.pyx: added __all__ = ['Graph', 'GraphBuilder', 'GraphCompleteOptions', 'GraphDebugPrintOptions']
  • _graph_def.pyx: added __all__ = ['Condition', 'GraphAllocOptions', 'GraphDef']
  • _graph_node.pyx: added __all__ = ['GraphNode']
  • _subclasses.pyx: added __all__ with all 15 node subclasses
  • graph/__init__.py: replaced explicit named imports with star imports

This pattern allows modular organization with clear star-import behavior, making it easier to add or move components without updating the __init__.py each time.

EDIT: This was credited in the epic but got lost here -- this is based on @Andy-Jost's guideline that never got merged

Add __all__ to each graph submodule and rewrite graph/__init__.py
to use 'from ._module import *' pattern, matching the convention
already used by _memory/ and system/ subpackages.

- _graph_builder.pyx: __all__ = Graph, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions
- _graph_def.pyx: __all__ = Condition, GraphAllocOptions, GraphDef
- _graph_node.pyx: __all__ = GraphNode
- _subclasses.pyx: __all__ = all 15 node subclasses
- __init__.py: replaced explicit named imports with star imports
@mdboom mdboom added this to the cuda.core next milestone Apr 17, 2026
@mdboom mdboom added the cuda.core Everything related to the cuda.core module label Apr 17, 2026
@mdboom mdboom self-assigned this Apr 17, 2026
@github-actions
Copy link
Copy Markdown

@mdboom mdboom requested a review from Andy-Jost April 17, 2026 18:08
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.

1 participant