Skip to content

ENH: Combine scopes in progress bar#791

Open
basnijholt wants to merge 1 commit intomainfrom
scoped-bar
Open

ENH: Combine scopes in progress bar#791
basnijholt wants to merge 1 commit intomainfrom
scoped-bar

Conversation

@basnijholt
Copy link
Collaborator

@basnijholt basnijholt commented May 28, 2025

@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 94.69027% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pipefunc/_widgets/progress_ipywidgets.py 94.23% 3 Missing ⚠️
pipefunc/_widgets/progress_rich.py 91.17% 3 Missing ⚠️
Files with missing lines Coverage Δ
pipefunc/_widgets/progress_base.py 100.00% <100.00%> (ø)
pipefunc/_widgets/progress_ipywidgets.py 96.27% <94.23%> (-3.73%) ⬇️
pipefunc/_widgets/progress_rich.py 96.87% <91.17%> (-3.13%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented May 28, 2025

CodSpeed Performance Report

Merging #791 will not alter performance

Comparing scoped-bar (f88a4bf) with main (735c0b3)

Summary

✅ 6 untouched benchmarks


from pipefunc._utils import clip
from pipefunc._utils import at_least_tuple, clip
from pipefunc.map._progress import Status

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'Status' may not be defined if module
pipefunc.map._progress
is imported before module
pipefunc._widgets.progress_base
, as the
definition
of Status occurs after the cyclic
import
of pipefunc._widgets.progress_base.
'Status' may not be defined if module
pipefunc.map._progress
is imported before module
pipefunc._widgets.progress_base
, as the
definition
of Status occurs after the cyclic
import
of pipefunc._widgets.progress_base.

Copilot Autofix

AI 8 months ago

To resolve the cyclic import issue, we can break the dependency by deferring the import of Status until it is actually needed. This can be achieved by moving the import of Status inside the relevant method or function where it is used. This approach ensures that the import is resolved at runtime, after all modules have been fully initialized, thereby avoiding the cyclic import problem.

In this case, the Status class is used in type annotations for the progress_dict parameter and the combined_progress method. To fix the issue:

  1. Remove the module-level import of Status on line 11.
  2. Use a string literal for the type annotation of progress_dict and combined_progress to avoid runtime evaluation of the Status type.
  3. If Status is used elsewhere in the code (e.g., for logic or instantiation), import it locally within the relevant method or function.

Suggested changeset 1
pipefunc/_widgets/progress_base.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/pipefunc/_widgets/progress_base.py b/pipefunc/_widgets/progress_base.py
--- a/pipefunc/_widgets/progress_base.py
+++ b/pipefunc/_widgets/progress_base.py
@@ -10,3 +10,2 @@
 from pipefunc._utils import at_least_tuple, clip
-from pipefunc.map._progress import Status
 
@@ -28,3 +27,3 @@
         self,
-        progress_dict: dict[OUTPUT_TYPE, Status],
+        progress_dict: dict[OUTPUT_TYPE, "Status"],
         task: asyncio.Task[Any] | None = None,
@@ -140,3 +139,3 @@
 
-    def combined_progress(self) -> dict[OUTPUT_TYPE, Status]:
+    def combined_progress(self) -> dict[OUTPUT_TYPE, "Status"]:
         """Calculate combined progress for each scope."""
EOF
@@ -10,3 +10,2 @@
from pipefunc._utils import at_least_tuple, clip
from pipefunc.map._progress import Status

@@ -28,3 +27,3 @@
self,
progress_dict: dict[OUTPUT_TYPE, Status],
progress_dict: dict[OUTPUT_TYPE, "Status"],
task: asyncio.Task[Any] | None = None,
@@ -140,3 +139,3 @@

def combined_progress(self) -> dict[OUTPUT_TYPE, Status]:
def combined_progress(self) -> dict[OUTPUT_TYPE, "Status"]:
"""Calculate combined progress for each scope."""
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link
Contributor

✅ PR Title Formatted Correctly

The title of this PR has been updated to match the correct format. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant