-
Notifications
You must be signed in to change notification settings - Fork 371
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: Move cartopy feature download script into the package #2263
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
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.
In addition to the Why not leaving it also as executable script that is installed with the package, typically named
cartopy_feature_download
? Maybe you must declare amain
function in the__main__
module for that.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.
Yeah, I think you're right, we need to define a function that can be called from the script for that. I moved the content in the if block inside a separate
main()
function like you suggested.Now you can access this script via:
python -m cartopy.feature.download -h
orcartopy_feature_download gshhs physical --dry-run
I guess this just brings up the question of whether this installed script is desired or not. I don't have a major preference either way, but would probably slightly lean towards not including it in the scripts section since it is not a critical piece of cartopy. But, it looks like you @stefraynaud were the one that added this as an installation piece, so maybe it is useful for you as a standalone script? Previously, I think it made sense because it was only accessible via a git clone of the repository to access the tools directory, but now you can execute the module which is installed with the package as well.
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.
Installing these data once for all is useful when used for instance on a computer node that has no internet access.
I had to solve the problem for several people that don't necessarily git clone cartopy.
It is not critical because of
cartopy_offlinedata
conda package but not everyone has their own python installation to add this package.Making it easily accessible as an executable is not difficult once the
main
function is declared. Then we just have to say "executecartopy_feature_download -h
from whereever your are".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.
Agree with the first part on this function being useful without git cloning.
My second part was just suggesting to now tell users from wherever you are type:
python -m cartopy.feature.download -h
But, I'm fine either way with including the install script, so left it in for now.