Skip to content

Commit 735d83e

Browse files
ENH: Migrate recipe to v1 format for rattler-build
Initial attempt at creating recipe.yaml from meta.yaml
1 parent 370a12f commit 735d83e

3 files changed

Lines changed: 247 additions & 0 deletions

File tree

recipe/build_output.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
REM rattler-build build --recipe-dir recipe/ -m .ci_support/linux_64_is_freethreadingfalsepython3.13.____cp313.yaml
2+
REM CUDA_HOME: ${{ env.get("PREFIX") }}
3+
REM CUDA_HOME: ${{ env.get("PY_VER", default="/not/found") }}${{ subdir }}
4+
REM CUDA_HOME: ${{ env.get("BUILD_PREFIX") ~ env.get("PREFIX", default="LOL") }}
5+
REM : ${{ env.get("PREFIX", default="") ~ subdir }}
6+
REM TODO: add support for v1
7+
REM LIB={{ PREFIX ~ subdir }}\lib\{{ target_name }};%LIB% # [win64]
8+
19
set DIR_NAME=%PKG_NAME:-=_%
210
cd %DIR_NAME%
311
%PYTHON% -m pip install . --no-deps -vv

recipe/build_output.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/bin/bash
22

3+
# rattler-build build --recipe-dir recipe/ -m .ci_support/linux_64_is_freethreadingfalsepython3.13.____cp313.yaml
4+
# CUDA_HOME: ${{ env.get("PREFIX") }}
5+
# CUDA_HOME: ${{ env.get("PY_VER", default="/not/found") }}${{ subdir }}
6+
# CUDA_HOME: ${{ env.get("BUILD_PREFIX") ~ env.get("PREFIX", default="LOL") }}
7+
# : ${{ env.get("PREFIX", default="") ~ subdir }}
8+
# TODO: add support for v1
9+
# LIB={{ PREFIX ~ subdir }}\lib\{{ target_name }};%LIB% # [win64]
10+
11+
export CUDA_HOME="${PREFIX}${SUBDIR}"
12+
313
DIR_NAME="$(echo $PKG_NAME | tr '-' '_')"
414
cd $DIR_NAME
515
if [[ ${DIR_NAME} == "cuda_python" ]]; then

recipe/recipe.yaml

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# Have certain top-level requirements so conda-smithy can render the correct variants
2+
schema_version: 1
3+
4+
context:
5+
number: 1
6+
version: "13.2.0"
7+
sha256: 6899b7684ccaf3249d521cc092768baeae390780375bb115bcd80350b65b1dff
8+
is_freethreading: environ | get("is_freethreading", False)
9+
bindings_major_version: ${{ (version | split("."))[0] | int }}
10+
bindings_minor_version: ${{ (version | split("."))[1] | int }}
11+
bindings_patch_version: ${{ (version | split("."))[2] | int }}
12+
target_name: ${{ 'x86_64-linux' if linux else ( "sbsa-linux" if aarch64 else ( "win64" if win else "not-specified" )) }}
13+
subdir: ${{ ( "/targets/" if linux or aarch64 else ( "\\targets\\" ~ target_name if win else "" )) ~ target_name }}
14+
# if (linux) else ("/Library" if win else "") }}
15+
# - if: linux64
16+
# then:
17+
# then: export C_INCLUDE_PATH="$CONDA_PREFIX/${{ subdir }}/include"subdir: os.sep.join(["", "targets", target_name]) # [linux64 or aarch64]
18+
# subdir: os.sep.join(["", "Library"]) # [win64]
19+
20+
recipe:
21+
name: cuda-python-split
22+
version: 1
23+
24+
source:
25+
url: https://github.com/NVIDIA/cuda-python/releases/download/v${{ version }}/cuda-python-v${{ version }}.tar.gz
26+
sha256: ${{ sha256 }}
27+
28+
build:
29+
number: 0
30+
skip: match(python, "<3.9") or ppc64le or osx
31+
32+
outputs:
33+
- package:
34+
name: cuda-python
35+
version: ${{ version }}
36+
build:
37+
number: ${{ number }}
38+
skip: not linux64
39+
noarch: python
40+
script:
41+
env:
42+
SUBDIR: ${{ subdir }}
43+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
44+
requirements:
45+
host:
46+
- python ${{ python_min }}.*
47+
- pip
48+
- setuptools
49+
- setuptools-scm >=8
50+
run:
51+
- python >=${{ python_min }}
52+
- ${{ pin_subpackage('cuda-bindings', upper_bound='x.x') }}
53+
- cuda-version >=13.0,<14.0a0
54+
tests:
55+
- script:
56+
- python -c "import importlib.metadata; importlib.metadata.version('cuda-python')"
57+
# Imports depend on numpy
58+
- if: linux
59+
then: python -c "import cuda.bindings.cufile"
60+
- python -c "import cuda.bindings.nvml"
61+
requirements:
62+
run:
63+
- python >=${{ python_min }}
64+
- numpy
65+
- python:
66+
imports:
67+
- cuda.bindings
68+
- cuda.bindings.driver
69+
- cuda.bindings.runtime
70+
- cuda.bindings.nvrtc
71+
- cuda.bindings.nvjitlink
72+
- cuda.bindings.nvvm
73+
- cuda.bindings.nvfatbin
74+
pip_check: false
75+
# TODO: add support for v1
76+
# python_version: >=${{ python_min }}
77+
about:
78+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
79+
license_file: cuda_python/LICENSE
80+
summary: CUDA Python
81+
description: |
82+
CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python.
83+
homepage: https://nvidia.github.io/cuda-python/
84+
repository: https://github.com/NVIDIA/cuda-python
85+
documentation: https://nvidia.github.io/cuda-python/
86+
87+
- package:
88+
name: cuda-bindings
89+
version: ${{ version }}
90+
build:
91+
number: ${{ number }}
92+
script:
93+
env:
94+
SUBDIR: ${{ subdir }}
95+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
96+
requirements:
97+
build:
98+
- ${{ compiler('c') }}
99+
- ${{ compiler('cxx') }}
100+
- ${{ stdlib('c') }}
101+
- if: build_platform != target_platform
102+
then:
103+
- cross-python_${{ target_platform }}
104+
- python
105+
- cython
106+
host:
107+
# cuda.bindings needs to be built with the matching major.minor headers
108+
- cuda-version ==${{ bindings_major_version }}.${{ bindings_minor_version }}
109+
- cuda-crt-dev_${{ target_platform }}
110+
- cuda-cudart-dev
111+
- cuda-cudart-static
112+
- cuda-cudart
113+
- cuda-nvvm-impl
114+
- cuda-nvrtc
115+
- cuda-nvrtc-dev
116+
- cuda-profiler-api
117+
- if: linux
118+
then:
119+
- libcufile
120+
- libcufile-dev
121+
- cython
122+
- pip
123+
- pyclibrary
124+
- python
125+
- setuptools
126+
- setuptools-scm >=8
127+
run:
128+
- python
129+
- cuda-pathfinder >=1.1.0,<2
130+
- ${{ pin_compatible('cuda-version', lower_bound='x', upper_bound='x') }}
131+
# cuda-python requires cuda-nvrtc from the same major version. We ignored
132+
# run-exports of cuda-nvrtc-dev and instead allow a looser pinning here.
133+
# Same for cuda-nvvm-impl.
134+
- ${{ pin_compatible('cuda-nvrtc', lower_bound='x', upper_bound='x') }}
135+
- ${{ pin_compatible('cuda-nvvm-impl', lower_bound='x', upper_bound='x') }}
136+
# TODO: add support for v1
137+
# - skip: false linux
138+
# then: ${{ pin_compatible('libcufile', lower_bound='x', upper_bound='x') }}
139+
# - ${{ pin_compatible('libnvfatbin', lower_bound='x', upper_bound='x') }}
140+
- libnvjitlink >=13.0,<14.0a0
141+
ignore_run_exports:
142+
from_package:
143+
- cuda-nvvm-impl
144+
- cuda-cudart-dev
145+
- cuda-cudart-static
146+
- cuda-nvrtc-dev
147+
# TODO: add support for v1
148+
# - skip: false linux
149+
# then: libcufile-dev
150+
run_constraints:
151+
- ${{ pin_compatible('cuda-cudart', lower_bound='x', upper_bound='x') }}
152+
# Rattler-build thinks this introduces circular dependency
153+
# - ${{ pin_subpackage('cuda-python', upper_bound='x.x') }}
154+
tests:
155+
- script:
156+
- if: linux
157+
then: export C_INCLUDE_PATH="$CONDA_PREFIX/${{ subdir }}/include"
158+
- if: win
159+
then: set "CL=%CL% /I%CONDA_PREFIX%\${{ subdir }}\include"
160+
- pip install setuptools
161+
- cythonize -i -3 -Xfreethreading_compatible=True *.pyx
162+
- python -c "import test_cimport; test_cimport.test()"
163+
- python -c "import cuda.bindings; print(cuda.bindings.__version__)"
164+
# Imports depend on numpy
165+
- python -c "import cuda.bindings.nvml"
166+
requirements:
167+
run:
168+
- ${{ compiler('c') }}
169+
- ${{ compiler('cxx') }}
170+
- cuda-nvcc
171+
- cuda-nvrtc-dev
172+
- cuda-profiler-api
173+
- cython
174+
- pip
175+
- numpy
176+
files:
177+
recipe:
178+
- test_cimport.pyx
179+
- python:
180+
imports:
181+
- cuda
182+
- cuda.bindings
183+
- cuda.bindings.driver
184+
- cuda.bindings.runtime
185+
# TODO: add support for v1
186+
# - skip: false linux
187+
# then: cuda.bindings.cufile
188+
- cuda.bindings.nvrtc
189+
- cuda.bindings.nvjitlink
190+
- cuda.bindings.nvvm
191+
- cuda.bindings.nvfatbin
192+
pip_check: false
193+
about:
194+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
195+
license_file: cuda_bindings/LICENSE
196+
summary: CUDA Python Low-level Bindings
197+
description: |
198+
CUDA Python provides a standard set of low-level interfaces,
199+
providing full coverage of and access to the CUDA host APIs from Python.
200+
homepage: https://nvidia.github.io/cuda-python/cuda-bindings
201+
repository: https://github.com/NVIDIA/cuda-python
202+
documentation: https://nvidia.github.io/cuda-python/cuda-bindings
203+
204+
about:
205+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
206+
license_file: LICENSE.md
207+
summary: CUDA Python
208+
description: |
209+
CUDA Python is the home for accessing NVIDIA's CUDA platform from Python.
210+
homepage: https://nvidia.github.io/cuda-python/
211+
repository: https://github.com/NVIDIA/cuda-python
212+
documentation: https://nvidia.github.io/cuda-python/
213+
214+
extra:
215+
feedstock-name: cuda-python
216+
recipe-maintainers:
217+
- rwgk
218+
- rparolin
219+
- cpcloud
220+
- bdice
221+
- jakirkham
222+
- leofang
223+
- m3vaz
224+
- mmccarty
225+
- vyasr
226+
- vzhurba01
227+
- kkraus14
228+
- oleksandr-pavlyk
229+

0 commit comments

Comments
 (0)