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

Fix pip check for py-xgboost #191

Merged
merged 6 commits into from
Aug 28, 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
24 changes: 12 additions & 12 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '12'
- '13'
c_stdlib:
- sysroot
c_stdlib_version:
Expand All @@ -19,7 +19,7 @@ cuda_compiler_version:
cxx_compiler:
- gxx
cxx_compiler_version:
- '12'
- '13'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
nccl:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BUILD:
c_compiler:
- gcc
c_compiler_version:
- '12'
- '13'
c_stdlib:
- sysroot
c_stdlib_version:
Expand All @@ -23,7 +23,7 @@ cuda_compiler_version:
cxx_compiler:
- gxx
cxx_compiler_version:
- '12'
- '13'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
nccl:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '12'
- '13'
c_stdlib:
- sysroot
c_stdlib_version:
Expand All @@ -19,7 +19,7 @@ cuda_compiler_version:
cxx_compiler:
- gxx
cxx_compiler_version:
- '12'
- '13'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
nccl:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/osx_64_python3.8.____cpython.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MACOSX_SDK_VERSION:
c_compiler:
- clang
c_compiler_version:
- '16'
- '17'
c_stdlib:
- macosx_deployment_target
c_stdlib_version:
Expand All @@ -21,9 +21,9 @@ cuda_compiler_version:
cxx_compiler:
- clangxx
cxx_compiler_version:
- '16'
- '17'
llvm_openmp:
- '16'
- '17'
macos_machine:
- x86_64-apple-darwin13.4.0
pin_run_as_build:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/osx_arm64_python3.8.____cpython.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MACOSX_SDK_VERSION:
c_compiler:
- clang
c_compiler_version:
- '16'
- '17'
c_stdlib:
- macosx_deployment_target
c_stdlib_version:
Expand All @@ -21,9 +21,9 @@ cuda_compiler_version:
cxx_compiler:
- clangxx
cxx_compiler_version:
- '16'
- '17'
llvm_openmp:
- '16'
- '17'
macos_machine:
- arm64-apple-darwin20.0.0
pin_run_as_build:
Expand Down
2 changes: 1 addition & 1 deletion .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build-locally.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set name = "xgboost" %}
{% set version = "2.1.1" %}
{% set build_number = 1 %}
{% set build_number = 2 %}
{% set min_python = "3.8" %}

{% set string_prefix = "cuda" ~ (cuda_compiler_version | replace('.', '')) if (cuda_compiler_version or "None") != "None" else "cpu" %}
Expand All @@ -15,6 +15,8 @@ source:
patches:
# xgboost patches
- patches/0001-Enable-latest-libcxx-on-MacOS.patch # [osx]
- patches/0002-Remove-nvidia-nccl-cu12-from-pyproject.toml.patch
- patches/0003-Use-correct-platform-tag-from-Pip.patch

build:
number: {{ build_number }}
Expand Down Expand Up @@ -116,6 +118,7 @@ outputs:
- libxgboost =*={{ string_prefix }}_h*_{{ PKG_BUILDNUM }}
- python >={{ min_python }}
- hatchling >=1.12.1
- packaging >=21.3
- pip
run:
- {{ pin_subpackage('_py-xgboost-mutex', exact=True) }}
Expand All @@ -129,8 +132,11 @@ outputs:
test:
requires:
- python
hcho3 marked this conversation as resolved.
Show resolved Hide resolved
- pip
imports:
- xgboost
commands:
- pip check
hcho3 marked this conversation as resolved.
Show resolved Hide resolved
script: test-py-xgboost.py

- name: py-xgboost-cpu
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From b38f9983fd5edfef8c6604c42779f33f897b1a46 Mon Sep 17 00:00:00 2001
From: Hyunsu Cho <phcho@nvidia.com>
Date: Tue, 27 Aug 2024 14:24:42 -0700
Subject: [PATCH] Remove nvidia-nccl-cu12 from pyproject.toml

---
python-package/pyproject.toml | 1 -
1 file changed, 1 deletion(-)

diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml
index 05bbe998c..a470bb21f 100644
--- a/python-package/pyproject.toml
+++ b/python-package/pyproject.toml
@@ -30,7 +30,6 @@ classifiers = [
dependencies = [
"numpy",
"scipy",
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
]

[project.urls]
--
2.34.1

50 changes: 50 additions & 0 deletions recipe/patches/0003-Use-correct-platform-tag-from-Pip.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
From d3beed567a0d0a956aafca7b48ce892d01dddcfd Mon Sep 17 00:00:00 2001
From: Hyunsu Cho <phcho@nvidia.com>
Date: Tue, 27 Aug 2024 14:27:45 -0700
Subject: [PATCH] Use correct platform tag from Pip

---
python-package/hatch_build.py | 6 +++---
python-package/pyproject.toml | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/python-package/hatch_build.py b/python-package/hatch_build.py
index 925c917b9..02febb099 100644
--- a/python-package/hatch_build.py
+++ b/python-package/hatch_build.py
@@ -3,16 +3,16 @@ Custom hook to customize the behavior of Hatchling.
Here, we customize the tag of the generated wheels.
"""

-import sysconfig
from typing import Any, Dict

from hatchling.builders.hooks.plugin.interface import BuildHookInterface
+from packaging.tags import platform_tags


def get_tag() -> str:
"""Get appropriate wheel tag according to system"""
- tag_platform = sysconfig.get_platform().replace("-", "_").replace(".", "_")
- return f"py3-none-{tag_platform}"
+ platform_tag = next(platform_tags())
+ return f"py3-none-{platform_tag}"


class CustomBuildHook(BuildHookInterface):
diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml
index a470bb21f..e693008da 100644
--- a/python-package/pyproject.toml
+++ b/python-package/pyproject.toml
@@ -1,6 +1,7 @@
[build-system]
requires = [
- "hatchling>=1.12.1"
+ "hatchling>=1.12.1",
+ "packaging>=22.0",
]
backend-path = ["."]
build-backend = "packager.pep517"
--
2.34.1