Skip to content

Commit

Permalink
Add conda and wheel packages (#15)
Browse files Browse the repository at this point in the history
This PR adds conda packages (via rattler-build) and wheel builds of the
C++ DSO.
  • Loading branch information
vyasr authored Jan 21, 2025
1 parent 12b710d commit c50be2f
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ jobs:
key: pre-commit-0|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run ci/check_style.sh
run: ci/check_style.sh
conda-cpp-build:
needs: style
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
matrix_filter: group_by(.ARCH) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]))
script: ci/build_conda.sh
wheel-cpp-build:
needs: style
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
with:
build_type: pull-request
matrix_filter: group_by(.ARCH) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]))
script: ci/build_wheel.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.swp
build/
*.whl
.cache
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ if(RAPIDS_LOGGER_HIDE_ALL_SPDLOG_SYMBOLS)
# order-dependent which is selected so we're at the mercy of the rapids-cmake implementation). We
# should generalize the rapids_cpm_* functions to support this natively.aasdfsd
include(${rapids-cmake-dir}/cpm/package_override.cmake)
rapids_cpm_package_override(cmake/spdlog_override.cmake)
rapids_cpm_package_override(${CMAKE_CURRENT_LIST_DIR}/cmake/spdlog_override.cmake)
rapids_cpm_spdlog(
FMT_OPTION ${RAPIDS_LOGGER_FMT_OPTION} CPM_ARGS OPTIONS "BUILD_SHARED_LIBS OFF"
"SPDLOG_BUILD_SHARED OFF"
)
set_target_properties(spdlog PROPERTIES CXX_VISIBILITY_PRESET hidden POSITION_INDEPENDENT_CODE ON)
target_link_options(rapids_logger PRIVATE "LINKER:--exclude-libs,libspdlog")
else()
rapids_cpm_spdlog(
Expand Down
26 changes: 26 additions & 0 deletions ci/build_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
# Copyright (c) 2025, NVIDIA CORPORATION.

set -euo pipefail

rapids-configure-conda-channels

source rapids-configure-sccache

source rapids-date-string

export CMAKE_GENERATOR=Ninja

rapids-print-env

rapids-logger "Begin cpp build"

sccache --zero-stats

mamba install -y rattler-build

rattler-build build --recipe conda/recipes/rapids-logger --output-dir ${RAPIDS_CONDA_BLD_OUTPUT_DIR}

sccache --show-adv-stats

rapids-upload-conda-to-s3 cpp
24 changes: 24 additions & 0 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Copyright (c) 2025, NVIDIA CORPORATION.

set -euo pipefail

package_name="rapids_logger"
package_dir="python/rapids-logger"

rapids-logger "Building '${package_name}' wheel"
sccache --zero-stats
python -m pip wheel \
-w "${package_dir}/dist" \
-v \
--no-deps \
--disable-pip-version-check \
"${package_dir}"
sccache --show-adv-stats

mkdir -p "${package_dir}/final_dist"
python -m auditwheel repair \
-w "${package_dir}/final_dist" \
${package_dir}/dist/*

RAPIDS_PY_WHEEL_NAME="${package_name}" rapids-upload-wheels-to-s3 cpp "${package_dir}/final_dist"
34 changes: 34 additions & 0 deletions conda/recipes/rapids-logger/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2025, NVIDIA CORPORATION.

context:
version: 0.1.0

package:
name: rapids-logger
version: ${{ version }}

source:
path: ../../..

build:
number: ${{ GIT_DESCRIBE_NUMBER }}
string: build_${{ GIT_DESCRIBE_HASH }}_${{ GIT_DESCRIBE_NUMBER }}
script:
- cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_SHARED_LIBS=ON
- cmake --build build/
- cmake --install build/

requirements:
build:
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- ${{ stdlib('c') }}
- cmake ${{ cmake_version }}
- ninja
- git
about:
homepage: https://rapids.ai/
repository: https://github.com/rapidsai/rapids-logger
license: Apache-2.0
license_file: LICENSE
summary: Logging framework for RAPIDS built around spdlog
5 changes: 5 additions & 0 deletions conda/recipes/rapids-logger/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
c_stdlib:
- sysroot

c_stdlib_version:
- 2.17
23 changes: 21 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ files:
checks:
output: none
includes:
- develop
- checks
py_build:
output: pyproject
pyproject_dir: python/rapids-logger
extras:
table: build-system
includes:
- py_build
channels:
- conda-forge
dependencies:
develop:
checks:
common:
- output_types: [conda, requirements]
packages:
Expand All @@ -16,3 +23,15 @@ dependencies:
# added in 2.5.20, so we need to call out the minimum version needed for our plugins
- identify>=2.5.20
- python>=3.10
py_build:
common:
- output_types: [conda, requirements, pyproject]
packages:
- cmake>=3.26.4,!=3.30.0
- ninja
- output_types: conda
packages:
- scikit-build-core>=0.10.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.10.0
38 changes: 38 additions & 0 deletions python/rapids-logger/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# =============================================================================
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================

cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)

include(../../rapids_config.cmake)

project(
rapids-logger-python
VERSION "${RAPIDS_VERSION}"
LANGUAGES CXX
)

# Check if rapids-logger is already available. If so, it is the user's responsibility to ensure that
# the CMake package is also available when building any Python packages that may depend on the
# rapids-logger Python package (e.g. cudf).
find_package(rapids_logger "${RAPIDS_VERSION}")

if(rapids_logger_FOUND)
return()
endif()

unset(rapids_logger_FOUND)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(BUILD_SHARED_LIBS ON)
add_subdirectory(../../ rapids-logger-cpp)
1 change: 1 addition & 0 deletions python/rapids-logger/LICENSE
1 change: 1 addition & 0 deletions python/rapids-logger/README.md
66 changes: 66 additions & 0 deletions python/rapids-logger/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (c) 2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
build-backend = "scikit_build_core.build"
requires = [
"cmake>=3.26.4,!=3.30.0",
"ninja",
"scikit-build-core[pyproject]>=0.10.0",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.

[project]
name = "rapids-logger"
dynamic = ["version"]
description = "Logging framework for RAPIDS built around spdlog"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.10"
classifiers = [
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: C++",
]

[project.urls]
Homepage = "https://github.com/rapidsai/rapids-logger"

[project.entry-points."cmake.prefix"]
rapids_logger = "rapids_logger"

[tool.pydistcheck]
select = [
"distro-too-large-compressed",
]

[tool.scikit-build]
build-dir = "build/{wheel_tag}"
cmake.build-type = "Release"
cmake.version = "CMakeLists.txt"
minimum-version = "build-system.requires"
ninja.make-fallback = true
sdist.reproducible = true
wheel.packages = ["rapids_logger"]
wheel.install-dir = "rapids_logger"
wheel.py-api = "py3"

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
input = "rapids_logger/VERSION"
regex = "(?P<value>.*)"
1 change: 1 addition & 0 deletions python/rapids-logger/rapids_logger/VERSION
18 changes: 18 additions & 0 deletions python/rapids-logger/rapids_logger/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from rapids_logger._version import __git_commit__, __version__
from rapids_logger.load import load_library

__all__ = ["__git_commit__", "__version__", "load_library"]
24 changes: 24 additions & 0 deletions python/rapids-logger/rapids_logger/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.resources

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

__all__ = ["__version__"]
Loading

0 comments on commit c50be2f

Please sign in to comment.