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 #389

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -82,7 +82,7 @@ repos:
^CHANGELOG.md$
)
- 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
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ if (( NUMARGS == 0 )) || hasArg kvikio; then
echo "building kvikio..."
cd ${REPODIR}/python
SKBUILD_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX};-DCMAKE_LIBRARY_PATH=${LIBKVIKIO_BUILD_DIR};${EXTRA_CMAKE_ARGS}" \
python -m pip install --no-build-isolation --no-deps .
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true .
fi
2 changes: 1 addition & 1 deletion ci/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rapids-logger "Create test conda environment"

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

rapids-mamba-retry env create --yes -f env.yaml -n docs
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/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -euo pipefail
rapids-logger "Generate C++ testing dependencies"
rapids-dependency-file-generator \
--output conda \
--file_key test_cpp \
--file-key test_cpp \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee env.yaml

rapids-mamba-retry env create --yes -f env.yaml -n test
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 @@ cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../
rapids-logger "Generate Python testing dependencies"
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
1 change: 1 addition & 0 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies:
- pytest
- pytest-cov
- python>=3.9,<3.12
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- scikit-build-core>=0.7.0
- sphinx
- sphinx-click
Expand Down
1 change: 1 addition & 0 deletions conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies:
- pytest
- pytest-cov
- python>=3.9,<3.12
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- scikit-build-core>=0.7.0
- sphinx
- sphinx-click
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/kvikio/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ requirements:
{% endif %}
- cuda-version ={{ cuda_version }}
- nvcomp {{ nvcomp_version }}
- rapids-build-backend >=0.3.0,<0.4.0.dev0
- scikit-build-core >=0.7.0
- libkvikio ={{ version }}
run:
Expand Down
24 changes: 20 additions & 4 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ files:
- depends_on_cupy
- docs
- py_version
- rapids_build_skbuild
- run
- test_python
test_cpp:
Expand Down Expand Up @@ -41,6 +42,14 @@ files:
pyproject_dir: python
extras:
table: build-system
includes:
- rapids_build_skbuild
py_rapids_build:
output: pyproject
pyproject_dir: python
extras:
table: tool.rapids-build-backend
key: requires
includes:
- build
py_run:
Expand Down Expand Up @@ -76,10 +85,6 @@ dependencies:
packages:
- c-compiler
- cxx-compiler
- scikit-build-core>=0.7.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.7.0
specific:
- output_types: conda
matrices:
Expand Down Expand Up @@ -238,6 +243,17 @@ dependencies:
- matrix:
packages:
- python>=3.9,<3.12
rapids_build_skbuild:
common:
- output_types: [conda, requirements, pyproject]
packages:
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- output_types: conda
packages:
- scikit-build-core>=0.7.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.7.0
run:
common:
- output_types: [conda, requirements, pyproject]
Expand Down
2 changes: 1 addition & 1 deletion python/kvikio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See file LICENSE for terms.

from ._lib import libkvikio # type: ignore
from ._version import __version__ # noqa: F401
from ._version import __git_commit__, __version__ # noqa: F401
from .cufile import CuFile # noqa: F401


Expand Down
14 changes: 12 additions & 2 deletions python/kvikio/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
import importlib.resources

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

__all__ = ["__git_commit__", "__version__"]
15 changes: 11 additions & 4 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# See file LICENSE for terms.

[build-system]
build-backend = "scikit_build_core.build"
build-backend = "rapids_build_backend.build"
requires = [
"cmake>=3.26.4",
"cython>=3.0.0",
"ninja",
"rapids-build-backend>=0.3.0,<0.4.0.dev0",
"scikit-build-core[pyproject]>=0.7.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 @@ -109,6 +107,15 @@ ignore_missing_imports = true
[project.entry-points."numcodecs.codecs"]
nvcomp_batch = "kvikio.nvcomp_codec:NvCompBatchCodec"

[tool.rapids-build-backend]
build-backend = "scikit_build_core.build"
dependencies-file = "../dependencies.yaml"
requires = [
"cmake>=3.26.4",
"cython>=3.0.0",
"ninja",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.

[tool.scikit-build]
build-dir = "build/{wheel_tag}"
cmake.build-type = "Release"
Expand Down
13 changes: 13 additions & 0 deletions python/tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
# See file LICENSE for terms.

import kvikio


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

# __version__ should always be non-empty
assert isinstance(kvikio.__version__, str)
assert len(kvikio.__version__) > 0