Repository navigation
build: keep _build_shared.py as identical copies - #3036
Conversation
Replace the cuda_core symlink with a regular file and restore a pre-commit check that uses git diff --no-index so the two packages stay byte-identical without requiring Git symlink support to build.
|
/ok to test 18ecce0 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe pull request adds build helpers to ChangesShared Build Helpers
Priority: ⬇️ Low Change: Bug fix Merge Risk: ⚪ Minimal · up to The change removes the Windows build dependency on symlink support while preserving package-local build paths and checking that the helper copies match. No concrete PR-specific merge risk remains.
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
0aff2716-401b-4bb2-8ce4-2907013c389c
📒 Files selected for processing (4)
.pre-commit-config.yamlCONTRIBUTING.mdcuda_core/_build_shared.pycuda_core/_build_shared.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
0aff2716-401b-4bb2-8ce4-2907013c389c
📒 Files selected for processing (4)
.pre-commit-config.yamlCONTRIBUTING.mdcuda_core/_build_shared.pycuda_core/_build_shared.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
🛑 Comments failed to post (2)
cuda_core/_build_shared.py (2)
6-9: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
important: The module docstring is out of date after this PR. Lines 6-7 still say that
cuda_core/_build_shared.pyis a symlink to this file, but this PR replaces the symlink with a regular file. Line 389 has the same problem: it says "the package's own copy through the symlink". Both copies must stay byte-identical becausecheck-build-shared-synccompares them. Make the same wording fix incuda_bindings/_build_shared.pyand in this file. Say that the two files are identical copies and that the pre-commit hook checks them.Path(__file__)resolves under the package that loads the module, so the rest of that explanation is still correct.-This is the single source of truth. ``cuda_core/_build_shared.py`` is a symlink -to this file. Python does not dereference symlinks in ``__file__``, so any -``Path(__file__)``-relative location in here resolves under whichever package -loads it. +``cuda_bindings/_build_shared.py`` and ``cuda_core/_build_shared.py`` are +identical copies, kept in sync by the ``check-build-shared-sync`` pre-commit +hook. Any ``Path(__file__)``-relative location in here resolves under +whichever package loads it.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.``cuda_bindings/_build_shared.py`` and ``cuda_core/_build_shared.py`` are identical copies, kept in sync by the ``check-build-shared-sync`` pre-commit hook. Any ``Path(__file__)``-relative location in here resolves under whichever package loads it.
54-62: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
suggestion: The fallback path crashes when the
cudapackage itself cannot be imported. In that case, Line 57 setscuda = None. If the loop then finds apathfinderdirectory, Line 62 runsNone.__path__and raisesAttributeErrorinstead of the intended error. Handle thecuda is Nonecase on its own. For example, raise theModuleNotFoundErrorwith the explanation, or addsp_cuda's parent tosys.pathand import again. Apply the same fix to both copies.
|
rwgk
left a comment
There was a problem hiding this comment.
I'm approving: The regular-file rollback is a good short-term way to keep Windows and SWQA builds predictable while we revisit the longer-term symlink-versus-copy design.
Before merging, I suggest folding in changes similar to c756374, with this rationale in mind:
- It could be misleading (especially for agents) if helper comments, maintainer instructions, and installation docs still describe the core file as a symlink and make Windows symlink setup sound build-critical.
- Representation-neutral wording leaves an accurate breadcrumb whether we keep copies longer or return to a symlink.
Scope
- Marks
cuda_bindings/_build_shared.pyas canonical and the core path as either a symlink or a byte-for-byte identical copy. - Clarifies that
core.symlinks=falsesupports source builds and tests; the remaining links are documentation and metadata. - Points the synchronization error toward copying the canonical bindings file to core.
Commit c756374 changes only documentation, comments, and that diagnostic.
|
/ok to test 67ea7cf |
Description
Follow-up to #3000. That PR shared the PEP 517 helpers through a
cuda_core/_build_shared.pysymlink, which makes a Windows source build depend oncore.symlinks=true. This change goes back to two regular files kept byte-identical by a pre-commit check.cuda_core/_build_shared.pyis a100644copy ofcuda_bindings/_build_shared.py.check-build-shared-synccompares them withgit diff --no-index; CI--all-filesstill catches drift. There is no intended build-flag or import-path change: each backend still loads_build_sharedfrom its own package directory.Checklist