Skip to content

Conversation

@rparolin
Copy link
Collaborator

@rparolin rparolin commented Feb 2, 2026

Problem

cuda-core depends on cuda-bindings at build time and needs access to Cython .pxd header files. Previously, we used wildcard dependencies (cuda-bindings = "*") because Cython cannot find .pxd files through Python's editable install meta path finders ([Cython issue #7326] cython/cython#7326)). This meant pixi couldn't track local dependencies, so rebuilds had to be managed manually.

Solution

Implemented the .pth file workaround from scikit-build-core PR#516:

  1. During build: Add cuda-bindings path to sys.path so Cython can find .pxd files during compilation
  2. After build: Patch the editable install .pth file to maintain the path for imports
    This enables changing from:

cuda-bindings = "*" # No dependency tracking

To:

cuda-bindings = { path = "../cuda_bindings" } # Full dependency tracking

@rparolin rparolin requested a review from cpcloud February 2, 2026 20:55
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 2, 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.

@rparolin rparolin requested a review from kkraus14 February 2, 2026 20:56
@rparolin rparolin changed the title using .pth files Cython .pth file support for pixi path dependencies Feb 2, 2026
@rparolin
Copy link
Collaborator Author

rparolin commented Feb 2, 2026

/ok to test

@github-actions

This comment has been minimized.

Copy link
Contributor

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ... kind of love and hate this PR.

# If cuda-bindings isn't available yet, we can't add the path
# This might happen in some build scenarios, but it's okay - the
# wildcard dependency will work in those cases
print("cuda-bindings not found in current environment, skipping .pth modification")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print("cuda-bindings not found in current environment, skipping .pth modification")

I'm not sure that's helpful here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd err on the side of printing out an error message rather than failing silently.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, let's also print to stderr (via file=sys.stderr)

@rparolin rparolin marked this pull request as ready for review February 3, 2026 17:41
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 3, 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.

rparolin and others added 8 commits February 3, 2026 09:43
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
@rparolin
Copy link
Collaborator Author

rparolin commented Feb 3, 2026

/ok to test

@rparolin rparolin enabled auto-merge (squash) February 3, 2026 17:54
@rparolin rparolin self-assigned this Feb 3, 2026
@rparolin rparolin merged commit dcaa6a7 into NVIDIA:main Feb 3, 2026
86 checks passed
@rparolin rparolin added this to the cuda.core beta 12 milestone Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants