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

dep/doc: add tab completion via argcomplete #1065

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

yunjunz
Copy link
Member

@yunjunz yunjunz commented Aug 8, 2023

Description of proposed changes

  • add argcomplete to the dependency for tab completion capability, which is implemented in Single entrypoint with sub-commands #823 and described in Suggestions for MintPy #1041. This package is light (only depends on pure Python), and available on pip and conda-forge (as noarch package).

    • requirements.txt: add argcomplete
    • setup.py: move argcomplete from optional to required
  • docs/installation.md: add "tab complete sub-commands" as another sub-section in Post-Installation Setup.

Reminders

  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • If adding new functionality, add a detailed description to the documentation and/or an example.

+ add `argcomplete` to the dependency for tab completion capability. This package is light (only depends on pure Python), and available on pip and conda-forge (as noarch package).
   - requirements.txt: add argcomplete
   - setup.py: move argcomplete from optional to required

+ docs/installation.md: add "tab complete sub-commands" as another sub-section in Post-Installation Setup.
Copy link
Member

@avalentino avalentino left a comment

Choose a reason for hiding this comment

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

The changes are good to me.
Probably you may want to point out that, on Mac OSX, argcomplete >= 3.0 works perfectly on the default shell zsh. In that case no workaround is needed.

@falkamelung
Copy link
Contributor

I was surprised that you can call mintpy functions using mintpy although there is no script/file called mintpy. Some explanation of why this works could be helpful.

@scottstanie
Copy link
Contributor

I was surprised that you can call mintpy functions using mintpy although there is no script/file called mintpy. Some explanation of why this works could be helpful.

These come from the Mintpy entry points, which is the typical way a python package can make a command line tool available when you pip install the package (without messing with any $PYTHONPATH or $PATH environment variables). https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts gives a minimal example to see how that works

@yunjunz
Copy link
Member Author

yunjunz commented Aug 9, 2023

I was surprised that you can call mintpy functions using mintpy although there is no script/file called mintpy. Some explanation of why this works could be helpful.

This nice feature was introduced in version 1.5.0 by @avalentino. It's very similar to the latest GMT. I have not advertised it heavily yet, as it may be confusing to users who are used to the view.py style.

@yunjunz yunjunz merged commit 23b87d9 into insarlab:main Aug 9, 2023
@yunjunz yunjunz deleted the argcomplete branch August 9, 2023 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants