Skip to content

Generate pylibcudf stubs with stubgen-pyx - #23628

Draft
vyasr wants to merge 1 commit into
NVIDIA:mainfrom
vyasr:codex/stubgen-pyx-pylibcudf-stubs
Draft

Generate pylibcudf stubs with stubgen-pyx#23628
vyasr wants to merge 1 commit into
NVIDIA:mainfrom
vyasr:codex/stubgen-pyx-pylibcudf-stubs

Conversation

@vyasr

@vyasr vyasr commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a local pre-commit hook that regenerates tracked public pylibcudf .pyi files with stubgen-pyx==0.2.18
  • add a wrapper script to scope generation to the existing public pylibcudf stub set and preserve SPDX headers
  • replace the handwritten pylibcudf stubs with generated output for review

Motivation

We have been improving stubgen-pyx upstream, and this draft gives cudf developers a concrete diff for evaluating whether generated pylibcudf stubs are close enough to replace the handwritten files.

Notes for reviewers

This is intentionally a draft/evaluation PR. The generated stubs are much more complete and source-derived than the handwritten versions, but there are still visible gaps worth reviewing:

  • CudaStreamLike is lost in generated signatures, generally becoming object | None
  • some curated public helper aliases and protocols disappear in favor of lower-level generated imports
  • some generated signatures expose implementation details or private helpers that the handwritten stubs hid
  • full mypy currently reports generated-stub issues and downstream precision regressions

Validation

  • deleted tracked python/pylibcudf/pylibcudf/**/*.pyi files and regenerated them with pre-commit run stubgen-pyx-pylibcudf --all-files
  • reran pre-commit run stubgen-pyx-pylibcudf --all-files after rebasing on latest upstream/main; it passed with no further changes
  • pre-commit run ruff --files ci/checks/generate_pylibcudf_stubs.py .pre-commit-config.yaml
  • pre-commit run ruff-format --files ci/checks/generate_pylibcudf_stubs.py .pre-commit-config.yaml
  • pre-commit run yamllint --files .pre-commit-config.yaml
  • pre-commit run verify-copyright --files ...
  • git diff --check

Full commit-time mypy was also run while preparing this branch and currently fails on the generated stubs; that failure is part of the review signal for this draft.

@copy-pr-bot

copy-pr-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added Python Affects Python cuDF API. pylibcudf Issues specific to the pylibcudf package labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pylibcudf Issues specific to the pylibcudf package Python Affects Python cuDF API.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant