From 71449283008282858f2a67b683cf6d052f4fbadc Mon Sep 17 00:00:00 2001 From: Mikolaj Kowalik Date: Wed, 3 Dec 2025 16:42:38 -0500 Subject: [PATCH 1/3] Provide custom __new__ for GenericWorkflow class Starting from ver. 3.6 of NetworkX, the DiGraph class defines its custom __new__ method that explicitly defines arguments it accepts. As a result, we need to override it to let our subclass use different ones. --- python/lsst/ctrl/bps/generic_workflow.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/lsst/ctrl/bps/generic_workflow.py b/python/lsst/ctrl/bps/generic_workflow.py index 3e817a96..f5aedd31 100644 --- a/python/lsst/ctrl/bps/generic_workflow.py +++ b/python/lsst/ctrl/bps/generic_workflow.py @@ -332,6 +332,18 @@ def __init__(self, name: str, incoming_graph_data: Any | None = None, **attr: An self.run_id = None self._final: GenericWorkflowJob | GenericWorkflow | None = None + # Starting from ver. 3.6 of NetworkX, the DiGraph class defines its custom + # __new__ method that explicitly defines arguments it accepts. As a result, + # we need to override it to let our subclass use different ones. + # + # Notes + # ----- + # Most likely overriding __new__ in this manner will prevent us from using + # different graph backends with our subclass. However, since we are not + # using any backends, this should not be a problem at the moment. + def __new__(cls, *args, **kwargs) -> "GenericWorkflow": + return object.__new__(cls) + @property def name(self) -> str: """Retrieve name of generic workflow. From dfbb8f2995efeac05c72717ca17a6fb6d56b4a89 Mon Sep 17 00:00:00 2001 From: Mikolaj Kowalik Date: Wed, 3 Dec 2025 16:47:08 -0500 Subject: [PATCH 2/3] Describe changes in the news item --- doc/changes/DM-53492.other.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/DM-53492.other.rst diff --git a/doc/changes/DM-53492.other.rst b/doc/changes/DM-53492.other.rst new file mode 100644 index 00000000..a71d6551 --- /dev/null +++ b/doc/changes/DM-53492.other.rst @@ -0,0 +1 @@ +Added a custom __new__ method to the GenericWorkflow class so **ctrl_bps** can work when using NetworkX 3.6. From a36449c7ee115587c5c115a5187d7d28a9124f75 Mon Sep 17 00:00:00 2001 From: Mikolaj Kowalik Date: Wed, 3 Dec 2025 16:51:00 -0500 Subject: [PATCH 3/3] Remove NetworkX version restriction Removed version restrictions from project files. --- pyproject.toml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7282882..8108e9fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ "astropy >=4.0", "pyyaml >=5.1", "click >= 7.0", - "networkx <3.6", + "networkx", "lsst-daf-butler", "lsst-pipe-base", "lsst-ctrl-mpexec", diff --git a/requirements.txt b/requirements.txt index ace78d33..b8a2848c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ click astropy -networkx <3.6 +networkx pyyaml lsst-daf-butler @ git+https://github.com/lsst/daf_butler@main lsst-utils @ git+https://github.com/lsst/utils@main