Skip to content

Examples: Standardize imports and dependency policy #1677

@rparolin

Description

@rparolin

Parent issue: #1673

Goal

Apply consistent import ordering and evaluate external dependency usage across all examples.

Current state

  • At least 5 different import ordering patterns exist across the 11 cuda.core examples.
  • Some start with sys, some have no stdlib imports, some use try/except for optional deps inline.
  • No consistent grouping (stdlib → third-party → cuda).
  • CuPy is required by 7 of 11 cuda.core examples.
  • Only show_device_properties.py has zero external dependencies.
  • Optional dependency handling (try/except) is inconsistent.

Decisions needed

  1. What import group ordering should examples follow (e.g., stdlib → third-party → cuda)?
  2. Should we reduce CuPy dependency where possible (e.g., use NumPy + manual device allocation)?
  3. What is the standard pattern for optional dependency handling (try/except with skip vs hard fail)?

Files affected

All 25 example files listed in #1673.

Metadata

Metadata

Assignees

Labels

cuda.coreEverything related to the cuda.core module

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions