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
Warn user when importing submodule without the submodules dependencies #7369
Warn user when importing submodule without the submodules dependencies #7369
Conversation
How do we feel about at least a backport to 5.1? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc build is failing. At a guess it might be because one of the sub-modules you've imported warn_missing_deps
into is missing an __all__
, so is trying to document warn_missing_deps
?
tweak warning msg prevent warning on no errors
swapped to warn user capitilsation of comments, block warn function from export
ba7e368
to
09ff600
Compare
I made the _warn function private which solves import issues, and should have been done in the first place regardless. |
I don't think it is particularly bugfixxy but I don't really care if you want to backport it. |
While its not a bugfix, I feel like its a useful fix that helps anyone who installs sunpy now. |
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
sunpy/util/sysinfo.py
Outdated
if missing_deps: | ||
warn_user(f"Importing sunpy.{extras} without its extra dependencies may result in errors.\n" | ||
f"The following packages are not installed:\n{missing_deps}\n" | ||
f"To install sunpy with these dependencies use `install sunpy[{extras}]`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"To install sunpy with these dependencies use `install sunpy[{extras}]`" | |
f"To install sunpy with these dependencies use `pip install sunpy[{extras}]` " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having just install sunpy[blah]
in the warning is confusing - if something is within backticks I would expect it to be a complete command I can copy/paste. So I think this should be pip install sunpy[...]
, and there should also be a note that if installed from conda this is a bug that should be reported (because conda install sunpy should install all the extras)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if installed from conda this is a bug that should be reported
It is potentially a bug; a user could have broken their conda environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a line below this, see if either of you like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, hadn't gotten round to making changes, I had originally written it this way to avoid the conda/pip issue. But I am happy if it has the extra context about conda.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
…e submodules dependencies
…e submodules dependencies
…-on-5.0 Backport PR #7369 on branch 5.0 (Warn user when importing submodule without the submodules dependencies)
…-on-5.1 Backport PR #7369 on branch 5.1 (Warn user when importing submodule without the submodules dependencies)
For what it's worth, I don't think this PR should have been backported. It broke the DKIST CI for a start. |
…module without the submodules dependencies)"
…module without the submodules dependencies)"
…369-on-5.1 Revert "Backport PR #7369 on branch 5.1 (Warn user when importing submodule without the submodules dependencies)"
…369-on-5.0 Revert "Backport PR #7369 on branch 5.0 (Warn user when importing submodule without the submodules dependencies)"
Adds a warning when user imports a submodule without having all the deps defined in that submodules extras.
Closes #7333