Skip to content

Commit

Permalink
use rapids-build-backend (#88)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#31
Contributes to
rapidsai/dependency-file-generator#89

Proposes introducing `rapids-build-backend` as this project's build
backend, to reduce the complexity of various CI/build scripts.

---------

Co-authored-by: Bradley Dice <[email protected]>
  • Loading branch information
jameslamb and bdice authored Jun 10, 2024
1 parent 89bfd77 commit e9d34ab
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
build-wheels:
needs:
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08
with:
build_type: branch
script: "ci/build_wheel.sh"
matrix_filter: ${{ needs.compute-matrix.outputs.BUILD_MATRIX }}
build-conda:
needs:
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.08
with:
build_type: branch
script: "ci/build_conda.sh"
Expand All @@ -40,7 +40,7 @@ jobs:
needs:
- build-wheels
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.08
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -51,7 +51,7 @@ jobs:
needs:
- build-conda
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.08
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- test-wheels
- test-patch
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.08
checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.08
with:
enable_check_generated_files: false
compute-matrix:
Expand All @@ -40,7 +40,7 @@ jobs:
build-conda:
needs:
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-24.08
with:
build_type: pull-request
script: "ci/build_conda.sh"
Expand All @@ -49,7 +49,7 @@ jobs:
needs:
- build-conda
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.08
with:
build_type: pull-request
script: "ci/test_conda.sh"
Expand All @@ -58,7 +58,7 @@ jobs:
needs:
- build-conda
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.08
with:
build_type: pull-request
script: "ci/test_patch.sh"
Expand All @@ -67,7 +67,7 @@ jobs:
build-wheels:
needs:
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.08
with:
build_type: pull-request
script: "ci/build_wheel.sh"
Expand All @@ -76,7 +76,7 @@ jobs:
needs:
- build-wheels
- compute-matrix
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.04
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.08
with:
build_type: pull-request
script: "ci/test_wheel.sh"
Expand Down
7 changes: 0 additions & 7 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ source "$(dirname "$0")/install_latest_cuda_toolkit.sh"

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.
sed -i "s/^name = \"pynvjitlink\"/name = \"pynvjitlink${PACKAGE_CUDA_SUFFIX}\"/g" pyproject.toml

rapids-logger "Build wheel"
mkdir -p ./dist
python -m pip wheel . --wheel-dir=./dist -vvv --disable-pip-version-check --no-deps
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/pynvjitlink/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ requirements:
- cuda-version {{ cuda_compiler_version }}
- python
- pip
- rapids-build-backend >=0.3.0,<0.4.0dev0
- scikit-build-core
run:
- python
Expand Down
1 change: 1 addition & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies:
common:
- output_types: [requirements, pyproject]
packages:
- rapids-build-backend >=0.3.0,<0.4.0dev0
- scikit-build-core[pyproject]>=0.7.0
checks:
common:
Expand Down
9 changes: 7 additions & 2 deletions pynvjitlink/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

from pynvjitlink.api import NvJitLinker, NvJitLinkError
from pynvjitlink._version import __version__
from pynvjitlink._version import __git_commit__, __version__

__all__ = ["NvJitLinker", "NvJitLinkError", "__version__"]
__all__ = [
"NvJitLinkError",
"NvJitLinker",
"__git_commit__",
"__version__",
]
14 changes: 13 additions & 1 deletion pynvjitlink/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@
import importlib.resources

__version__ = (
importlib.resources.files("pynvjitlink").joinpath("VERSION").read_text().strip()
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__"]
12 changes: 12 additions & 0 deletions pynvjitlink/tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

import pynvjitlink


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

# __version__ should always be non-empty
assert isinstance(pynvjitlink.__version__, str)
assert len(pynvjitlink.__version__) > 0
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.

[tool.rapids-build-backend]
build-backend = "scikit_build_core.build"
dependencies-file = "dependencies.yaml"

[tool.scikit-build]
cmake.minimum-version = "3.26.4"
cmake.verbose = true
Expand All @@ -9,9 +13,10 @@ wheel.packages = ["pynvjitlink"]

[build-system]
requires = [
"rapids-build-backend >=0.3.0,<0.4.0dev0",
"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`.
build-backend = "scikit_build_core.build"
build-backend = "rapids_build_backend.build"

[project]
name = "pynvjitlink"
Expand Down

0 comments on commit e9d34ab

Please sign in to comment.