feat: introduce optional dependency groups to reduce core footprint (…#150
Open
gyanranjanpanda wants to merge 1 commit into52North:mainfrom
Open
feat: introduce optional dependency groups to reduce core footprint (…#150gyanranjanpanda wants to merge 1 commit into52North:mainfrom
gyanranjanpanda wants to merge 1 commit into52North:mainfrom
Conversation
…ixes 52North#131) - Add [project.optional-dependencies] in pyproject.toml with groups: geo (cartopy, geopandas, shapely, global_land_mask), vis (matplotlib, seaborn), data (dask, datacube, netcdf4, scikit-image), and all (combines all groups) - Strip non-core libraries from requirements.txt (now only core dependencies) - Update requirements.test.txt to install [all] extras for CI - Lazy-load optional imports (cartopy, matplotlib, geopandas, shapely, datacube, xarray, dask) inside the specific methods that use them across weather.py, constraints/constraints.py, utils/graphics.py, algorithms/genetic/__init__.py and algorithms/genetic/mutation.py - Remove unused top-level and local-scope imports flagged by flake8 (F401) - Remove dead local variable assignment str_tree = None (F841) - Rename duplicate LandPolygonsCrossing(ContinuousCheck) to LandPolygonsDBCrossing to resolve redefinition (F811) - Fix matplotlib import in routingalg.py needed for class attribute annotation - Fix WaterDepth.depth_data type annotation: replace xr -> object to avoid requiring xarray at module import time - Update README.md with minimal and optional installation instructions - Fix test_genetic.py: remove plt fixture argument, remove LaTeX math syntax from colorbar labels (latex not always available in CI)
Author
|
hi @kdemmich |
Author
|
hi @MartinPontius could u review this |
Author
|
hi @kdemmich could u review this |
Collaborator
|
Hi @gyanranjanpanda, thank you for your PR. We appreciate the time and effort that was put into it but, unfortunately, you did only copy and not fill our PR template. We will not evaluate PRs without a filled PR template. |
Author
|
Hi @kdemmich, apologies for the oversight and thank you for the feedback! I've now updated the PR description with the properly filled template including the related issue, detailed list of changes, summary with before/after comparison, dependencies section, and the completed PR checklist. Please let me know if anything else needs to be addressed. |
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.
Related Issue / Discussion:
Fixes Issue #131
Changes:
pyproject.toml- added[project.optional-dependencies]with four groups:geo,vis,data,allrequirements.txt- stripped to core-only libraries (numpy, pydantic, geovectorslib, astropy, xarray, pandas)requirements.test.txt- uses.[all]for CI to install all optional extrasREADME.md- added documentation for optional installation pathsWeatherRoutingTool/weather.py- lazy-load optional imports (xarray, dask)WeatherRoutingTool/constraints/constraints.py- lazy-load cartopy, geopandas, shapely, global_land_mask; renamed duplicateLandPolygonsCrossing(ContinuousCheck)toLandPolygonsDBCrossingWeatherRoutingTool/utils/graphics.py- lazy-load matplotlib, cartopy inside functionsWeatherRoutingTool/routeparams.py- lazy-load cartopy inplot_route(); fixed WaterDepth type annotationWeatherRoutingTool/algorithms/genetic/__init__.py- lazy-load matplotlibWeatherRoutingTool/algorithms/genetic/mutation.py- lazy-load matplotlibWeatherRoutingTool/algorithms/genetic/repair.py- minor import cleanupWeatherRoutingTool/ship/direct_power_boat.py- removed unused importstests/test_genetic.py- removed plt fixture; removed LaTeX math syntax from colorbar labelstests/basic_test_func.py- updated test utility importsFurther Details:
Summary:
This PR addresses Issue #131 by introducing optional dependency groups to reduce the core installation footprint of WRT.
Before:
pip install .pulled in all libraries including heavy geospatial (cartopy, geopandas), visualisation (matplotlib, seaborn), and data-fetching (dask, datacube) packages - even if users only needed the core routing computation.After:
pip install .installs only the minimal core dependencies (numpy, pydantic, geovectorslib, astropy, xarray, pandas). Users can opt in to additional functionality:pip install .[vis]- matplotlib, seaborn for visualisationspip install .[geo]- cartopy, geopandas, shapely, global_land_mask for GIS featurespip install .[data]- dask, datacube, netcdf4, scikit-image for large-scale datapip install .[all]- everything combinedAll optional imports are now lazy-loaded inside the functions that use them, so the core module can be imported without any optional dependency installed. Unused imports and dead code flagged by flake8 were also removed.
Dependencies:
No new dependencies introduced. Existing dependencies are reorganised into optional groups. Core dependencies remain: numpy, pydantic, geovectorslib, astropy, xarray, pandas.
PR Checklist:
In the context of this PR, I: