Skip to content

Add generic try_import helper and adopt it for optional deps#1926

Open
ghostiee-11 wants to merge 1 commit into
holoviz:mainfrom
ghostiee-11:feat/try-import-helper
Open

Add generic try_import helper and adopt it for optional deps#1926
ghostiee-11 wants to merge 1 commit into
holoviz:mainfrom
ghostiee-11:feat/try-import-helper

Conversation

@ghostiee-11

@ghostiee-11 ghostiee-11 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Adds a single generic try_import(module_name, load=True) and adopts it across the optional-dependency helpers, so we do not grow a separate try_import_<dep> per PR. load=False returns the module only if it is already imported (a cheap hot-path check that never triggers an import); load=True imports on demand. The repeated geopandas test guard is also consolidated into a shared lumen/tests/utils.py.

@ghostiee-11
ghostiee-11 force-pushed the feat/try-import-helper branch from 2663e31 to ed0d1e4 Compare July 17, 2026 19:30
@ghostiee-11 ghostiee-11 changed the title Add generic try_import(module_name, load=True) helper Add generic try_import helper and adopt it for optional deps Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.75510% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.22%. Comparing base (59695a6) to head (ed0d1e4).

Files with missing lines Patch % Lines
lumen/tests/test_pipeline.py 50.00% 2 Missing ⚠️
lumen/sources/duckdb.py 50.00% 1 Missing ⚠️
lumen/tests/sources/test_optional_imports.py 92.30% 1 Missing ⚠️
lumen/tests/utils.py 87.50% 1 Missing ⚠️
lumen/util.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1926      +/-   ##
==========================================
- Coverage   71.22%   71.22%   -0.01%     
==========================================
  Files         198      199       +1     
  Lines       34645    34639       -6     
==========================================
- Hits        24677    24671       -6     
  Misses       9968     9968              

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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