Skip to content

fix: lazy-import panel in ccflow.utils.hydra#187

Merged
timkpaine merged 1 commit intomainfrom
fix/lazy-panel-import
Apr 9, 2026
Merged

fix: lazy-import panel in ccflow.utils.hydra#187
timkpaine merged 1 commit intomainfrom
fix/lazy-panel-import

Conversation

@ptomecek
Copy link
Copy Markdown
Collaborator

@ptomecek ptomecek commented Apr 9, 2026

Problem

ccflow/utils/hydra.py imports panel as pn at module level, which impacts import time for anything using the ccflow hydra tools — even when the panel UI functionality is never used.

Solution

Move import panel as pn from the top-level try/except block into ui_launcher_default(), the only function that uses it. This follows the same lazy-import pattern already used in ccflow/base.py.

Changes

  • Removed top-level try: import panel as pn / except ImportError: pn = None
  • Added local import panel as pn inside ui_launcher_default() with ImportError handling
  • Updated cfg_explain_cli() to use try/except ImportError around ui_launcher_default() instead of the old pn is not None check

Testing

  • All 653 tests pass (2 skipped)
  • Verified import ccflow.utils.hydra no longer triggers a panel import

Move 'import panel as pn' from module-level to ui_launcher_default()
to avoid impacting import time for all hydra tool users.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Pascal Tomecek <pascal.tomecek@cubistsystematic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Test Results

637 tests  ±0   635 ✅ ±0   1m 43s ⏱️ -1s
  1 suites ±0     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 89613a2. ± Comparison against base commit 6a0247c.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.94%. Comparing base (459ac14) to head (89613a2).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
ccflow/utils/hydra.py 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   95.85%   95.94%   +0.09%     
==========================================
  Files         140      140              
  Lines        9580     9645      +65     
  Branches      551      562      +11     
==========================================
+ Hits         9183     9254      +71     
+ Misses        278      273       -5     
+ Partials      119      118       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timkpaine timkpaine merged commit 1989d33 into main Apr 9, 2026
11 of 12 checks passed
@timkpaine timkpaine deleted the fix/lazy-panel-import branch April 9, 2026 22:11
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.

2 participants