From e0f204ff48e6097812794cc20fa29c725fa04ad5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 04:43:41 +0000 Subject: [PATCH 1/2] Bump types-networkx from 3.6.1.20260210 to 3.6.1.20260303 Bumps [types-networkx](https://github.com/typeshed-internal/stub_uploader) from 3.6.1.20260210 to 3.6.1.20260303. - [Commits](https://github.com/typeshed-internal/stub_uploader/commits) --- updated-dependencies: - dependency-name: types-networkx dependency-version: 3.6.1.20260303 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8ab10d83db6..83529d44147 100644 --- a/requirements.txt +++ b/requirements.txt @@ -453,7 +453,7 @@ traitlets==5.14.3 # nbsphinx types-jsonschema==4.26.0.20260202 # via qcodes (pyproject.toml) -types-networkx==3.6.1.20260210 +types-networkx==3.6.1.20260303 # via qcodes (pyproject.toml) types-pytz==2025.2.0.20251108 # via pandas-stubs From 4934f1e86d6235bc53d7595a4b2011b23102547b Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 3 Mar 2026 07:23:38 +0100 Subject: [PATCH 2/2] fix type checking with latest networkx --- pyproject.toml | 2 +- src/qcodes/dataset/descriptions/dependencies.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fcd9474fda6..87ac9c3cf7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ test = [ "PyVisa-sim>=0.6.0", "sphinx>=4.5.0", # sphinx extension tests "types-jsonschema>=4.16.0", - "types-networkx >= 3.1", # Version should match the networkx requirment + "types-networkx >= 3.6.1.20260303", # minimum version required for correct edge_subgraph types "types_requests>=0.1.8", "types-tabulate>=0.1.0", "types-tqdm>=4.64.6", diff --git a/src/qcodes/dataset/descriptions/dependencies.py b/src/qcodes/dataset/descriptions/dependencies.py index 5d23129520f..4fa4e635ff4 100644 --- a/src/qcodes/dataset/descriptions/dependencies.py +++ b/src/qcodes/dataset/descriptions/dependencies.py @@ -10,7 +10,7 @@ from collections import defaultdict from copy import deepcopy from itertools import chain, product -from typing import TYPE_CHECKING, Any, Literal, cast +from typing import TYPE_CHECKING, Any, Literal import networkx as nx from typing_extensions import deprecated @@ -150,9 +150,7 @@ def _dependency_subgraph(self) -> nx.DiGraph[str]: for edge in self.graph.edges if self.graph.edges[edge]["interdep_type"] == "depends_on" ] - # the type annotations does not currently encode that edge_subgraph of a DiGraph - # is a DiGraph - return cast("nx.DiGraph[str]", self.graph.edge_subgraph(depends_on_edges)) + return self.graph.edge_subgraph(depends_on_edges) @property def _inference_subgraph(self) -> nx.DiGraph[str]: @@ -161,9 +159,7 @@ def _inference_subgraph(self) -> nx.DiGraph[str]: for edge in self.graph.edges if self.graph.edges[edge]["interdep_type"] == "inferred_from" ] - # the type annotations does not currently encode that edge_subgraph of a DiGraph - # is a DiGraph - return cast("nx.DiGraph[str]", self.graph.edge_subgraph(inferred_from_edges)) + return self.graph.edge_subgraph(inferred_from_edges) def extend( self,