Skip to content

Commit

Permalink
Migrate as much as possible to pyproject.toml (#3317)
Browse files Browse the repository at this point in the history
This moves as much packaging information and linter configuration out of setup.[py|cfg] files into pyproject.toml with the aim of migrating to more modern Python builders in the future.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Ray Douglass (https://github.com/raydouglass)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #3317
  • Loading branch information
vyasr authored Mar 16, 2023
1 parent d9b83b9 commit 107205c
Show file tree
Hide file tree
Showing 33 changed files with 349 additions and 280 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
args: ["--config=setup.cfg"]
args: ["--config=.flake8"]
files: python/.*$
types: [file]
types_or: [python] # TODO: Enable [python, cython]
Expand Down
38 changes: 15 additions & 23 deletions ci/release/apply_wheel_modifications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,24 @@ sed -i "s/__version__ = .*/__version__ = \"${VERSION}\"/g" \
python/pylibcugraph/pylibcugraph/__init__.py

# setup.py updates
sed -i "s/version=.*,/version=\"${VERSION}\",/g" \
python/cugraph/setup.py \
python/cugraph-dgl/setup.py \
python/cugraph-pyg/setup.py \
python/cugraph-service/client/setup.py \
python/cugraph-service/server/setup.py \
python/pylibcugraph/setup.py
sed -i "s/^version = .*/version = \"${VERSION}\"/g" \
python/cugraph/pyproject.toml \
python/cugraph-dgl/pyproject.toml \
python/cugraph-pyg/pyproject.toml \
python/cugraph-service/client/pyproject.toml \
python/cugraph-service/server/pyproject.toml \
python/pylibcugraph/pyproject.toml

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

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

# Dependency versions in pylibcugraph pyproject.toml
# pylibcugraph pyproject.toml cuda suffixes
sed -i "s/name = \"pylibcugraph\"/name = \"pylibcugraph${CUDA_SUFFIX}\"/g" python/pylibcugraph/pyproject.toml
sed -i "s/rmm/rmm${CUDA_SUFFIX}/g" python/pylibcugraph/pyproject.toml
sed -i "s/pylibraft/pylibraft${CUDA_SUFFIX}/g" python/pylibcugraph/pyproject.toml
sed -i "s/cudf/cudf${CUDA_SUFFIX}/g" python/pylibcugraph/pyproject.toml

# Dependency versions in cugraph pyproject.toml
# cugraph pyproject.toml cuda suffixes
sed -i "s/name = \"cugraph\"/name = \"cugraph${CUDA_SUFFIX}\"/g" python/cugraph/pyproject.toml
sed -i "s/rmm/rmm${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
sed -i "s/pylibraft/pylibraft${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
sed -i "s/cudf/cudf${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
sed -i "s/raft-dask/raft-dask${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
sed -i "s/pylibcugraph/pylibcugraph${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
sed -i "s/pylibraft/pylibraft${CUDA_SUFFIX}/g" python/cugraph/pyproject.toml
32 changes: 19 additions & 13 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/cugraph/sour

# Python __init__.py updates
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph/cugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-dgl/cugraph-dgl/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-pyg/cugraph-pyg/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-dgl/cugraph_dgl/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-pyg/cugraph_pyg/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/client/cugraph_service_client/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/server/cugraph_service_server/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/pylibcugraph/pylibcugraph/__init__.py

# Python setup.py updates
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/cugraph/setup.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/cugraph-dgl/setup.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/cugraph-pyg/setup.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/cugraph-service/client/setup.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/cugraph-service/server/setup.py
sed_runner "s/version=.*,/version=\"${NEXT_FULL_TAG}\",/g" python/pylibcugraph/setup.py
# Python pyproject.toml updates
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-dgl/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-pyg/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/client/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/server/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/pylibcugraph/pyproject.toml

for FILE in conda/environments/*.yaml dependencies.yaml; do
sed_runner "s/libcugraphops=${CURRENT_SHORT_TAG}/libcugraphops=${NEXT_SHORT_TAG}/g" ${FILE};
Expand Down Expand Up @@ -106,7 +106,13 @@ done
NEXT_SHORT_TAG_PEP440=$(python -c "from setuptools.extern import packaging; print(packaging.version.Version('${NEXT_SHORT_TAG}'))")

# Wheel builds install intra-RAPIDS dependencies from same release
sed_runner "s/{cuda_suffix}[^\"].*\",/{cuda_suffix}==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pylibcugraph/setup.py
sed_runner "s/{cuda_suffix}.*\",/{cuda_suffix}==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pylibcugraph/_custom_build/backend.py
sed_runner "s/{cuda_suffix}[^\"].*\",/{cuda_suffix}==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/setup.py
sed_runner "s/{cuda_suffix}.*\",/{cuda_suffix}==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/_custom_build/backend.py
sed_runner "s/rmm==.*\",/rmm==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml
sed_runner "s/pylibraft==.*\",/pylibraft==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml
sed_runner "s/pylibcugraph==.*\",/pylibcugraph==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml
sed_runner "s/raft-dask==.*\",/raft-dask==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml
sed_runner "s/cudf==.*\",/cudf==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml
sed_runner "s/dask-cuda==.*\",/dask-cuda==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/cugraph/pyproject.toml

sed_runner "s/rmm==.*\",/rmm==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pylibcugraph/pyproject.toml
sed_runner "s/pylibraft==.*\",/pylibraft==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pylibcugraph/pyproject.toml
sed_runner "s/cudf==.*\",/cudf==${NEXT_SHORT_TAG_PEP440}.*\",/g" python/pylibcugraph/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright (c) 2022, NVIDIA CORPORATION.
# Copyright (c) 2022-2023, NVIDIA CORPORATION.

# This assumes the script is executed from the root of the repo directory

Expand All @@ -13,6 +13,6 @@

cd "${SRC_DIR}/python/cugraph-service/client"
mkdir -p pip_cache
$PYTHON -m pip install --no-index --no-deps --ignore-installed --cache-dir ./pip_cache . -vv
$PYTHON -m pip install --no-build-isolation --no-index --no-deps --ignore-installed --cache-dir ./pip_cache . -vv

#./build.sh cugraph-service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright (c) 2022, NVIDIA CORPORATION.
# Copyright (c) 2022-2023, NVIDIA CORPORATION.

# This assumes the script is executed from the root of the repo directory

Expand All @@ -13,6 +13,6 @@

cd "${SRC_DIR}/python/cugraph-service/server"
mkdir -p pip_cache
$PYTHON -m pip install --no-index --no-deps --ignore-installed --cache-dir ./pip_cache . -vv
$PYTHON -m pip install --no-build-isolation --no-index --no-deps --ignore-installed --cache-dir ./pip_cache . -vv

#./build.sh cugraph-service
2 changes: 2 additions & 0 deletions conda/recipes/cugraph-service/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ outputs:
host:
- pip
- python x.x
- setuptools
- wheel
run:
- {{ pin_subpackage('cugraph-service-client', exact=True) }}
- cudf ={{ minor_version }}
Expand Down
1 change: 1 addition & 0 deletions python/cugraph-dgl/LICENSE
File renamed without changes.
40 changes: 40 additions & 0 deletions python/cugraph-dgl/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

[build-system]

requires = [
"setuptools",
]
build-backend = "setuptools.build_meta"

[project]
name = "cugraph-dgl"
version = "23.04.00"
description = "cugraph extensions for DGL"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
dependencies = [
"cugraph",
"numba>=0.56.2",
"numpy",
]
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
]

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

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

[tool.setuptools.packages.find]
include = [
"cugraph_dgl*",
]
24 changes: 2 additions & 22 deletions python/cugraph-dgl/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import find_packages, setup
from setuptools import setup

install_requires = [
"cugraph",
"numba>=0.56.2",
"numpy",
]

setup(
name="cugraph-dgl",
description="cugraph wrappers around DGL",
version="23.04.00",
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python",
],
author="NVIDIA Corporation",
url="https://github.com/rapidsai/cugraph",
packages=find_packages(include=["cugraph_dgl*"]),
install_requires=install_requires,
license="Apache",
zip_safe=True,
)
setup()
1 change: 1 addition & 0 deletions python/cugraph-pyg/LICENSE
34 changes: 32 additions & 2 deletions python/cugraph-pyg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@
requires = [
"wheel",
"setuptools",
"scikit-build>=0.13.1",
"ninja",
]

[tool.pytest.ini_options]
testpaths = ["cugraph_pyg/tests"]

[project]
name = "cugraph_pyg"
version = "23.04.00"
description = "cugraph_pyg - PyG support for cuGraph massive-scale, ultra-fast GPU graph analytics."
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
]

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

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

[tool.setuptools.packages.find]
include = [
"cugraph_pyg*",
"cugraph_pyg.*",
]
15 changes: 0 additions & 15 deletions python/cugraph-pyg/setup.cfg

This file was deleted.

32 changes: 1 addition & 31 deletions python/cugraph-pyg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
import os
import shutil

from setuptools import find_packages, Command
from skbuild import setup
from setuptools import Command, setup

from setuputils import get_environment_option


INSTALL_REQUIRES = []

CUDA_HOME = get_environment_option("CUDA_HOME")

if not CUDA_HOME:
Expand Down Expand Up @@ -60,35 +57,8 @@ def run(self):
os.system("rm -rf dask-worker-space")
os.system('find . -name "__pycache__" -type d -exec rm -rf {} +')
os.system("rm -rf *.egg-info")
os.system("rm -rf _skbuild")


# FIXME possibly remove this since there is no Cython code in cugraph_pyg
PACKAGE_DATA = {key: ["*.pxd"] for key in find_packages(include=["cugraph_pyg*"])}


setup(
name="cugraph_pyg",
description="cugraph_pyg - PyG support for cuGraph massive-scale,"
" ultra-fast GPU graph analytics.",
version="23.04.00",
classifiers=[
# "Development Status :: 4 - Beta",
"Intended Audience :: Developers",
# "Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
# Include the separately-compiled shared library
author="NVIDIA Corporation",
setup_requires=[],
packages=find_packages(include=["cugraph_pyg", "cugraph_pyg.*"]),
package_data=PACKAGE_DATA,
include_package_data=True,
install_requires=INSTALL_REQUIRES,
license="Apache",
cmdclass={"clean": CleanCommand},
zip_safe=False,
)
1 change: 1 addition & 0 deletions python/cugraph-service/client/LICENSE
1 change: 1 addition & 0 deletions python/cugraph-service/client/README.md
41 changes: 41 additions & 0 deletions python/cugraph-service/client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022, NVIDIA CORPORATION.

[build-system]

requires = [
"wheel",
"setuptools",
]
build-backend = "setuptools.build_meta"

[project]
name = "cugraph-service-client"
version = "23.04.00"
description = "cuGraph Service client"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.8"
dependencies = [
"thriftpy2",
]
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
]

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

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

[tool.setuptools.packages.find]
include = [
"cugraph_service_client",
]
Loading

0 comments on commit 107205c

Please sign in to comment.