From 5ce589d3605ef4d3ced1f8e6d8af9111e48dfb70 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Thu, 14 Mar 2024 13:04:32 -0500 Subject: [PATCH 1/3] Adds packaging to dep list for nx-cugraph pre-commit hooks. --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 542e9cacb77..bb0fff1a6d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,7 +72,7 @@ repos: types: [python] language: python pass_filenames: false - additional_dependencies: ["networkx>=3.2"] + additional_dependencies: ["networkx>=3.2", "packaging>=21"] - repo: local hooks: - id: nx-cugraph-readme-update @@ -82,4 +82,4 @@ repos: types_or: [python, markdown] language: python pass_filenames: false - additional_dependencies: ["networkx>=3.2"] + additional_dependencies: ["networkx>=3.2", "packaging>=21"] From 880014e9c01861c005eedc0e6a9abe47c839ea6a Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Thu, 14 Mar 2024 13:41:02 -0500 Subject: [PATCH 2/3] Reverts changes to pre-commit.yaml in favor of just breaking the (unintentional?) new runtime dependency on packaging. --- .pre-commit-config.yaml | 4 ++-- python/nx-cugraph/_nx_cugraph/__init__.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb0fff1a6d8..542e9cacb77 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,7 +72,7 @@ repos: types: [python] language: python pass_filenames: false - additional_dependencies: ["networkx>=3.2", "packaging>=21"] + additional_dependencies: ["networkx>=3.2"] - repo: local hooks: - id: nx-cugraph-readme-update @@ -82,4 +82,4 @@ repos: types_or: [python, markdown] language: python pass_filenames: false - additional_dependencies: ["networkx>=3.2", "packaging>=21"] + additional_dependencies: ["networkx>=3.2"] diff --git a/python/nx-cugraph/_nx_cugraph/__init__.py b/python/nx-cugraph/_nx_cugraph/__init__.py index f6e5e3aa570..5faab61cacf 100644 --- a/python/nx-cugraph/_nx_cugraph/__init__.py +++ b/python/nx-cugraph/_nx_cugraph/__init__.py @@ -23,18 +23,19 @@ $ python _nx_cugraph/__init__.py """ -from packaging.version import Version - from _nx_cugraph._version import __version__ -_nx_cugraph_version = Version(__version__) +# This is normally handled by packaging.version.Version, but instead of adding +# an additional runtime dependency on "packaging", assume __version__ will +# always be in .. format. +(_version_major, _version_minor) = __version__.split(".")[:2] # Entries between BEGIN and END are automatically generated _info = { "backend_name": "cugraph", "project": "nx-cugraph", "package": "nx_cugraph", - "url": f"https://github.com/rapidsai/cugraph/tree/branch-{_nx_cugraph_version.major:02}.{_nx_cugraph_version.minor:02}/python/nx-cugraph", + "url": f"https://github.com/rapidsai/cugraph/tree/branch-{_version_major:02}.{_version_minor:02}/python/nx-cugraph", "short_summary": "GPU-accelerated backend.", # "description": "TODO", "functions": { From fac94fec5b9a1f828796f11453ba4d54e8b728bf Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Thu, 14 Mar 2024 23:42:37 -0500 Subject: [PATCH 3/3] Fix formatting for Python 3.9 --- python/nx-cugraph/_nx_cugraph/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/nx-cugraph/_nx_cugraph/__init__.py b/python/nx-cugraph/_nx_cugraph/__init__.py index 5faab61cacf..098de46af8e 100644 --- a/python/nx-cugraph/_nx_cugraph/__init__.py +++ b/python/nx-cugraph/_nx_cugraph/__init__.py @@ -35,7 +35,7 @@ "backend_name": "cugraph", "project": "nx-cugraph", "package": "nx_cugraph", - "url": f"https://github.com/rapidsai/cugraph/tree/branch-{_version_major:02}.{_version_minor:02}/python/nx-cugraph", + "url": f"https://github.com/rapidsai/cugraph/tree/branch-{_version_major:0>2}.{_version_minor:0>2}/python/nx-cugraph", "short_summary": "GPU-accelerated backend.", # "description": "TODO", "functions": {