-
Notifications
You must be signed in to change notification settings - Fork 259
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
lazy import via mintpy.cli
for more responsive CLI
#828
Conversation
1213221
to
b664bf3
Compare
f3e53db
to
86a63a2
Compare
Thank you @avalentino for the useful and large PR! A quick test shows that the [Updated] I am currently occupied with the preparation of the UNAVCO ISCE+ short course and NISAR workshop, will look at this PR more carefully after that (sorry for the delay). |
063991f
to
c667d4b
Compare
mintpy.cli
sub-package for more responsive CLI
mintpy.cli
sub-package for more responsive CLImintpy.cli
for more responsive CLI
14ad18a
to
8ddc101
Compare
+ expand the lazy imports to all scripts in command lines + cmd_line_parse() content arrangement: - parse - import - check - default values + main() content arrangement: - parse args - import - run
+ docs/installation.md: update the instruction to install mintpy via path setup + adjust to make path setup method working on cmd: - add `#!/usr/bin/env python3` to the top of all cli/[a-z]*.py scripts - run `chmod +x` to all `cli/[a-z]*.py` scripts - run `chmod -x` to all `mintpy/[a-z]*.py` scripts, except for two (add_attribute.py and multi_transect.py).
+ setup: - remove gmtsar as it's included in extra - remove gps, as both proj and dateutil are not used anymore - add notes for geoid and isce
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.
Thank you @avalentino for the PR and @jhkennedy for the review! I really like the changes here. All the command line helps are now significantly speeded up, which improves the user experience a lot. Cheers!
Update: I will wait for another 12 hours to merge the PR, in case you have any further suggestions, since I modified the PR significantly.
@yunjunz there is a small issue. from mintpy.objects.sensor import SENSOR_NAMES that triggers the import of numpy and h5py in You chan check it using the following command:
My original solution was to have a local copy of the |
Thank you for the
Update: rethinking about this makes me realize that making a copy as you did before was a pretty good solution! Shall we revert back to that? |
Probably it is the easiest solution. |
SENSOR_NAMES is now duplicated in mintpy.cli.prep_gamma
OK, @yunjunz |
Thanks @yunjunz |
Thank you @avalentino for the PR! |
+ workflow/__init__.py: fix the UnboundLocalError of 'mintpy' + smallbaselineApp: bring back the individual module import (as proposed in the lazy import PR insarlab#828), to replace the workflow import, for better speed and robustness.
+ workflow/__init__.py: fix the UnboundLocalError of 'mintpy' + smallbaselineApp: bring back the individual module import (as proposed in the lazy import PR insarlab#828), to replace the workflow import, for better speed and robustness.
+ workflow/__init__.py: fix the UnboundLocalError of 'mintpy' + smallbaselineApp: bring back the individual module import (as proposed in the lazy import PR insarlab#828), to replace the workflow import, for better speed and robustness.
+ `smallbaselineApp`: bring back the individual module import (as proposed in the lazy import PR #828), to replace the workflow import, for better speed and robustness. + `workflow/__init__.py`: fix the UnboundLocalError of 'mintpy' + `info`: support `--compact` output to `--date / --num` options + general Codacy style suggestions
Description of proposed changes
The CLI stuff is move to dedicated modules in the
mintpy.cli
sub-package.In this way it is possible to define the single-entry point argument parser without importing all the processing modules.
Processing modules are imported only when necessary depending on the selected sub-command.
See also #823 (comment).
Reminders