Make all wrapped tools optional dependencies#51
Open
bjarketol wants to merge 7 commits intoEUFLOW:mainfrom
Open
Make all wrapped tools optional dependencies#51bjarketol wants to merge 7 commits intoEUFLOW:mainfrom
bjarketol wants to merge 7 commits intoEUFLOW:mainfrom
Conversation
Move pywake, floris, foxes, wayve, and code_saturne from hard dependencies to optional extras in pyproject.toml. Users can now install only the tools they need: `pip install wifa[pywake]`, `pip install wifa[foxes]`, etc., or all at once with `wifa[all]`. - Add `wifa/_optional.py` with `require()` helper that gives clear install instructions when an optional tool is missing - Add `require()` checks at the top of each `run_*` function - Add `pytest.importorskip()` to test modules so tests skip cleanly when a tool is not installed - Move matplotlib and mpmath to lazy imports in wayve_api.py - Move FoxesWakeModel import into the foxes branch of wake_model_setup() - Add scipy and pyyaml as core dependencies (used at module level) - Add missing run_floris export in __init__.py Closes EUFLOW#50 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
np.trapz was removed in numpy 2.0. Use np.trapezoid with fallback for older numpy versions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
floris uses PEP 604 union types (str | Path) which require Python 3.10+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Also update wayve URL to main branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pip install wifa[pywake],wifa[all], etc.)wifa/_optional.pywith arequire()helper that raises clearImportErrormessages with install instructions when a tool is missingpytest.importorskip()to each tool's test module so tests skip cleanly when the tool is not installedDetails
All API modules already used lazy imports (tool packages imported inside function bodies), so
import wifaworks without any tools installed. This PR formalizes that by:pyproject.toml: Tools moved to[project.optional-dependencies]groups.scipyandpyyamladded as core deps (used at module level by API modules).mpmathmoved to thewayveextra.wifa/_optional.py(new): Centralrequire(package, extra)utility usingimportlib.util.find_spec().run_*()function callsrequire()at its top, giving actionable error messages before any tool import runs.wifa/wayve_api.py:matplotlibandmpmathmoved to lazy imports inside the functions that use them.FoxesWakeModelimport moved into thefoxesbranch ofwake_model_setup().pytest.importorskip()added before tool imports so entire test modules skip when the tool is absent.wifa/__init__.py: Added missingrun_florisexport.Verified
pip install wifa):import wifasucceeds; calling anyrun_*gives a clear error with install instructionspip install wifa[pywake]): pywake tests pass, other tools' tests skippip install wifa[all]): all tests pass as beforeCloses #50
Test plan
pip install wifa(bare) — verifyimport wifaworks,run_pywake()etc. raise clearImportErrorpip install wifa[pywake]— verify pywake tests pass, other tests skippip install wifa[all]— verify all tests pass🤖 Generated with Claude Code