From 22c551031656fa2417ab70d7428a84bbdf08fa86 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 15:40:55 -0800 Subject: [PATCH 1/7] Move pytest config to pyproject.toml. --- python/pyproject.toml | 19 ++++++++++++++++++- python/setup.cfg | 16 ---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 219b214dc0..aa697fdeb4 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,7 +13,6 @@ # limitations under the License. [build-system] - requires = [ "wheel", "setuptools", @@ -28,6 +27,24 @@ 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[.*]", +] + [tool.black] line-length = 79 target-version = ["py38"] diff --git a/python/setup.cfg b/python/setup.cfg index 19e192ed93..c11182ac86 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -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[.*] From 4d9c418dcd316df08568512bf6777c0d7f2d2593 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 15:43:08 -0800 Subject: [PATCH 2/7] Move flake8 config to separate file. --- .pre-commit-config.yaml | 2 +- python/{setup.cfg => .flake8} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename python/{setup.cfg => .flake8} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e80c0b6a76..f01bab2c27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/python/setup.cfg b/python/.flake8 similarity index 100% rename from python/setup.cfg rename to python/.flake8 From 7c8505be240fb4d2127a7247b02527f82f438ff0 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 16:05:08 -0800 Subject: [PATCH 3/7] Move as much setup data to pyproject.toml as possible. --- python/pyproject.toml | 54 +++++++++++++++++++++++++++++++++++++++++++ python/setup.py | 42 --------------------------------- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index aa697fdeb4..13a45f5c05 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -45,6 +45,60 @@ filterwarnings = [ "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"] diff --git a/python/setup.py b/python/setup.py index 22d4d0274c..21ab3b93de 100644 --- a/python/setup.py +++ b/python/setup.py @@ -107,52 +107,10 @@ 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, ) From 8c2eb755e1436dfb697aec02fa30bbbf2e845bc1 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 16:07:10 -0800 Subject: [PATCH 4/7] Move package data to MANIFEST. --- python/MANIFEST.in | 8 ++++++++ python/setup.py | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 python/MANIFEST.in diff --git a/python/MANIFEST.in b/python/MANIFEST.in new file mode 100644 index 0000000000..bdb96a62f2 --- /dev/null +++ b/python/MANIFEST.in @@ -0,0 +1,8 @@ +# 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 cudf CMakeLists.txt +recursive-include cmake * diff --git a/python/setup.py b/python/setup.py index 21ab3b93de..e1dc31a683 100644 --- a/python/setup.py +++ b/python/setup.py @@ -109,8 +109,5 @@ def clean_folder(path): setup( include_package_data=True, packages=find_packages(include=["cuml", "cuml.*"]), - package_data={ - key: ["*.pxd"] for key in find_packages(include=["cuml", "cuml.*"]) - }, zip_safe=False, ) From ef1e7927672c3b0bc319e97debfd5a4d44b09cde Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 16:12:14 -0800 Subject: [PATCH 5/7] Update update-version.sh. --- ci/release/update-version.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 1d70d618b1..6867419c14 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -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 From d236ffc459df045ccabfa0a8224097bb4bffd959 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 24 Feb 2023 16:15:42 -0800 Subject: [PATCH 6/7] Update wheel mods scripts. --- ci/release/apply_wheel_modifications.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ci/release/apply_wheel_modifications.sh b/ci/release/apply_wheel_modifications.sh index 087fb706d5..5b97bf8c77 100755 --- a/ci/release/apply_wheel_modifications.sh +++ b/ci/release/apply_wheel_modifications.sh @@ -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 From 7845191c74906f41869d1260c83cf59e40e082c5 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Mon, 6 Mar 2023 12:22:44 -0800 Subject: [PATCH 7/7] Fix typo and remove unnecessary line. --- python/MANIFEST.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/MANIFEST.in b/python/MANIFEST.in index bdb96a62f2..dfc58434ea 100644 --- a/python/MANIFEST.in +++ b/python/MANIFEST.in @@ -4,5 +4,4 @@ recursive-include cuml *.pyx # Build files. Don't use a recursive include on '.' in case the repo is dirty include . CMakeLists.txt -recursive-include cudf CMakeLists.txt -recursive-include cmake * +recursive-include cuml CMakeLists.txt