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

Update check_satpy to use new show_version to display package versions #2913

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

verduijn
Copy link
Contributor

MR to add show_versions to satpy.utils to allow for use in satpy.utils.check_satpy.
Use case is to help in figuring out run-time environment factors while debugging issues.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how I feel about these changes and I haven't felt great about the discussion since it was restarted in the related issue. This may mean that I'm just missing something from the feature request, but overall it feels like a lot of flexibility is being added and things changed for something that I consider rather static and single-use.

  1. Why does show_versions need to have a packages keyword argument? In my opinion (others can feel free to disagree) this should just be a hardcoded list. This function is for us, the maintainers, not for users. Users run it to tell us what we need to know.
  2. Why should check_satpy call show_versions? It feels like they should be separate. There are times when duplicated code is acceptable and if these changes were done to reduce duplication I'm not sure it is worth it.
  3. Why did extras need to be renamed?

It seems like both check_satpy and show_versions were implemented/re-implemented to be even more flexible and to be a generic "check this import for me" and I'm just not sure that task is complicated enough that Satpy needs to be providing a generic utility for users to use. What I tried to say above is that I think of these types of functions as tools to assist maintainers in helping users, not as generic tools for the user.

@verduijn
Copy link
Contributor Author

Thanks for the feedback!

I figured that check_satpy was in the default issue template, so it could be useful to have the versions information in there.

From there:

  • I thought i could expose the show_versions functionality itself without much downside
  • check_satpy was flexible with extras so I just did the same
  • since extras and packages was essentially the same I just renamed it

rounding up I think we should either:

  • remove show_versions and add it, with hardcoded packages, in check_satpy
  • Having a hard coded show_versions function and reverting the check_satpy function if it's not desirable to add the versions in check_satpy.

@djhoese
Copy link
Member

djhoese commented Sep 27, 2024

Good point with it being in the issue template. We wouldn't want users to have to run multiple things to show similar information. In that case I agree that the versions after the readers/writers in check_satpy does make more sense than the "ok" that is there now. Ok I'm coming around. Thanks for explaining your reasoning.

satpy/utils.py Outdated
try:
return importlib.metadata.version(package_name)
except importlib.metadata.PackageNotFoundError:
return None

def _check_import(module_names):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to tell from github's diff display, but is this function used anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point! I've removed the now unused _check_imports.

@verduijn verduijn marked this pull request as ready for review October 5, 2024 05:55
@verduijn
Copy link
Contributor Author

verduijn commented Oct 5, 2024

I guess it's ready for review?

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.05%. Comparing base (9e3b342) to head (692c9b1).
Report is 79 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2913      +/-   ##
==========================================
- Coverage   96.06%   96.05%   -0.01%     
==========================================
  Files         373      373              
  Lines       54465    54479      +14     
==========================================
+ Hits        52321    52330       +9     
- Misses       2144     2149       +5     
Flag Coverage Δ
behaviourtests 3.99% <11.90%> (+<0.01%) ⬆️
unittests 96.15% <100.00%> (-0.01%) ⬇️

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.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a basic inspection, these changes seem good to me. I'd like some other reviews though. (@mraspaud @pnuu @sfinkens maybe?)

@coveralls
Copy link

coveralls commented Oct 7, 2024

Pull Request Test Coverage Report for Build 11236933264

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 42 of 42 (100.0%) changed or added relevant lines in 2 files are covered.
  • 14 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.01%) to 96.151%

Files with Coverage Reduction New Missed Lines %
satpy/composites/config_loader.py 2 94.12%
satpy/tests/utils.py 2 93.16%
satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py 3 98.67%
satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py 3 97.18%
satpy/readers/msi_safe.py 4 98.41%
Totals Coverage Status
Change from base Build 10957325874: -0.01%
Covered Lines: 52564
Relevant Lines: 54668

💛 - Coveralls

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just couple of styling issues that I think linter should have caught.

satpy/tests/test_utils.py Show resolved Hide resolved
satpy/utils.py Show resolved Hide resolved
Copy link
Member

@sfinkens sfinkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks! I have one wish for the tests.

@djhoese djhoese changed the title Issue 1974: check_satpy Update check_satpy to use new show_version to display package versions Oct 8, 2024
satpy/tests/test_utils.py Show resolved Hide resolved
@mraspaud mraspaud added the enhancement code enhancements, features, improvements label Oct 9, 2024
@mraspaud mraspaud merged commit 37097b2 into pytroll:main Oct 9, 2024
17 of 18 checks passed
@verduijn verduijn deleted the issue-1974 branch October 9, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants