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

Python 3.12: Refactor out Distutils #4392

Merged
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
22 changes: 8 additions & 14 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ jobs:
env:
CXXFLAGS: "-Werror"
CMAKE_GENERATOR: Ninja
# setuptools/mp4py work-around, see
# https://github.com/mpi4py/mpi4py/pull/159
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
SETUPTOOLS_USE_DISTUTILS: stdlib
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
python-version: '3.x'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unconstrain the upper Python version that gets installed. I constrained it in ed13486 to unbreak CI by avoiding Python 3.12 for a few days.

I want it unconstrained again, so I see if there are breaking changes once new Python versions are released.

Ref.: https://github.com/actions/setup-python#setup-python

- name: install dependencies
run: |
.github/workflows/dependencies/nvcc11-3.sh
Expand Down Expand Up @@ -75,7 +71,8 @@ jobs:
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
cmake --build build_sp -j 2

python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel
export WARPX_MPI=ON
export PYWARPX_LIB_DIR=$PWD/build_sp/lib/site-packages/pywarpx/
python3 -m pip wheel .
Expand Down Expand Up @@ -118,13 +115,9 @@ jobs:
name: [email protected] NVCC/NVC++ Release [tests]
runs-on: ubuntu-20.04
if: github.event.pull_request.draft == false
env:
# For NVHPC, Ninja is slower than the default:
#CMAKE_GENERATOR: Ninja
# setuptools/mp4py work-around, see
# https://github.com/mpi4py/mpi4py/pull/159
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
SETUPTOOLS_USE_DISTUTILS: stdlib
#env:
# # For NVHPC, Ninja is slower than the default:
# CMAKE_GENERATOR: Ninja
steps:
- uses: actions/checkout@v3
- name: Dependencies
Expand Down Expand Up @@ -175,7 +168,8 @@ jobs:
# https://github.com/mpi4py/mpi4py/issues/114
#export CFLAGS="-noswitcherror"

#python3 -m pip install --upgrade pip setuptools wheel
#python3 -m pip install --upgrade pip
#python3 -m pip install --upgrade build packaging setuptools wheel
#export WARPX_MPI=ON
#export PYWARPX_LIB_DIR=$PWD/build/lib/site-packages/pywarpx/
#python3 -m pip wheel .
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
export CXX=$(which icpc)
export CC=$(which icc)

python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel

cmake -S . -B build_dp \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand Down Expand Up @@ -104,7 +105,7 @@ jobs:
export CC=$(which icx)

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade build packaging setuptools wheel

cmake -S . -B build_sp \
-DCMAKE_CXX_FLAGS_RELEASE="-O1 -DNDEBUG" \
Expand Down Expand Up @@ -178,6 +179,6 @@ jobs:

# Skip this as it will copy the binary artifacts and we are tight on disk space
# python3 -m pip install --upgrade pip
# python3 -m pip install --upgrade setuptools wheel
# python3 -m pip install --upgrade build packaging setuptools wheel
# PYWARPX_LIB_DIR=$PWD/build_sp/lib/site-packages/pywarpx/ python3 -m pip wheel .
# python3 -m pip install *.whl
6 changes: 1 addition & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jobs:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: TRUE
# For macOS, Ninja is slower than the default:
#CMAKE_GENERATOR: Ninja
# setuptools/mp4py work-around, see
# https://github.com/mpi4py/mpi4py/pull/159
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
SETUPTOOLS_USE_DISTUTILS: stdlib
steps:
- uses: actions/checkout@v3
- name: Brew Cache
Expand Down Expand Up @@ -65,7 +61,7 @@ jobs:
- name: build WarpX
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade build packaging setuptools wheel

cmake -S . -B build_dp \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ jobs:
CXX: clang++
# On CI for this test, Ninja is slower than the default:
#CMAKE_GENERATOR: Ninja
# setuptools/mp4py work-around, see
# https://github.com/mpi4py/mpi4py/pull/159
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
SETUPTOOLS_USE_DISTUTILS: stdlib
steps:
- uses: actions/checkout@v3
- name: install dependencies
Expand All @@ -190,7 +186,8 @@ jobs:
ccache-openmp-pyfull-
- name: build WarpX
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel

export CXXFLAGS="-Werror -Wno-error=pass-failed"

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.x'
- name: CCache Cache
uses: actions/cache@v3
# - once stored under a key, they become immutable (even if local cache path content changes)
Expand All @@ -41,7 +41,9 @@ jobs:
cmake --build build --config Debug --parallel 2
if(!$?) { Exit $LASTEXITCODE }

python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
if(!$?) { Exit $LASTEXITCODE }
python3 -m pip install --upgrade build packaging setuptools wheel
if(!$?) { Exit $LASTEXITCODE }
cmake --build build --config Debug --target install
if(!$?) { Exit $LASTEXITCODE }
Expand Down Expand Up @@ -100,7 +102,9 @@ jobs:
cmake --build build --config Release --target install
if errorlevel 1 exit 1

python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
if errorlevel 1 exit 1
python3 -m pip install --upgrade build packaging setuptools wheel
if errorlevel 1 exit 1
python3 -m pip install --upgrade -r requirements.txt
if errorlevel 1 exit 1
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ option(WarpX_PYTHON_IPO
)

set(pyWarpX_VERSION_INFO "" CACHE STRING
"PEP-440 conformant version (set by distutils)")
"PEP-440 conformant version (set by setup.py)")

# enforce consistency of dependent options
if(WarpX_APP OR WarpX_PYTHON)
Expand Down
3 changes: 2 additions & 1 deletion Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ PICMI Python Bindings

.. code-block:: bash

python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U pip
python3 -m pip install -U build packaging setuptools wheel
python3 -m pip install -U cmake
python3 -m pip install -r requirements.txt

Expand Down
2 changes: 2 additions & 0 deletions Docs/source/install/hpc/lawrencium.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Optionally, download and install Python packages for :ref:`PICMI <usage-picmi>`
python3 -m venv $HOME/sw/v100/venvs/warpx
source $HOME/sw/v100/venvs/warpx/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
3 changes: 2 additions & 1 deletion Docs/source/install/hpc/lxplus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ Now, ensure Python tooling is up-to-date:

.. code-block:: bash

python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U pip
python3 -m pip install -U build packaging setuptools wheel
python3 -m pip install -U cmake

Then we compile WarpX as in the previous section (with or without CUDA) adding ``-DWarpX_PYTHON=ON`` and then we install it into our Python:
Expand Down
5 changes: 2 additions & 3 deletions Docs/source/install/users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ Given that you have the :ref:`WarpX dependencies <install-dependencies>` install

.. code-block:: bash

# optional: --user
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U pip
python3 -m pip install -U build packaging setuptools wheel
python3 -m pip install -U cmake

python3 -m pip wheel -v git+https://github.com/ECP-WarpX/WarpX.git
# optional: --user
python3 -m pip install *whl

In the future, will publish pre-compiled binary packages on `PyPI <https://pypi.org/>`__ for faster installs.
Expand Down
1 change: 1 addition & 0 deletions Docs/source/maintenance/performance_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Then, in ``$AUTOMATED_PERF_TESTS``, create a file ``run_automated_performance_te
# lines below this comment once, before submission.
# The commented lines take too long for the job script.
#python3 -m pip install --upgrade pip
#python3 -m pip install --upgrade build packaging setuptools wheel
#python3 -m pip install --upgrade cython
#python3 -m pip install --upgrade numpy
#python3 -m pip install --upgrade markupsafe
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/adastra-cines/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ rm -rf ${SW_DIR}/venvs/warpx-adastra
python3 -m venv ${SW_DIR}/venvs/warpx-adastra
source ${SW_DIR}/venvs/warpx-adastra/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/crusher-olcf/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ rm -rf ${SW_DIR}/venvs/warpx-crusher
python3 -m venv ${SW_DIR}/venvs/warpx-crusher
source ${SW_DIR}/venvs/warpx-crusher/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/frontier-olcf/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ rm -rf ${SW_DIR}/venvs/warpx-frontier
python3 -m venv ${SW_DIR}/venvs/warpx-frontier
source ${SW_DIR}/venvs/warpx-frontier/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/hpc3-uci/install_gpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ rm -rf ${SW_DIR}/venvs/warpx-gpu
python3 -m venv ${SW_DIR}/venvs/warpx-gpu
source ${SW_DIR}/venvs/warpx-gpu/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/karolina-it4i/install_cpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ rm -rf ${SW_DIR}/venvs/warpx-cpu
python3 -m venv ${SW_DIR}/venvs/warpx-cpu
source ${SW_DIR}/venvs/warpx-cpu/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/karolina-it4i/install_gpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ rm -rf ${SW_DIR}/venvs/warpx-gpu
python3 -m venv ${SW_DIR}/venvs/warpx-gpu
source ${SW_DIR}/venvs/warpx-gpu/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/lassen-llnl/install_v100_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ python3 -m venv ${SW_DIR}/venvs/warpx-lassen
source ${SW_DIR}/venvs/warpx-lassen/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip cache purge
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
# Older version for h4py
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/lassen-llnl/install_v100_dependencies_toss3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ python3 -m venv ${SW_DIR}/venvs/warpx-lassen-toss3
source ${SW_DIR}/venvs/warpx-lassen-toss3/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip cache purge
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
# Older version for h4py
Expand Down
1 change: 1 addition & 0 deletions Tools/machines/lassen-llnl/install_v100_ml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ rm -rf build
cd -

# optional: optimas dependencies (based on libEnsemble & ax->botorch->gpytorch->pytorch)
# TODO: scikit-learn needs a BLAS hint
# commented because scikit-learn et al. compile > 2 hrs
# please run manually on a login node if needed
#python3 -m pip install -r ${SRC_DIR}/warpx/Tools/optimas/requirements.txt
2 changes: 2 additions & 0 deletions Tools/machines/leonardo-cineca/install_gpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ source ${SW_DIR}/venvs/warpx/bin/activate
python3 -m ensurepip --upgrade
python3 -m pip cache purge
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/lumi-csc/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ rm -rf ${SW_DIR}/venvs/warpx-lumi
python3 -m venv ${SW_DIR}/venvs/warpx-lumi
source ${SW_DIR}/venvs/warpx-lumi/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/perlmutter-nersc/install_cpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ rm -rf ${SW_DIR}/venvs/warpx
python3 -m venv ${SW_DIR}/venvs/warpx
source ${SW_DIR}/venvs/warpx/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/perlmutter-nersc/install_gpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ rm -rf ${SW_DIR}/venvs/warpx
python3 -m venv ${SW_DIR}/venvs/warpx
source ${SW_DIR}/venvs/warpx/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/quartz-llnl/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ python3 -m venv ${SW_DIR}/venvs/warpx-quartz
source ${SW_DIR}/venvs/warpx-quartz/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip cache purge
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
2 changes: 2 additions & 0 deletions Tools/machines/summit-olcf/install_gpu_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ rm -rf ${SW_DIR}/venvs/warpx-summit
python3 -m venv ${SW_DIR}/venvs/warpx-summit
source ${SW_DIR}/venvs/warpx-summit/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m pip install --upgrade packaging
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade cython
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
requires = [
"setuptools>=42",
"wheel",
"cmake>=3.20.0,<4.0.0"
"cmake>=3.20.0,<4.0.0",
"packaging>=23",
]
build-backend = "setuptools.build_meta"
7 changes: 2 additions & 5 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@ echo "cd $PWD"
rm -rf py-venv
python3 -m venv py-venv
source py-venv/bin/activate
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel
python3 -m pip install --upgrade cmake
# setuptools/mp4py work-around, see
# https://github.com/mpi4py/mpi4py/pull/159
# https://github.com/mpi4py/mpi4py/issues/157#issuecomment-1001022274
export SETUPTOOLS_USE_DISTUTILS="stdlib"
python3 -m pip install --upgrade -r warpx/Regression/requirements.txt

# Clone AMReX and warpx-data
Expand Down
Loading
Loading