From a6a84ebca91d0b0e8f1dabd0fa5f8be08283d82b Mon Sep 17 00:00:00 2001 From: Ralph Liu <137829296+nv-rliu@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:06:27 -0400 Subject: [PATCH] Add Additional Check for `NetworkX` Release Candidate Versions (#4613) Part of https://github.com/rapidsai/graph_dl/issues/579 This PR allows `nx-cugraph` to operate with release candidate (under development) versions of `networkx` What This Pattern Allows: - Just a single digit: `3.4`, `3.9`, etc - Release Candidate format: `3.4rc0`. `3.7rc2` This is needed to complete adding nightly test coverage for development branches of `nx` Authors: - Ralph Liu (https://github.com/nv-rliu) Approvers: - Erik Welch (https://github.com/eriknw) - Rick Ratzel (https://github.com/rlratzel) URL: https://github.com/rapidsai/cugraph/pull/4613 --- python/nx-cugraph/_nx_cugraph/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/nx-cugraph/_nx_cugraph/__init__.py b/python/nx-cugraph/_nx_cugraph/__init__.py index f58a6e2293b..41c18c27ecf 100644 --- a/python/nx-cugraph/_nx_cugraph/__init__.py +++ b/python/nx-cugraph/_nx_cugraph/__init__.py @@ -298,6 +298,7 @@ def get_info(): def _check_networkx_version(): import warnings + import re import networkx as nx @@ -310,7 +311,11 @@ def _check_networkx_version(): UserWarning, stacklevel=2, ) - if len(version_minor) > 1: + + # Allow single-digit minor versions, e.g. 3.4 and release candidates, e.g. 3.4rc0 + pattern = r"^\d(rc\d+)?$" + + if not re.match(pattern, version_minor): raise RuntimeWarning( f"nx-cugraph version {__version__} does not work with networkx version " f"{nx.__version__}. Please upgrade (or fix) your Python environment."