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

Migrate as much as possible to pyproject.toml #5251

Merged
merged 8 commits into from
Mar 7, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
rev: 5.0.4
hooks:
- id: flake8
args: [--config=python/setup.cfg]
args: [--config=python/.flake8]
files: python/.*$
types: [file]
types_or: [python, cython]
Expand Down
17 changes: 7 additions & 10 deletions ci/release/apply_wheel_modifications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ CUDA_SUFFIX=${2}
# __init__.py versions
sed -i "s/__version__ = .*/__version__ = \"${VERSION}\"/g" python/cuml/__init__.py

# setup.py versions
sed -i "s/version=.*,/version=\"${VERSION}\",/g" python/setup.py
# pyproject.toml versions
sed -i "s/^version = .*/version = \"${VERSION}\"/g" python/pyproject.toml

# setup.py cuda suffixes
sed -i "s/name=\"cuml\"/name=\"cuml${CUDA_SUFFIX}\"/g" python/setup.py
sed -i "s/cudf/cudf${CUDA_SUFFIX}/g" python/setup.py
sed -i "s/pylibraft/pylibraft${CUDA_SUFFIX}/g" python/setup.py
sed -i "s/raft-dask/raft-dask${CUDA_SUFFIX}/g" python/setup.py

# cudf pyproject.toml cuda suffixes
sed -i "s/rmm/rmm${CUDA_SUFFIX}/g" python/pyproject.toml
# pyproject.toml cuda suffixes
sed -i "s/^name = \"cuml\"/name = \"cuml${CUDA_SUFFIX}\"/g" python/pyproject.toml
sed -i "s/cudf/cudf${CUDA_SUFFIX}/g" python/pyproject.toml
sed -i "s/pylibraft/pylibraft${CUDA_SUFFIX}/g" python/pyproject.toml
sed -i "s/raft-dask/raft-dask${CUDA_SUFFIX}/g" python/pyproject.toml
sed -i "s/rmm/rmm${CUDA_SUFFIX}/g" python/pyproject.toml
13 changes: 4 additions & 9 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,13 @@ function sed_runner() {
}


# __init__.py and setup.py versions
# __init__.py and pyproject.toml versions
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cuml/__init__.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/setup.py

# Dependency versions in pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/pyproject.toml
sed_runner "s/rmm==.*\",/rmm==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pyproject.toml
sed_runner "s/cudf==.*\",/cudf==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pyproject.toml
sed_runner "s/pylibraft==.*\",/pylibraft==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pyproject.toml

# Dependency versions in setup.py
sed_runner "s/cudf==.*\",/cudf==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/setup.py
sed_runner "s/pylibraft==.*\",/pylibraft==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/setup.py
sed_runner "s/raft-dask==.*\",/raft-dask==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/setup.py
sed_runner "s/raft-dask==.*\",/raft-dask==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pyproject.toml


# CMakeLists
Expand Down
16 changes: 0 additions & 16 deletions python/setup.cfg → python/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,3 @@ per-file-ignores =
# Cython Exclusions
*.pyx: E999, E225, E226, E227, W503, W504
*.pxd: E999, E225, E226, E227, W503, W504

[pytest]
markers =
unit: Quickest tests focused on accuracy and correctness
quality: More intense tests than unit with increased runtimes
stress: Longest running tests focused on stressing hardware compute resources
mg: Multi-GPU tests
memleak: Test that checks for memory leaks
no_bad_cuml_array_check: Test that should not check for bad CumlArray uses

testpaths = cuml/tests

filterwarnings =
error::FutureWarning:cuml[.*] # Catch uses of deprecated positional args in testing
ignore:[^.]*ABCs[^.]*:DeprecationWarning:patsy[.*]
ignore:(.*)alias(.*):DeprecationWarning:hdbscan[.*]
7 changes: 7 additions & 0 deletions python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cython files
recursive-include cuml *.pxd
recursive-include cuml *.pyx

# Build files. Don't use a recursive include on '.' in case the repo is dirty
include . CMakeLists.txt
recursive-include cuml CMakeLists.txt
73 changes: 72 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

[build-system]

requires = [
"wheel",
"setuptools",
Expand All @@ -28,6 +27,78 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
markers = [
"unit: Quickest tests focused on accuracy and correctness",
"quality: More intense tests than unit with increased runtimes",
"stress: Longest running tests focused on stressing hardware compute resources",
"mg: Multi-GPU tests",
"memleak: Test that checks for memory leaks",
"no_bad_cuml_array_check: Test that should not check for bad CumlArray uses",
]

testpaths = "cuml/tests"

filterwarnings = [
"error::FutureWarning:cuml[.*]", # Catch uses of deprecated positional args in testing
"ignore:[^.]*ABCs[^.]*:DeprecationWarning:patsy[.*]",
"ignore:(.*)alias(.*):DeprecationWarning:hdbscan[.*]",
]

[project]
name = "cuml"
version = "23.04.00"
description = "cuML - RAPIDS ML Algorithms"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
dependencies = [
"numba",
"scipy",
"seaborn",
"treelite==3.1.0",
"treelite_runtime==3.1.0",
"cudf==23.4.*",
"dask-cudf==23.4.*",
"pylibraft==23.4.*",
"raft-dask==23.4.*",
]
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]

[project.optional-dependencies]
test = [
"pytest",
"hypothesis",
"pytest-xdist",
"pytest-benchmark",
"pytest-cases",
"nltk",
"dask-ml",
"numpydoc",
"umap-learn",
"statsmodels",
"scikit-learn==1.2",
"hdbscan @ git+https://github.com/scikit-learn-contrib/hdbscan.git@master", # noqa:E501
"dask-glm @ git+https://github.com/dask/dask-glm@main",
"dask-cuda",
]

[project.urls]
Homepage = "https://github.com/rapidsai/cuml"
Documentation = "https://docs.rapids.ai/api/cuml/stable/"

[tool.setuptools]
license-files = ["LICENSE"]

[tool.black]
line-length = 79
target-version = ["py38"]
Expand Down
45 changes: 0 additions & 45 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,52 +107,7 @@ def clean_folder(path):
# - Python package generation ------------------------------------------------

setup(
name="cuml",
version="23.04.00",
description="cuML - RAPIDS ML Algorithms",
url="https://github.com/rapidsai/cuml",
author="NVIDIA Corporation",
license="Apache 2.0",
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
include_package_data=True,
packages=find_packages(include=["cuml", "cuml.*"]),
package_data={
key: ["*.pxd"] for key in find_packages(include=["cuml", "cuml.*"])
},
install_requires=[
"numba",
"scipy",
"seaborn",
"treelite==3.1.0",
"treelite_runtime==3.1.0",
"cudf==23.4.*",
"dask-cudf==23.4.*",
"pylibraft==23.4.*",
"raft-dask==23.4.*",
],
extras_require={
"test": [
"pytest",
"hypothesis",
"pytest-xdist",
"pytest-benchmark",
"pytest-cases",
"nltk",
"dask-ml",
"numpydoc",
"umap-learn",
"statsmodels",
"scikit-learn==1.2",
"hdbscan @ git+https://github.com/scikit-learn-contrib/hdbscan.git@master", # noqa:E501
"dask-glm @ git+https://github.com/dask/dask-glm@main",
"dask-cuda",
]
},
zip_safe=False,
)