-
Notifications
You must be signed in to change notification settings - Fork 223
New wrapped CLI using click
#4961
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
Open
Crivella
wants to merge
40
commits into
easybuilders:develop
Choose a base branch
from
Crivella:feature-click_cli
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
4c8a6e8
WIP test click CI wrapper
Crivella 0ff09eb
Install as a console script
Crivella 60229a0
Avoid warning of double arg initialization if `prepare_main` did not …
Crivella b6990fc
Move to static method
Crivella 08b0365
Added list paramter conversion and better autocomplete
Crivella eb7af72
Removed comments
Crivella 12dfbf6
Fix potential missing attribute
Crivella 5109e31
Added autocompletion for EC files
Crivella f3972f8
Better checks for default values
Crivella 530db73
- Fixed behavior of bool --X/--disable-X
Crivella b42d59a
Do not resolve full path to avoid `:` in `robot-paths` being improper…
Crivella 8f6e863
Ensure that if `click` is not present a nicer message is shown
Crivella 9385b52
Use pathsep as delimiter for paths and allow empty initial path in au…
Crivella 50ba676
Passthrough the arguments from the CLI to optparse instead of rebuild…
Crivella 75fbc67
Improve autocomplete
Crivella a015eaa
Improve `help` metadata
Crivella d2dd8b2
Lint and better comments
Crivella 755d496
Added optional dependencies `eb2` to install packages required by `eb2`
Crivella 9daea7d
Merge branch 'develop' into feature-click_cli
Crivella f04fe9e
Make the click based CLI opt-in only if you have click installed
Crivella baa9fa9
Merge branch 'develop' into feature-click_cli
Crivella cf8bbb2
Add CLI packages to `setup.py`
Crivella 1764d2f
Improvements to pattern matching and removed unused
Crivella 808a173
Replaces standard EB cli with click-wrapped one + ensures that autoco…
Crivella 5439684
Fix args for non-click shim
Crivella 5872704
Apply suggestion from @boegel
Crivella 1f5e1b4
Merge branch 'develop' of https://github.com/easybuilders/easybuild-f…
Crivella cc0f0d9
Add copyright/license headers to new files
Crivella e1120f0
Add version option to the click CLI
Crivella d858e66
Add end2end test on ubuntu 24 using the new click CLI
Crivella 0267a3c
Get correct VENV directory
Crivella bfc24d8
Run new CLI test on all end2end containers
Crivella fc21888
Make old python happy with typehints
Crivella 42a1536
choices should probably not be a flag by default unless `store_or_XXX…
Crivella 86b0ab3
Only chown user as group might not exist
Crivella 5413db8
Add `--rebuild` to the end2end test with click
Crivella 74f07b4
Address PR comments
Crivella a55b273
Merge branch 'develop' into feature-click_cli
Crivella fcf2dad
`repositorypat` is a strlist already and defaults to a list which is …
Crivella fe84da6
Add guard to ensure that all custom optparse types are being consider…
Crivella 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # # | ||
| # Copyright 2009-2026 Ghent University | ||
| # | ||
| # This file is part of EasyBuild, | ||
| # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
| # with support of Ghent University (http://ugent.be/hpc), | ||
| # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
| # Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
| # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
| # | ||
| # https://github.com/easybuilders/easybuild | ||
| # | ||
| # EasyBuild is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation v2. | ||
| # | ||
| # EasyBuild is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
| # # | ||
| """ | ||
| Click-based command line interface entrypoints that wraps the old optparse-based CLI. | ||
| The actual argument parsing is still done by optparse, here we just offer the other features of click: | ||
| - automatic shell autocompletion for different shells | ||
| - better help/error messages (requires also rich_click) | ||
|
|
||
| Authors: | ||
|
|
||
| * Davide Grassano (CECAM) | ||
| """ | ||
| from easybuild.main import main_with_hooks | ||
| from easybuild.tools.version import this_is_easybuild | ||
|
|
||
| try: | ||
| import click as original_click | ||
| except ImportError: | ||
| raise ImportError( | ||
| "`EB_CLI_CLICK` was set to use the `click`-based CLI but click cannot be found. " | ||
| "Please install click to use the new CLI or unset `EB_CLI_CLICK` (or different from '1') to use the old CLI." | ||
| ) | ||
| else: | ||
| try: | ||
| import rich_click as click | ||
| except ImportError: | ||
| import click | ||
|
|
||
| try: | ||
| from rich.traceback import install | ||
| except ImportError: | ||
| pass | ||
| else: | ||
| install(suppress=[ | ||
| click, original_click | ||
| ]) | ||
|
|
||
| from .options import EasyBuildCliOption, EasyconfigParam | ||
|
|
||
| @click.command() | ||
| @EasyBuildCliOption.apply_options | ||
| @click.argument('other_args', nargs=-1, type=EasyconfigParam(), required=False) | ||
| @click.version_option(version=this_is_easybuild(), message='%(version)s') | ||
| def eb(other_args): | ||
| """EasyBuild command line interface.""" | ||
| # Really no need to re-build the arguments if we support the exact same syntax we can just let them pass | ||
| # through to optparse | ||
| main_with_hooks() | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # # | ||
| # Copyright 2009-2026 Ghent University | ||
| # | ||
| # This file is part of EasyBuild, | ||
| # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), | ||
| # with support of Ghent University (http://ugent.be/hpc), | ||
| # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), | ||
| # Flemish Research Foundation (FWO) (http://www.fwo.be/en) | ||
| # and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). | ||
| # | ||
| # https://github.com/easybuilders/easybuild | ||
| # | ||
| # EasyBuild is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation v2. | ||
| # | ||
| # EasyBuild is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with EasyBuild. If not, see <http://www.gnu.org/licenses/>. | ||
| # # | ||
| from easybuild.cli import eb | ||
|
|
||
| # Ensure Click to recognizes the program name as `eb` when invoked as `python -m easybuild.cli` or similar | ||
| eb(prog_name='eb') |
Oops, something went wrong.
Oops, something went wrong.
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.
@Crivella please add a docstring with some info on what this provides, add yourself as author
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.
Done