Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rapids-build-backend #1044

Merged
merged 30 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d31ad60
use rapids-build-backend
jameslamb Jun 5, 2024
bfdc823
fix dependencies
jameslamb Jun 5, 2024
745b40f
version tests
jameslamb Jun 5, 2024
6cf9e4e
changes
jameslamb Jun 5, 2024
74dbf00
fix
jameslamb Jun 5, 2024
663320d
just run wheel builds
jameslamb Jun 5, 2024
2f06f89
try moving libucx dependency
jameslamb Jun 5, 2024
369d57e
put libucx back, it is needed in setup.py
jameslamb Jun 5, 2024
0ed0e1d
Merge branch 'branch-0.39' of github.com:rapidsai/ucx-py into rapids-…
jameslamb Jun 10, 2024
5fd0b04
test with https://github.com/rapidsai/rapids-build-backend/pull/41
jameslamb Jun 10, 2024
893ff43
move other dependencies down to rapids-build-backend's table
jameslamb Jun 10, 2024
2e2889f
wheel, not install
jameslamb Jun 10, 2024
6c9fb3f
fix pip wheel invocation
jameslamb Jun 10, 2024
15fde53
get better logs
jameslamb Jun 10, 2024
7fbb1c1
fix pip wheel invocation
jameslamb Jun 10, 2024
3e1e04f
re-enable wheel tests
jameslamb Jun 10, 2024
473f306
move cudf dependency
jameslamb Jun 10, 2024
0dddea7
empty commit to re-trigger CI
jameslamb Jun 11, 2024
772ac92
use rapids-build-backend packages
jameslamb Jun 12, 2024
b964fee
re-enable conda builds
jameslamb Jun 12, 2024
d6241e5
fix data-gathering in conda recipe
jameslamb Jun 12, 2024
39960dd
fix variable name
jameslamb Jun 12, 2024
5cd1908
Merge branch 'branch-0.39' into rapids-build-backend
jameslamb Jun 12, 2024
8a443be
Apply suggestions from code review
jameslamb Jun 12, 2024
3238af2
try library install in post_create_environment
jameslamb Jun 12, 2024
6d3fde7
Merge branch 'rapids-build-backend' of github.com:jameslamb/ucx-py in…
jameslamb Jun 12, 2024
dbd5722
fix keys
jameslamb Jun 12, 2024
51c0153
consider rapids nightly index
jameslamb Jun 12, 2024
ec63083
fix formatting
jameslamb Jun 12, 2024
5de66ec
use same __version__ test as other libraries, fix rtd config
jameslamb Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
args: ["--config=.flake8.cython"]
types: [cython]
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.8.0
rev: v1.13.11
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
Expand Down
9 changes: 7 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ build:
tools:
python: "mambaforge-22.9"
jobs:
post_checkout:
- bash ci/build_docs_pre_install.sh
post_create_environment:
- |
pip install \
--extra-index-url "https://pypi.anaconda.org/rapidsai-wheels-nightly/simple/" \
-C rapidsai.disable-cuda=true \
-C rapidsai.matrix-entry="cuda-12.2" \
.

conda:
environment: conda/environments/builddocs.yml
Expand Down
17 changes: 0 additions & 17 deletions ci/build_docs_pre_install.sh

This file was deleted.

8 changes: 2 additions & 6 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ source rapids-date-string

rapids-print-env

version=$(rapids-generate-version)
commit=$(git rev-parse HEAD)

echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" ucp/_version.py
rapids-generate-version > ./VERSION

rapids-logger "Begin py build"
conda config --set path_conflict prevent

RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild \
RAPIDS_PACKAGE_VERSION=$(head -1 ./VERSION) rapids-conda-retry mambabuild \
conda/recipes/ucx-py

rapids-upload-conda-to-s3 python
32 changes: 2 additions & 30 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,11 @@ rm -rf /usr/include/uct
source rapids-configure-sccache
source rapids-date-string

version=$(rapids-generate-version)
commit=$(git rev-parse HEAD)
rapids-generate-version > ./VERSION

RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"

# This is the version of the suffix with a preceding hyphen. It's used
# everywhere except in the final wheel name.
PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}"

# Patch project metadata files to include the CUDA version suffix and version override.
pyproject_file="pyproject.toml"

sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file}
echo "${version}" > VERSION
sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" ucp/_version.py

# For nightlies we want to ensure that we're pulling in alphas as well. The
# easiest way to do so is to augment the spec with a constraint containing a
# min alpha version that doesn't affect the version bounds but does allow usage
# of alpha versions for that dependency without --pre
alpha_spec=''
if ! rapids-is-release-build; then
alpha_spec=',>=0.0.0a0'
fi

sed -r -i "s/cudf==(.*)\"/cudf${PACKAGE_CUDA_SUFFIX}==\1${alpha_spec}\"/g" ${pyproject_file}
sed -r -i "/\"libucx([=><]+)/ s/\"libucx/\"libucx${PACKAGE_CUDA_SUFFIX}/g" ${pyproject_file}

if [[ $PACKAGE_CUDA_SUFFIX == "-cu12" ]]; then
sed -i "s/cupy-cuda11x/cupy-cuda12x/g" ${pyproject_file}
fi

python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check
python -m pip wheel . -w dist --no-deps --disable-pip-version-check

mkdir -p final_dist
python -m auditwheel repair \
Expand Down
2 changes: 1 addition & 1 deletion ci/check_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rapids-logger "Create checks conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key checks \
--file-key checks \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n checks
Expand Down
2 changes: 1 addition & 1 deletion ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DEPENDENCIES=(
)
for FILE in dependencies.yaml; do
for DEP in "${DEPENDENCIES[@]}"; do
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_RAPIDS_SHORT_TAG_PEP440}.*/g" "${FILE}"
sed_runner "/-.* ${DEP}\(-cu[[:digit:]]\{2\}\)\{0,1\}==/ s/==.*/==${NEXT_RAPIDS_SHORT_TAG_PEP440}.*,>=0.0.0a0/g" "${FILE}"
done
done

Expand Down
2 changes: 1 addition & 1 deletion ci/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rapids-logger "Create test conda environment"

rapids-dependency-file-generator \
--output conda \
--file_key test_python \
--file-key test_python \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n test
Expand Down
3 changes: 0 additions & 3 deletions conda/environments/builddocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@ dependencies:
- recommonmark
- pandoc=<2.0.0
- pip
- pip:
- --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple
- ../../
- cython
25 changes: 14 additions & 11 deletions conda/recipes/ucx-py/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script:
- {{ PYTHON }} -m pip install . -vv
- {{ PYTHON }} -m pip install --config-settings rapidsai.disable-cuda=true . -vv
ignore_run_exports_from:
- ucx

Expand All @@ -30,29 +30,32 @@ requirements:
- python
- pip
- ucx
{% for build_req in data["build-system"]["requires"] %}
- {{ build_req }}
{% endfor %}
# 'libucx' wheel dependency is unnecessary... the 'ucx' conda-forge package is used here instead
{% for r in data.get("build-system", {}).get("requires", []) if not r.startswith("libucx") %}
- {{ r }}
{% for rbb_req in data["tool"]["rapids-build-backend"]["requires"] if not rbb_req.startswith("libucx") %}
- {{ rbb_req }}
{% endfor %}
run:
- python
- ucx >=1.15.0,<1.16.0
# 'libucx' wheel dependency is unnecessary... the 'ucx' conda-forge package is used here instead
{% for r in data.get("project", {}).get("dependencies", []) if not r.startswith("libucx") %}
- {{ r }}
{% for req in data["project"]["dependencies"] if not req.startswith("libucx") %}
- {{ req }}
{% endfor %}

test:
imports:
- ucp

about:
home: {{ data.get("project", {}).get("urls", {}).get("Homepage", "") }}
license: {{ data.get("project", {}).get("license", {}).get("text", "") }}
home: {{ data["project"]["urls"]["Homepage"] }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the .get(...) was required because conda-build doesn't actually inject the Jinja variables on every pass and that led to problems in metadata. I'm not sure. We use the .get(...) logic in dask-cuda, too. https://github.com/rapidsai/dask-cuda/blob/branch-24.08/conda/recipes/dask-cuda/meta.yaml

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks to me like this is working as expected.

wget \
  https://downloads.rapids.ai/ci/ucx-py/pull-request/1046/43beaa1/ucx-py_conda_python_cuda12_py39_x86_64.tar.gz

tar -xvzf ./ucx-py_conda_python_cuda12_py39_x86_64.tar.gz
cat ./linux-64/repodata.json | jq .

For example, I see the right license: string there.

And looking in one of the packages, all this metadata looks correct too:

mkdir ./delete-me
cp ./linux-64/ucx-py-0.39.00a1-py39_240612_g43beaa1_1.tar.bz2 ./delete-me
cd ./delete-me
cph extract ./ucx-py-0.39.00a1-py39_240612_g43beaa1_1.tar.bz2
cat ucx-py-0.39.00a1-py39_240612_g43beaa1_1/info/about.json | jq .

Unless you can remember the specific reason to prefer .get(), I think we should move away from it in all conda recipes, to turn "silently ignored missing metadata" cases into "got a loud error at build time" cases. I actually just wrote that up in rapidsai/build-planning#72.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok cool! Go for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jakirkham may remember the specific reason why we used .get(...) in these recipes, I recall discussing it with him at some point.

Copy link
Member Author

Choose a reason for hiding this comment

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

I found a related thread: rapidsai/pynvjitlink#33 (comment)

I don't think it changes the fact that this is working and should be used for the specific places I've made this change in this PR, and doesn't need to block this PR. But might mean "never use .get()" is too strong.

I'll post over in the build-planning issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe conda-build has changed. 🤷‍♂️ In any case, I am happy to drop .get() if this is working.

license: {{ data["project"]["license"]["text"] }}
license_file:
{% for e in data.get("tool", {}).get("setuptools", {}).get("license-files", []) %}
{% for e in data["tool"]["setuptools"]["license-files"] %}
- ../../../{{ e }}
{% endfor %}
summary: {{ data.get("project", {}).get("description", "") }}
dev_url: {{ data.get("project", {}).get("urls", {}).get("Source", "") }}
doc_url: {{ data.get("project", {}).get("urls", {}).get("Documentation", "") }}
summary: {{ data["project"]["description"] }}
dev_url: {{ data["project"]["urls"]["Source"] }}
doc_url: {{ data["project"]["urls"]["Documentation"] }}
38 changes: 30 additions & 8 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ files:
- cuda
- cuda_version
- py_version
- rapids_build_setuptools
- run
- test_python
test_python:
Expand All @@ -25,6 +26,14 @@ files:
pyproject_dir: .
extras:
table: build-system
includes:
- rapids_build_setuptools
py_rapids_build:
output: pyproject
pyproject_dir: .
extras:
table: tool.rapids-build-backend
key: requires
includes:
- build_python
- depends_on_ucx_build
Expand Down Expand Up @@ -109,8 +118,13 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- setuptools>=64.0.0
- cython>=3.0.0
rapids_build_setuptools:
common:
- output_types: [conda, requirements, pyproject]
packages:
- rapids-build-backend>=0.3.1,<0.4.0dev0
- setuptools>=64.0.0
run:
common:
- output_types: [conda, requirements, pyproject]
Expand All @@ -136,8 +150,6 @@ dependencies:
- matrix: {cuda: "11.*"}
packages:
- libucx-cu11==1.15.0
# NOTE: this fallback needs to be a real, suffixed version
# so 'pip install .' (e.g. as used in docs builds) will work
Copy link
Member Author

Choose a reason for hiding this comment

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

I accidentally left behind this comment in #1041 ... it's not accurate on branch-0.39 or on this branch.

- matrix: null
packages:
- libucx==1.15.0
Expand All @@ -160,8 +172,6 @@ dependencies:
- matrix: {cuda: "11.*"}
packages:
- libucx-cu11>=1.15.0,<1.16
# NOTE: this fallback needs to be a real, suffixed version
# so "pip install ." (e.g. as used in docs builds) will work
- matrix: null
packages:
- libucx>=1.15.0,<1.16
Expand All @@ -170,7 +180,6 @@ dependencies:
- output_types: [conda, requirements, pyproject]
packages:
- cloudpickle
- cudf==24.8.*
- dask
- distributed
- numba>=0.57
Expand All @@ -179,7 +188,20 @@ dependencies:
- pytest-rerunfailures
- output_types: [conda]
packages:
- &cudf_conda cudf==24.8.*,>=0.0.0a0
- cupy>=12.0.0
specific:
- output_types: [requirements, pyproject]
packages:
- cupy-cuda11x>=12.0.0
matrices:
- matrix: {cuda: "12.*"}
packages:
- cudf-cu12==24.8.*,>=0.0.0a0
- cupy-cuda12x>=12.0.0
- matrix: {cuda: "11.*"}
packages:
- cudf-cu11==24.8.*,>=0.0.0a0
- &cupy_cu11 cupy-cuda11x>=12.0.0
- matrix:
packages:
- *cudf_conda
- *cupy_cu11
18 changes: 14 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
# limitations under the License.

[build-system]
build-backend = "setuptools.build_meta"
build-backend = "rapids_build_backend.build"
requires = [
"cython>=3.0.0",
"libucx==1.15.0",
"rapids-build-backend>=0.3.1,<0.4.0dev0",
"setuptools>=64.0.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.

Expand Down Expand Up @@ -50,7 +49,7 @@ classifiers = [
[project.optional-dependencies]
test = [
"cloudpickle",
"cudf==24.8.*",
"cudf==24.8.*,>=0.0.0a0",
"cupy-cuda11x>=12.0.0",
"dask",
"distributed",
Expand Down Expand Up @@ -112,6 +111,17 @@ skip = [
[tool.pytest.ini_options]
xfail_strict = true

[tool.rapids-build-backend]
build-backend = "setuptools.build_meta"
commit-files = [
"ucp/COMMIT_FILE"
]
dependencies-file = "dependencies.yaml"
requires = [
"cython>=3.0.0",
"libucx==1.15.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.

[tool.setuptools]
license-files = ["LICENSE"]
zip-safe = false
Expand Down
5 changes: 5 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ def test_get_ucx_version():
assert ucp.core._ctx is None


def test_git_commit_constant():
# __git_commit__ will only be non-empty in a built distribution
assert isinstance(ucp.__git_commit__, str)


def test_version_constant():
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
assert isinstance(ucp.__version__, str)

Expand Down
17 changes: 15 additions & 2 deletions ucp/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,18 @@

import importlib.resources

__version__ = importlib.resources.files("ucp").joinpath("VERSION").read_text().strip()
__git_commit__ = ""
__version__ = (
importlib.resources.files(__package__).joinpath("VERSION").read_text().strip()
)

try:
__git_commit__ = (
importlib.resources.files(__package__)
.joinpath("GIT_COMMIT")
.read_text()
.strip()
)
except FileNotFoundError:
__git_commit__ = ""

__all__ = ["__git_commit__", "__version__"]
Loading