diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml deleted file mode 100644 index c92f1f47fc9..00000000000 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# This file is generated by `rapids-dependency-file-generator`. -# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. -channels: -- rapidsai -- rapidsai-nightly -- dask/label/dev -- pytorch -- dglteam/label/cu118 -- conda-forge -- nvidia -dependencies: -- aiohttp -- c-compiler -- cmake>=3.26.4 -- cuda-version=11.8 -- cudatoolkit -- cudf==23.10.* -- cupy>=12.0.0 -- cxx-compiler -- cython>=3.0.0 -- dask-core>=2023.5.1 -- dask-cuda==23.10.* -- dask-cudf==23.10.* -- dask>=2023.5.1 -- distributed>=2023.5.1 -- doxygen -- fsspec[http]>=0.6.0 -- gcc_linux-64=11.* -- gmock>=1.13.0 -- graphviz -- gtest>=1.13.0 -- ipython -- libcudf==23.10.* -- libcugraphops==23.10.* -- libraft-headers==23.10.* -- libraft==23.10.* -- librmm==23.10.* -- nbsphinx -- nccl>=2.9.9 -- networkx>=2.5.1 -- ninja -- notebook>=0.5.0 -- numba>=0.57 -- numpy>=1.21 -- numpydoc -- nvcc_linux-64=11.8 -- openmpi -- pandas -- pre-commit -- pydata-sphinx-theme -- pylibcugraphops==23.10.* -- pylibraft==23.10.* -- pytest -- pytest-benchmark -- pytest-cov -- pytest-xdist -- python-louvain -- raft-dask==23.10.* -- recommonmark -- requests -- rmm==23.10.* -- scikit-build>=0.13.1 -- scikit-learn>=0.23.1 -- scipy -- sphinx-copybutton -- sphinx-markdown-tables -- sphinx<6 -- sphinxcontrib-websupport -- ucx-proc=*=gpu -- ucx-py==0.34.* -name: all_cuda-118_arch-x86_64 diff --git a/conda/environments/all_cuda-120_arch-x86_64.yaml b/conda/environments/all_cuda-120_arch-x86_64.yaml deleted file mode 100644 index 0b211458562..00000000000 --- a/conda/environments/all_cuda-120_arch-x86_64.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# This file is generated by `rapids-dependency-file-generator`. -# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. -channels: -- rapidsai -- rapidsai-nightly -- dask/label/dev -- pytorch -- dglteam/label/cu118 -- conda-forge -- nvidia -dependencies: -- aiohttp -- c-compiler -- cmake>=3.26.4 -- cuda-nvcc -- cuda-version=12.0 -- cudf==23.10.* -- cupy>=12.0.0 -- cxx-compiler -- cython>=3.0.0 -- dask-core>=2023.5.1 -- dask-cuda==23.10.* -- dask-cudf==23.10.* -- dask>=2023.5.1 -- distributed>=2023.5.1 -- doxygen -- fsspec[http]>=0.6.0 -- gcc_linux-64=11.* -- gmock>=1.13.0 -- graphviz -- gtest>=1.13.0 -- ipython -- libcudf==23.10.* -- libcugraphops==23.10.* -- libraft-headers==23.10.* -- libraft==23.10.* -- librmm==23.10.* -- nbsphinx -- nccl>=2.9.9 -- networkx>=2.5.1 -- ninja -- notebook>=0.5.0 -- numba>=0.57 -- numpy>=1.21 -- numpydoc -- openmpi -- pandas -- pre-commit -- pydata-sphinx-theme -- pylibcugraphops==23.10.* -- pylibraft==23.10.* -- pytest -- pytest-benchmark -- pytest-cov -- pytest-xdist -- python-louvain -- raft-dask==23.10.* -- recommonmark -- requests -- rmm==23.10.* -- scikit-build>=0.13.1 -- scikit-learn>=0.23.1 -- scipy -- sphinx-copybutton -- sphinx-markdown-tables -- sphinx<6 -- sphinxcontrib-websupport -- ucx-proc=*=gpu -- ucx-py==0.34.* -name: all_cuda-120_arch-x86_64 diff --git a/conda/recipes/cugraph-nx/build.sh b/conda/recipes/cugraph-nx/build.sh new file mode 100644 index 00000000000..31ad477a73e --- /dev/null +++ b/conda/recipes/cugraph-nx/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Copyright (c) 2023, NVIDIA CORPORATION. + +# This assumes the script is executed from the root of the repo directory + +./build.sh cugraph-nx diff --git a/conda/recipes/cugraph-nx/meta.yaml b/conda/recipes/cugraph-nx/meta.yaml new file mode 100644 index 00000000000..ba076207ed2 --- /dev/null +++ b/conda/recipes/cugraph-nx/meta.yaml @@ -0,0 +1,38 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. + +{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} +{% set py_version = environ['CONDA_PY'] %} +{% set date_string = environ['RAPIDS_DATE_STRING'] %} + +package: + name: cugraph-nx + version: {{ version }} + +source: + git_url: ../../.. + +build: + number: {{ GIT_DESCRIBE_NUMBER }} + build: + number: {{ GIT_DESCRIBE_NUMBER }} + string: py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} + +requirements: + host: + - python + run: + - pylibcugraph ={{ version }} + - networkx >=3.1 + - cupy >=12.0.0 + - python + +tests: + imports: + - cugraph_nx + +about: + home: https://rapids.ai/ + license: Apache-2.0 + license_file: ../../../LICENSE + summary: cuGraph backend for GPU-accelerated NetworkX diff --git a/dependencies.yaml b/dependencies.yaml index 1c2d30c0546..c042131fccf 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -14,12 +14,14 @@ files: - python_build_cythonize - python_run_cugraph - python_run_pylibcugraph + - python_run_cugraph_nx - python_run_cugraph_dgl - python_run_cugraph_pyg - test_notebook - test_python_common - test_python_cugraph - test_python_pylibcugraph + - test_python_cugraph_nx checks: output: none includes: @@ -103,6 +105,33 @@ files: includes: - test_python_common - test_python_pylibcugraph + + + py_build_cugraph_nx: + output: pyproject + pyproject_dir: python/cugraph-nx + extras: + table: build-system + includes: + - python_build_wheel + py_run_cugraph_nx: + output: pyproject + pyproject_dir: python/cugraph-nx + extras: + table: project + includes: + - python_run_cugraph_nx + py_test_cugraph_nx: + output: pyproject + pyproject_dir: python/cugraph-nx + extras: + table: project.optional-dependencies + key: test + includes: + - test_python_common + - test_python_cugraph_nx + + py_build_cugraph_dgl: output: pyproject pyproject_dir: python/cugraph-dgl @@ -340,13 +369,29 @@ dependencies: - output_types: pyproject packages: - &cupy_pip cupy-cuda11x>=12.0.0 - - pylibcugraph==23.10.* + - &pylibcugraph pylibcugraph==23.10.* python_run_pylibcugraph: common: - output_types: [conda, pyproject] packages: - *pylibraft - *rmm + + + python_run_cugraph_nx: + common: + - output_types: [conda, pyproject] + packages: + - networkx>=3.1 + - output_types: conda + packages: + - *cupy + - output_types: pyproject + packages: + - *cupy_pip + - *pylibcugraph + + python_run_cugraph_dgl: common: - output_types: [conda, pyproject] @@ -446,6 +491,12 @@ dependencies: - output_types: [conda, pyproject] packages: - *cudf + test_python_cugraph_nx: + common: + - output_types: [conda, pyproject] + packages: + # required for running networkx tests + - pytest-mpl cugraph_dgl_dev: common: - output_types: [conda] diff --git a/python/cugraph-nx/pyproject.toml b/python/cugraph-nx/pyproject.toml new file mode 100644 index 00000000000..749bb1e1d61 --- /dev/null +++ b/python/cugraph-nx/pyproject.toml @@ -0,0 +1,219 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. + +[build-system] + +requires = [ + "setuptools", + "wheel", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. +build-backend = "setuptools.build_meta" + +[project] +name = "cugraph-nx" +version = "23.10.00" +description = "cugraph backend for NetworkX" +readme = { file = "README.md", content-type = "text/markdown" } +authors = [ + { name = "NVIDIA Corporation" }, +] +license = { text = "Apache 2.0" } +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3 :: Only", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "cupy-cuda11x>=12.0.0", + "networkx>=3.1", + "pylibcugraph==23.10.*", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[project.optional-dependencies] +test = [ + "networkx>=2.5.1", + "numpy>=1.21", + "pandas", + "pytest", + "pytest-benchmark", + "pytest-cov", + "pytest-mpl", + "pytest-xdist", + "scipy", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[project.urls] +Homepage = "https://github.com/rapidsai/cugraph" +Documentation = "https://docs.rapids.ai/api/cugraph/stable/" + +[project.entry-points."networkx.plugins"] +cugraph = "cugraph_nx.interface:BackendInterface" + +[tool.setuptools] +license-files = ["LICENSE"] + +[tool.setuptools.packages.find] +include = [ + "cugraph_nx*", + "cugraph_nx.*", +] + +[tool.black] +line-length = 88 +target-version = ["py39", "py310", "py311"] + +[tool.isort] +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] +profile = "black" +skip_gitignore = true +float_to_top = true +default_section = "THIRDPARTY" +known_first_party = "cugraph_nx" +line_length = 88 + +[tool.pytest.ini_options] +minversion = "6.0" +testpaths = "cugraph_nx/tests" +xfail_strict = true +markers = [ + "slow: Skipped unless --runslow passed", +] +log_cli_level = "info" +filterwarnings = [ + # See: https://docs.python.org/3/library/warnings.html#describing-warning-filters + # and: https://docs.pytest.org/en/7.2.x/how-to/capture-warnings.html#controlling-warnings + # "error", +] +python_files = [ + "bench_*.py", + "test_*.py", +] +python_functions = [ + "bench_*", + "test_*", +] +addopts = [ + "--strict-config", # Force error if config is mispelled + "--strict-markers", # Force error if marker is mispelled (must be defined in config) + # "-ra", # Print summary of all fails/errors + "--benchmark-warmup=off", + "--benchmark-max-time=0", + "--benchmark-min-rounds=3", + "--benchmark-columns=min,median,max", +] + +[tool.coverage.run] +branch = true +source = ["cugraph_nx"] +omit = [] + +[tool.coverage.report] +ignore_errors = false +precision = 1 +fail_under = 0 +skip_covered = true +skip_empty = true +exclude_lines = [ + "pragma: no cover", + "raise AssertionError", + "raise NotImplementedError", +] + +[tool.ruff] +# https://github.com/charliermarsh/ruff/ +line-length = 88 +target-version = "py39" +select = [ + "ALL", +] +external = [ + # noqa codes that ruff doesn't know about: https://github.com/charliermarsh/ruff#external +] +ignore = [ + # Would be nice to fix these + "D100", # Missing docstring in public module + "D101", # Missing docstring in public class + "D102", # Missing docstring in public method + "D103", # Missing docstring in public function + "D104", # Missing docstring in public package + "D105", # Missing docstring in magic method + + # Maybe consider + # "SIM300", # Yoda conditions are discouraged, use ... instead (Note: we're not this picky) + # "SIM401", # Use dict.get ... instead of if-else-block (Note: if-else better for coverage and sometimes clearer) + # "TRY004", # Prefer `TypeError` exception for invalid type (Note: good advice, but not worth the nuisance) + # "TRY200", # Use `raise from` to specify exception cause (Note: sometimes okay to raise original exception) + + # Intentionally ignored + "A003", # Class attribute ... is shadowing a python builtin + "ANN101", # Missing type annotation for `self` in method + "ARG004", # Unused static method argument: `...` + "COM812", # Trailing comma missing + "D203", # 1 blank line required before class docstring (Note: conflicts with D211, which is preferred) + "D400", # First line should end with a period (Note: prefer D415, which also allows "?" and "!") + "F403", # `from .classes import *` used; unable to detect undefined names (Note: used to match networkx) + "N801", # Class name ... should use CapWords convention (Note:we have a few exceptions to this) + "N802", # Function name ... should be lowercase + "N803", # Argument name ... should be lowercase (Maybe okay--except in tests) + "N806", # Variable ... in function should be lowercase + "N807", # Function name should not start and end with `__` + "N818", # Exception name ... should be named with an Error suffix (Note: good advice) + "PLR0911", # Too many return statements + "PLR0912", # Too many branches + "PLR0913", # Too many arguments to function call + "PLR0915", # Too many statements + "PLR2004", # Magic number used in comparison, consider replacing magic with a constant variable + "PLW2901", # Outer for loop variable ... overwritten by inner assignment target (Note: good advice, but too strict) + "RET502", # Do not implicitly `return None` in function able to return non-`None` value + "RET503", # Missing explicit `return` at the end of function able to return non-`None` value + "RET504", # Unnecessary variable assignment before `return` statement + "S110", # `try`-`except`-`pass` detected, consider logging the exception (Note: good advice, but we don't log) + "S112", # `try`-`except`-`continue` detected, consider logging the exception (Note: good advice, but we don't log) + "SIM102", # Use a single `if` statement instead of nested `if` statements (Note: often necessary) + "SIM105", # Use contextlib.suppress(...) instead of try-except-pass (Note: try-except-pass is much faster) + "SIM108", # Use ternary operator ... instead of if-else-block (Note: if-else better for coverage and sometimes clearer) + "TRY003", # Avoid specifying long messages outside the exception class (Note: why?) + + # Ignored categories + "C90", # mccabe (Too strict, but maybe we should make things less complex) + "I", # isort (Should we replace `isort` with this?) + "ANN", # flake8-annotations + "BLE", # flake8-blind-except (Maybe consider) + "FBT", # flake8-boolean-trap (Why?) + "DJ", # flake8-django (We don't use django) + "EM", # flake8-errmsg (Perhaps nicer, but too much work) + # "ICN", # flake8-import-conventions (Doesn't allow "_" prefix such as `_np`) + "PYI", # flake8-pyi (We don't have stub files yet) + "SLF", # flake8-self (We can use our own private variables--sheesh!) + "TID", # flake8-tidy-imports (Rely on isort and our own judgement) + # "TCH", # flake8-type-checking + "ARG", # flake8-unused-arguments (Sometimes helpful, but too strict) + "TD", # flake8-todos (Maybe okay to add some of these) + "FIX", # flake8-fixme (like flake8-todos) + "ERA", # eradicate (We like code in comments!) + "PD", # pandas-vet (Intended for scripts that use pandas, not libraries) +] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] # Allow unused imports (w/o defining `__all__`) +# Allow assert, print, RNG, and no docstring +"cugraph_nx/**/tests/*py" = ["S101", "S311", "T201", "D103", "D100"] + +[tool.ruff.flake8-annotations] +mypy-init-return = true + +[tool.ruff.flake8-builtins] +builtins-ignorelist = ["copyright"] + +[tool.ruff.flake8-pytest-style] +fixture-parentheses = false +mark-parentheses = false + +[tool.ruff.pydocstyle] +convention = "numpy"