Skip to content

Commit

Permalink
Add support for Python 3.12 (#276)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#40

This PR adds support for Python 3.12.

## Notes for Reviewers

This is part of ongoing work to add Python 3.12 support across RAPIDS.
It temporarily introduces a build/test matrix including Python 3.12, from rapidsai/shared-workflows#213.

A follow-up PR will revert back to pointing at the `branch-24.10` branch of `shared-workflows` once all
RAPIDS repos have added Python 3.12 support.

### This will fail until all dependencies have been updates to Python 3.12

CI here is expected to fail until all of this project's upstream dependencies support Python 3.12.

This can be merged whenever all CI jobs are passing.

Authors:
  - James Lamb (https://github.com/jameslamb)
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Peter Andreas Entschev (https://github.com/pentschev)

URL: #276
  • Loading branch information
jameslamb authored Sep 9, 2024
1 parent 18ada55 commit bb30a22
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 61 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ concurrency:
jobs:
conda-cpp-build:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -38,7 +38,7 @@ jobs:
if: github.ref_type == 'branch'
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@python-3.12
with:
arch: "amd64"
branch: ${{ inputs.branch }}
Expand All @@ -51,15 +51,15 @@ jobs:
upload-conda:
needs: [conda-cpp-build]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
wheel-build-libucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -69,7 +69,7 @@ jobs:
wheel-publish-libucxx:
needs: wheel-build-libucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -80,7 +80,7 @@ jobs:
wheel-build-ucxx:
needs: wheel-build-libucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -90,7 +90,7 @@ jobs:
wheel-publish-ucxx:
needs: wheel-build-ucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -100,7 +100,7 @@ jobs:
package-type: python
wheel-build-distributed-ucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand All @@ -110,7 +110,7 @@ jobs:
wheel-publish-distributed-ucxx:
needs: [wheel-build-ucxx, wheel-build-distributed-ucxx]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@python-3.12
with:
build_type: ${{ inputs.build_type || 'branch' }}
branch: ${{ inputs.branch }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ jobs:
- wheel-build-distributed-ucxx
- wheel-tests-distributed-ucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@python-3.12
checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@python-3.12
with:
enable_check_generated_files: false
conda-cpp-build:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@python-3.12
with:
build_type: pull-request
docs-build:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@python-3.12
with:
build_type: pull-request
node_type: "gpu-v100-latest-1"
Expand All @@ -49,58 +49,58 @@ jobs:
conda-cpp-tests:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@python-3.12
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
conda-python-tests:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@python-3.12
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
conda-python-distributed-tests:
needs: conda-cpp-build
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@python-3.12
with:
build_type: pull-request
script: "ci/test_python_distributed.sh"
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
wheel-build-libucxx:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: pull-request
script: ci/build_wheel_libucxx.sh
wheel-build-ucxx:
needs: wheel-build-libucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: pull-request
script: ci/build_wheel_ucxx.sh
wheel-tests-ucxx:
needs: wheel-build-ucxx
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@python-3.12
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
script: ci/test_wheel_ucxx.sh
wheel-build-distributed-ucxx:
needs: checks
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@python-3.12
with:
build_type: pull-request
script: ci/build_wheel_distributed_ucxx.sh
wheel-tests-distributed-ucxx:
needs: [wheel-build-ucxx, wheel-build-distributed-ucxx]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@python-3.12
with:
build_type: pull-request
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
conda-cpp-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@python-3.12
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand All @@ -25,7 +25,7 @@ jobs:
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
conda-python-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@python-3.12
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand All @@ -34,7 +34,7 @@ jobs:
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
conda-python-distributed-tests:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@python-3.12
with:
build_type: nightly
script: "ci/test_python_distributed.sh"
Expand All @@ -44,7 +44,7 @@ jobs:
container-options: "--cap-add CAP_SYS_PTRACE --shm-size=8g --ulimit=nofile=1000000:1000000"
wheel-tests-ucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@python-3.12
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand All @@ -54,7 +54,7 @@ jobs:
script: ci/test_wheel_ucxx.sh
wheel-tests-distributed-ucxx:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-24.10
uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@python-3.12
with:
build_type: nightly
branch: ${{ inputs.branch }}
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
- pytest-asyncio
- pytest-rerunfailures
- pytest==7.*
- python>=3.10,<3.12
- python>=3.10,<3.13
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==24.10.*,>=0.0.0a0
- rmm==24.10.*,>=0.0.0a0
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-125_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
- pytest-asyncio
- pytest-rerunfailures
- pytest==7.*
- python>=3.10,<3.12
- python>=3.10,<3.13
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==24.10.*,>=0.0.0a0
- rmm==24.10.*,>=0.0.0a0
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/ucxx/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cmake:
python:
- 3.10
- 3.11
- 3.12

ucx:
- "==1.15.*"
Expand Down
34 changes: 2 additions & 32 deletions cpp/python/src/future.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,41 +113,13 @@ PyObject* create_python_future()
return result;
}

static PyCFunction get_future_method(const char* method_name)
{
PyCFunction result = NULL;

PyGILState_STATE state = PyGILState_Ensure();

PyObject* future_object = get_asyncio_future_object();
if (PyErr_Occurred()) {
ucxx_trace_req("ucxx::python::%s, error getting asyncio.Future method object", __func__);
PyErr_Print();
}
PyMethodDef* m = reinterpret_cast<PyTypeObject*>(future_object)->tp_methods;

for (; m != NULL; ++m) {
if (m->ml_name && !strcmp(m->ml_name, method_name)) {
result = m->ml_meth;
break;
}
}

if (!result)
PyErr_Format(PyExc_RuntimeError, "Unable to load function pointer for `Future.set_result`.");

PyGILState_Release(state);
return result;
}

PyObject* future_set_result(PyObject* future, PyObject* value)
{
PyObject* result = NULL;

PyGILState_STATE state = PyGILState_Ensure();

PyCFunction f = get_future_method("set_result");
result = f(future, value);
result = PyObject_CallMethodOneArg(future, set_result_str, value);
if (PyErr_Occurred()) {
ucxx_trace_req("ucxx::python::%s, error calling `set_result()` from `asyncio.Future` object",
__func__);
Expand All @@ -165,7 +137,6 @@ PyObject* future_set_exception(PyObject* future, PyObject* exception, const char
PyObject* message_object = NULL;
PyObject* message_tuple = NULL;
PyObject* formed_exception = NULL;
PyCFunction f = NULL;

PyGILState_STATE state = PyGILState_Ensure();

Expand All @@ -176,9 +147,8 @@ PyObject* future_set_exception(PyObject* future, PyObject* exception, const char
formed_exception = PyObject_Call(exception, message_tuple, NULL);
if (formed_exception == NULL) goto err;

f = get_future_method("set_exception");
result = PyObject_CallMethodOneArg(future, set_exception_str, formed_exception);

result = f(future, formed_exception);
goto finish;

err:
Expand Down
6 changes: 5 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,12 @@ dependencies:
packages:
- python=3.11
- matrix:
py: "3.12"
packages:
- python>=3.10,<3.12
- python=3.12
- matrix:
packages:
- python>=3.10,<3.13
run_python_ucxx:
common:
- output_types: [conda, requirements, pyproject]
Expand Down
1 change: 1 addition & 0 deletions python/distributed-ucxx/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.entry-points."distributed.comm.backends"]
Expand Down

0 comments on commit bb30a22

Please sign in to comment.