Skip to content

Commit efd58e4

Browse files
mdboomrwgk
andauthored
Use tags for blob links from a release (#3165)
* Use tags for blob links from a release * Clarify version-neutral package names after source-root rename Signed-off-by: Ralf W. Grosse-Kunstleve <[email protected]> --------- Signed-off-by: Ralf W. Grosse-Kunstleve <[email protected]> Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
1 parent 585038d commit efd58e4

15 files changed

Lines changed: 78 additions & 23 deletions

File tree

‎.github/workflows/ci-pixi-source-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
# The round trip (not just cu13 -> cu12) is what catches the second half:
132132
# coming back to cu13 must not silently reuse the cu12 extension.
133133
#
134-
# cuda_core only: cuda_bindings_13 cannot be source-built in its cu12
134+
# cuda_core only: cuda-bindings cannot be source-built in its cu12
135135
# environment at all, for reasons unrelated to stale artifacts.
136136
build-identity-roundtrip:
137137
name: "cu13 -> cu12 -> cu13 round trip (linux-64, CPU)"

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ jobs:
122122
#
123123
# Dependency graph (verified in pyproject.toml files):
124124
# cuda_pathfinder -> (no internal deps)
125-
# cuda_bindings_13 -> cuda_pathfinder
126-
# cuda_core -> cuda_pathfinder, cuda_bindings_13
127-
# cuda_python -> cuda_pathfinder, cuda_bindings_13, cuda_core (meta package)
125+
# cuda_bindings -> cuda_pathfinder
126+
# cuda_core -> cuda_pathfinder, cuda_bindings
127+
# cuda_python -> cuda_pathfinder, cuda_bindings, cuda_core (meta package)
128128
#
129129
# A change to cuda_pathfinder (or shared infra) forces a rebuild of every
130-
# downstream module. A change to cuda_bindings_13 forces rebuild of cuda_core.
131-
# A change to cuda_core alone skips rebuilding/retesting cuda_bindings_13 and
130+
# downstream module. A change to cuda_bindings forces rebuild of cuda_core.
131+
# A change to cuda_core alone skips rebuilding/retesting cuda_bindings and
132132
# cuda_pathfinder, but still retests the downstream cuda-python metapackage.
133133
# Shared build/orchestration changes run the full pipeline; test-only CI
134134
# infrastructure runs every test suite without rebuilding package wheels.

‎cuda_bindings_13/AGENTS.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ subpackage in the `cuda-python` monorepo.
1919
- **Platform internals**: `cuda/bindings/_internal/` contains
2020
platform-specific implementation files and support code.
2121
- **Build backend**: `build_hooks.py` drives extension configuration and
22-
Cythonization. Logic shared with `cuda_core` (toolchain selection, the
23-
compiler flag set, the Cython cache helpers and the rebuild stamps) lives
24-
in `_build_shared.py`. `cuda_bindings_13/_build_shared.py` is canonical;
25-
`cuda_core/_build_shared.py` must be either a symlink to it or a byte-for-byte
26-
identical copy.
22+
Cythonization. Logic shared with `cuda_core` and `cuda_pathfinder`
23+
(toolchain selection, the compiler flag set, the Cython cache helpers, the
24+
rebuild stamps and the release-tag pinning of README links) lives in
25+
`_build_shared.py`. `cuda_bindings_13/_build_shared.py` is canonical;
26+
the `cuda_core` and `cuda_pathfinder` copies must each be either a symlink to
27+
it or a byte-for-byte identical copy.
2728

2829
## Generated-source workflow
2930

‎cuda_bindings_13/_build_shared.py‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
"""Build helpers shared by the cuda-bindings and cuda-core PEP 517 backends.
4+
"""Build helpers shared by the cuda-bindings, cuda-core and cuda-pathfinder builds.
55
66
``cuda_bindings_13/_build_shared.py`` is canonical. ``cuda_core/_build_shared.py``
7-
is either a symlink to it or a byte-for-byte identical copy. Both backends load
7+
and ``cuda_pathfinder/_build_shared.py`` are each either a symlink to it or a
8+
byte-for-byte identical copy. Both backends load
89
the helper through their package-local path, keeping ``Path(__file__)``-relative
910
state package-local.
1011
@@ -30,6 +31,7 @@
3031
import functools
3132
import hashlib
3233
import os
34+
import re
3335
import shlex
3436
import shutil
3537
import sys
@@ -509,3 +511,29 @@ def record_build_key(stamp, key):
509511
"""
510512
stamp.parent.mkdir(parents=True, exist_ok=True)
511513
stamp.write_text(key + "\n", encoding="utf-8")
514+
515+
516+
_SOURCE_LINK_RE = re.compile(r"(https://github\.com/NVIDIA/cuda-python/(?:blob|tree))/main/")
517+
518+
519+
def make_egg_info_command(tag_prefix):
520+
"""Return an ``egg_info`` command that pins README source links to the release tag.
521+
522+
DESCRIPTION.rst links to ``main`` so that it renders correctly in the
523+
repository. In a release build, the command pins those links to the tag
524+
that produced the wheel (``tag_prefix`` followed by the version), so that
525+
they survive later repository changes. Development builds keep ``main``.
526+
"""
527+
from packaging.version import Version
528+
from setuptools.command.egg_info import egg_info
529+
530+
class ReleaseLinksEggInfo(egg_info):
531+
def run(self):
532+
metadata = self.distribution.metadata
533+
version = Version(self.distribution.get_version())
534+
if not (version.is_devrelease or version.local):
535+
tag = f"{tag_prefix}{version}"
536+
metadata.long_description = _SOURCE_LINK_RE.sub(rf"\1/{tag}/", metadata.long_description)
537+
super().run()
538+
539+
return ReleaseLinksEggInfo

‎cuda_bindings_13/setup.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from setuptools.command.build_ext import build_ext as _build_ext
1212
from setuptools.command.build_py import build_py as _build_py
1313

14-
from _build_shared import drop_empty_venv_include_dir
14+
from _build_shared import drop_empty_venv_include_dir, make_egg_info_command
1515

1616
if os.environ.get("PARALLEL_LEVEL") is not None:
1717
warn(
@@ -65,6 +65,7 @@ def finalize_options(self):
6565
cmdclass={
6666
"build_ext": build_ext,
6767
"build_py": build_py,
68+
"egg_info": make_egg_info_command("v"),
6869
},
6970
zip_safe=False,
7071
)

‎cuda_core/AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This file describes `cuda_core`, the high-level Pythonic CUDA subpackage in the
2323
one `_cpp/<name>.cpp` or as a directory `_cpp/<name>/` whose sources all
2424
compile into the `_<name>` extension (`_cpp/rt/` for `_rt`).
2525
- **Build backend**: `build_hooks.py` handles Cython extension setup and build
26-
dependency wiring. Logic shared with `cuda_bindings_13` (toolchain selection,
26+
dependency wiring. Logic shared with `cuda-bindings` (toolchain selection,
2727
the compiler flag set, the Cython cache helpers and the rebuild stamps)
2828
lives in `_build_shared.py`. `cuda_bindings_13/_build_shared.py` is canonical;
2929
`cuda_core/_build_shared.py` must be either a symlink to it or a byte-for-byte

‎cuda_core/docs/source/10_minutes_to_cuda_core.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@ for a complete capture-and-replay example with a measured speedup.
316316
Beyond the stream capture shown here, ``cuda.core`` also provides an explicit
317317
graph interface (the :mod:`cuda.core.graph` module) for building, inspecting, and
318318
modifying graphs directly, including graphs first produced by capture. The
319-
project's `graph tests
320-
<https://github.com/NVIDIA/cuda-python/tree/main/cuda_core/tests/graph>`_ have
319+
project's :repo-tree:`graph tests <cuda_core/tests/graph>` have
321320
many usage examples.
322321

323322

‎cuda_core/docs/source/conf.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ def _html_baseurl():
148148
copybutton_exclude = ".linenos, .gp"
149149

150150
extlinks = {
151+
"repo-tree": (
152+
f"https://github.com/NVIDIA/cuda-python/tree/{GITHUB_EXAMPLES_REF}/%s",
153+
"%s",
154+
),
151155
# Historical release notes use this role to link into pre-migration tags.
152156
"cuda-core-example": (
153157
f"https://github.com/NVIDIA/cuda-python/blob/{GITHUB_EXAMPLES_REF}/cuda_core/examples/%s",

‎cuda_core/pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test = [
7979
"psutil==7.2.2; sys_platform != 'win32' or python_version < '3.15'",
8080
"packaging>=24",
8181
"docutils==0.23",
82-
# Required by tests/test_graphics.py; pinned to match cuda_bindings_13.
82+
# Required by tests/test_graphics.py; pinned to match cuda-bindings.
8383
"pyglet==2.1.14",
8484
"cffi==2.1.1",
8585
]
@@ -103,7 +103,7 @@ conflicts = [
103103
[project.urls]
104104
homepage = "https://nvidia.github.io/cuda-python/"
105105
documentation = "https://nvidia.github.io/cuda-python/cuda-core/"
106-
repository = "https://github.com/NVIDIA/cuda-python/tree/main/cuda_core"
106+
repository = "https://github.com/NVIDIA/cuda-python"
107107
issues = "https://github.com/NVIDIA/cuda-python/issues/"
108108

109109
[tool.setuptools.packages.find]

‎cuda_core/setup.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from setuptools.command.build_ext import build_ext as _build_ext
1414
from setuptools.command.build_py import build_py as _build_py
1515

16-
from _build_shared import drop_empty_venv_include_dir
16+
from _build_shared import drop_empty_venv_include_dir, make_egg_info_command
1717

1818
nthreads = int(os.environ.get("CUDA_PYTHON_PARALLEL_LEVEL", os.cpu_count() // 2))
1919
coverage_mode = bool(int(os.environ.get("CUDA_PYTHON_COVERAGE", "0")))
@@ -160,6 +160,7 @@ def finalize_options(self):
160160
cmdclass={
161161
"build_ext": build_ext,
162162
"build_py": build_py,
163+
"egg_info": make_egg_info_command("cuda-core-v"),
163164
},
164165
zip_safe=False,
165166
)

0 commit comments

Comments
 (0)