Skip to content

Commit

Permalink
Replace setup.py with pyproject toml (#617)
Browse files Browse the repository at this point in the history
This MR is on top of #615 and #616 so those should be reviewed and merged first.

Currently `run build_python_package` will be in a broken state.

Authors:
  - Gregory Lee (https://github.com/grlee77)

Approvers:
  - Gigon Bae (https://github.com/gigony)
  - Ray Douglass (https://github.com/raydouglass)
  - https://github.com/jakirkham

URL: #617
  • Loading branch information
grlee77 authored Oct 27, 2023
1 parent d489bb3 commit 1589a0d
Show file tree
Hide file tree
Showing 10 changed files with 334 additions and 771 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ repos:
hooks:
- id: isort
files: ^python/cucim/src/.*
args: ["--settings-path=python/cucim/pyproject_.toml"]
args: ["--settings-path=python/cucim/pyproject.toml"]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
files: (python|legate)/.*
args: ["--config", "python/cucim/pyproject_.toml"]
args: ["--config", "python/cucim/pyproject.toml"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
files: python/.*$
args: ["--exclude", "__init__.py"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: ["--toml", "python/cucim/pyproject_.toml"]
args: ["--toml", "python/cucim/pyproject.toml"]
additional_dependencies:
- tomli
1 change: 1 addition & 0 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function sed_runner() {
sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/source/conf.py
sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/source/conf.py

sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cucim/pyproject.toml
sed_runner "s/${CURRENT_LONG_TAG}/${NEXT_FULL_TAG}/g" VERSION
sed_runner "s/${CURRENT_LONG_TAG}/${NEXT_FULL_TAG}/g" python/cucim/VERSION
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cucim/src/cucim/__init__.pyi
Expand Down
8 changes: 4 additions & 4 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ dependencies:
- cmake>=3.23.1,!=3.25.0
- cuda-version=11.8
- cudatoolkit
- cupy >=12.0.0
- cupy>=12.0.0
- cxx-compiler
- gcc_linux-64=11.*
- imagecodecs>=2021.6.8
- ipython
- jbig
- lazy_loader >=0.1
- lazy_loader>=0.1
- libcufile-dev=1.4.0.31
- libcufile=1.4.0.31
- libnvjpeg-dev=11.6.0.55
- libnvjpeg=11.6.0.55
- libwebp-base
- nbsphinx
- ninja
- numpy >=1.21.3
- numpy>=1.21.3
- numpydoc
- nvcc_linux-64=11.8
- openslide-python>=1.1.2
Expand All @@ -40,7 +40,7 @@ dependencies:
- pytest>=6.2.4
- python>=3.8,<3.11
- recommonmark
- scikit-image >=0.19.0,<0.22.0a0
- scikit-image>=0.19.0,<0.22.0a0
- scipy
- sphinx<6
- sysroot_linux-64==2.17
Expand Down
8 changes: 4 additions & 4 deletions conda/environments/all_cuda-120_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ dependencies:
- cuda-cudart-dev
- cuda-nvcc
- cuda-version=12.0
- cupy >=12.0.0
- cupy>=12.0.0
- cxx-compiler
- gcc_linux-64=11.*
- imagecodecs>=2021.6.8
- ipython
- jbig
- lazy_loader >=0.1
- lazy_loader>=0.1
- libcufile-dev
- libnvjpeg-dev
- libnvjpeg-static
- libwebp-base
- nbsphinx
- ninja
- numpy >=1.21.3
- numpy>=1.21.3
- numpydoc
- openslide-python>=1.1.2
- pip
Expand All @@ -39,7 +39,7 @@ dependencies:
- pytest>=6.2.4
- python>=3.8,<3.11
- recommonmark
- scikit-image >=0.19.0,<0.22.0a0
- scikit-image>=0.19.0,<0.22.0a0
- scipy
- sphinx<6
- sysroot_linux-64==2.17
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cucim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ cp -P python/install/lib/* python/cucim/src/cucim/clara/
pushd python/cucim

echo "PYTHON: ${PYTHON}"
$PYTHON setup.py install
$PYTHON -m pip install . -vv

popd
96 changes: 88 additions & 8 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,44 @@ files:
- cudatoolkit
- docs
- py_version
py_build:
output: pyproject
pyproject_dir: python/cucim
extras:
table: build-system
includes:
- build
py_run:
output: pyproject
pyproject_dir: python/cucim
extras:
table: project
includes:
- run
py_optional_test:
output: pyproject
pyproject_dir: python/cucim
extras:
table: project.optional-dependencies
key: test
includes:
- test_python
py_develop:
output: pyproject
pyproject_dir: python/cucim
extras:
table: project.optional-dependencies
key: developer
includes:
- develop
py_develop:
output: pyproject
pyproject_dir: python/cucim
extras:
table: project.optional-dependencies
key: docs
includes:
- docs
channels:
- rapidsai
- rapidsai-nightly
Expand All @@ -38,6 +76,11 @@ channels:
dependencies:
build:
common:
# Note:
# Currently omit pyproject output_type from cmake, ninja. The python
# build doesn't use these, but assumes that the C++ libcucim shared
# library had already previously been built and the .so file copied to
# python/cucim/src/cucim/clara/ before calling `pip install .`.
- output_types: [conda, requirements]
packages:
- cmake>=3.23.1,!=3.25.0
Expand All @@ -46,6 +89,10 @@ dependencies:
packages:
- c-compiler
- cxx-compiler
- output_types: [requirements, pyproject]
packages:
- setuptools>=24.2.0
- wheel
specific:
- output_types: conda
matrices:
Expand Down Expand Up @@ -124,9 +171,17 @@ dependencies:
- cuda-cudart-dev
- libnvjpeg-dev
- libcufile-dev
develop:
common:
- output_types: [conda, requirements, pyproject]
packages:
- pre-commit
- black
- ruff
- isort
docs:
common:
- output_types: [conda, requirements]
- output_types: [conda, requirements, pyproject]
packages:
- ipython
- nbsphinx
Expand Down Expand Up @@ -157,25 +212,37 @@ dependencies:
- python>=3.8,<3.11
run:
common:
- output_types: [conda, requirements, pyproject]
packages:
- lazy_loader>=0.1
- scikit-image>=0.19.0,<0.22.0a0
- scipy
- output_types: conda
packages:
- cupy>=12.0.0
- numpy>=1.21.3
# All dependencies below this point are specific to `cucim.clara` and
# are not needed for either `cucim.core` or `cucim.skimage`. I did
# not include these under a "pyproject" output so that it is still
# possible to run `pip install .` from the python/cucim folder
# without having build the C++ library at all. This allows, usage of
# usage of `cucim.skimage` on Windows, for example.
- click
- cupy >=12.0.0
- jbig
- lazy_loader >=0.1
- libwebp-base
- numpy >=1.21.3
- scikit-image >=0.19.0,<0.22.0a0
- scipy
- xz
- zlib
- zstd
# Not sure where these go, if anywhere:
# - openslide
# - xorg-libxcb
- output_types: [requirements, pyproject]
packages:
- cupy-cuda11x>=12.0.0
- numpy
test_python:
common:
- output_types: [conda, requirements]
- output_types: [conda, requirements, pyproject]
packages:
- GPUtil>=1.4.0
- imagecodecs>=2021.6.8
Expand All @@ -191,6 +258,19 @@ dependencies:
- pip
- pip:
- opencv-python-headless>=4.6
- output_types: [requirements]
- output_types: [requirements, pyproject]
packages:
- opencv-python-headless>=4.6
# All dependencies below this point are specific to `cucim.clara` and
# are not needed for either `cucim.core` or `cucim.skimage`, so are
# listed as optional. They are needed in order to run the full test
# suite, including the `cucim.clara` package.
- click
- jbig
- libwebp-base
- xz
- zlib
- zstd
# Not sure where these go, if anywhere:
# - openslide
# - xorg-libxcb
Loading

0 comments on commit 1589a0d

Please sign in to comment.