New wrapped CLI using click#4961
Conversation
|
This looks kind of nice, but I'm not a big fan of introducing a required 3rd party dependency. Is there any way we can support this opt-in, for example by defining an environment variable like |
|
We could make use of probably not only for this but also for all the optional dependencies we specify in Then we add a check on top of |
click CLI wrapper around normal CLIeb2 CLI using click
|
So for now the The approach of using an ENV variable i think make sense if we decide to merge |
- Fixed beahvore of defaults with `store_or_None` - Fixed checking defaults vs list/tuple instead of flattened value - Added checks for list values in covert comming from the defaults
a07c32e to
681e781
Compare
681e781 to
755d496
Compare
|
Example of a modified EC to test installing easybuild with easybuild with the new CLI EasyConfig
easyblock = 'EB_EasyBuildMeta'
name = 'EasyBuild'
version = '5.2.0'
version_suffix = '-dev'
homepage = 'https://easybuilders.github.io/easybuild'
description = """EasyBuild is a software build and installation framework
written in Python that allows you to install software in a structured,
repeatable and robust way."""
toolchain = SYSTEM
local_ef_commit = 'cf8bbb2e73d5468553ad83a53a52f9de8cbd6cdb'
local_eb_commit = 'develop'
local_ec_commit = 'develop'
sources = [
{
'filename': f'easybuild-framework-{local_ef_commit[:8]}.tar.xz',
'git_config': {
'url': 'https://github.com/Crivella',
'repo_name': 'easybuild-framework',
'commit': local_ef_commit,
}
},
{
'filename': f'easybuild-easyblocks-{local_eb_commit[:8]}.tar.xz',
'git_config': {
'url': 'https://github.com/easybuilders',
'repo_name': 'easybuild-easyblocks',
'commit': local_eb_commit,
}
},
{
'filename': f'easybuild-easyconfigs-{local_ec_commit[:8]}.tar.xz',
'git_config': {
'url': 'https://github.com/easybuilders',
'repo_name': 'easybuild-easyconfigs',
'commit': local_ec_commit,
}
}
]
checksums = []
click_autocomplete_bins = ['eb2']
# EasyBuild is a (set of) Python packages, so it depends on Python
# usually, we want to use the system Python, so no actual Python dependency is listed
allow_system_deps = [('Python', SYS_PYTHON_VERSION)]
local_pyshortver = '.'.join(SYS_PYTHON_VERSION.split('.')[:2])
sanity_check_paths = {
'files': ['bin/eb'],
'dirs': ['lib/python%s/site-packages' % local_pyshortver],
}
moduleclass = 'tools'Having the following installed on the system python (system- or user-wide) will enable:
(Ideally this would be added as system packages? |
1c3ee9d to
1764d2f
Compare
…mpletion script can still be generated
|
The current version now does not add a new The function invoked there will either be a wrapper to the old one if Checks based on whether NOTEThe multi-path autocompletion enabled by https://github.com/Crivella/easybuild-framework/blob/5439684362e867e9d78de889db1ac4aca2a52ca5/easybuild/cli/options/__init__.py#L62-L109 does not work in Bash when the path separator is |
eb2 CLI using clickclick
|
Did a high-level check and took it for a quick spin with the goal of merging this for the EasyBuild v5.3.0 release, but I'm afraid this needs more love...
I do like that the way in which this is implemented barely touches existing code, which makes me way more comfortable to go ahead and merge this as "alternative" CLI. |
|
With the above in mind, I need to lift this beyond the EasyBuild v5.3.0 release, so changing the milestone... |
Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
…ramework into feature-click_cli
b8c5791 to
0267a3c
Compare
…` is used. Allow list values to be False/None for `store_or_XXX`
Also modified the end2end tests to do
|
Enabling
Using pip and optional python dependencies:
pip install easybuild-framework[eb_click]How it works
EasyBuildOptionsand use them to generate a CLI withclickclick+rich_clickto have a fancier looking CLIclickis only used for the nicer help and auto completion, but the parameters are still passed as is to the normal parserAutocomplete
From click docs add the following to the
.bashrcor venv activation script.Alternatively see aiida-core EC to activate it as a module
Advantages
bashzshfishshellsTODO
Maybe
print_msg#5125)clicknatively and divide the commands in subgroups to have an easier to readhelp(Discussion moved to Modern CLI for easybuild #5122)How would this look like
eb --help
Error
Normal build run
Opt in/out
the new behavior will only be turned on if

clickis installed, otherwise the old one will be used.