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. 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/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. 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