Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNT] isolate matplotlib as soft dependency #1636

Merged
merged 18 commits into from
Sep 4, 2024
Merged

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Aug 30, 2024

Isolates matplotlib as soft dependency in a new soft dep set all_extras. #1616

The imports happen in plot_sth methods throughout the code base, some attached to classes, some not.
This allows to use pytorch-forecasting without plotting or graphical logging, or use a different plotting backend manually.

Isolation strategy:

  • where the purpose of the function is creating a plot or nothing else, absence of matplotlib raises an exception
  • where matplotlib is additional or part of the logic, absence of matplotlib causes the specific parts to be skipped. Example: log_gradient_flow - this is crucial, as raising an exception would prevent the models from running.

@fkiraly fkiraly added the maintenance Continuous integration, unit testing & package distribution label Aug 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 80.48780% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.10%. Comparing base (6061af6) to head (20f606d).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pytorch_forecasting/data/timeseries.py 50.00% 2 Missing ⚠️
pytorch_forecasting/models/base_model.py 83.33% 2 Missing ⚠️
pytorch_forecasting/models/nbeats/__init__.py 83.33% 1 Missing ⚠️
pytorch_forecasting/models/nhits/__init__.py 83.33% 1 Missing ⚠️
...ing/models/temporal_fusion_transformer/__init__.py 87.50% 1 Missing ⚠️
pytorch_forecasting/utils/_dependencies.py 80.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1636      +/-   ##
==========================================
- Coverage   90.19%   90.10%   -0.10%     
==========================================
  Files          32       32              
  Lines        4734     4768      +34     
==========================================
+ Hits         4270     4296      +26     
- Misses        464      472       +8     
Flag Coverage Δ
cpu 90.10% <80.48%> (-0.10%) ⬇️
pytest 90.10% <80.48%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@fkiraly fkiraly added the dependencies Pull requests that update a dependency file label Aug 31, 2024
@fkiraly fkiraly merged commit 95fa06c into master Sep 4, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file maintenance Continuous integration, unit testing & package distribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants