Skip to content
Open
Show file tree
Hide file tree
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 Jul 16, 2025
0ff09eb
Install as a console script
Crivella Jul 17, 2025
60229a0
Avoid warning of double arg initialization if `prepare_main` did not …
Crivella Jul 17, 2025
b6990fc
Move to static method
Crivella Jul 17, 2025
08b0365
Added list paramter conversion and better autocomplete
Crivella Jul 18, 2025
eb7af72
Removed comments
Crivella Jul 18, 2025
12dfbf6
Fix potential missing attribute
Crivella Jul 18, 2025
5109e31
Added autocompletion for EC files
Crivella Jul 18, 2025
f3972f8
Better checks for default values
Crivella Jul 18, 2025
530db73
- Fixed behavior of bool --X/--disable-X
Crivella Jul 18, 2025
b42d59a
Do not resolve full path to avoid `:` in `robot-paths` being improper…
Crivella Jul 31, 2025
8f6e863
Ensure that if `click` is not present a nicer message is shown
Crivella Jul 31, 2025
9385b52
Use pathsep as delimiter for paths and allow empty initial path in au…
Crivella Jul 31, 2025
50ba676
Passthrough the arguments from the CLI to optparse instead of rebuild…
Crivella Jul 31, 2025
75fbc67
Improve autocomplete
Crivella Jul 31, 2025
a015eaa
Improve `help` metadata
Crivella Jul 31, 2025
d2dd8b2
Lint and better comments
Crivella Jul 31, 2025
755d496
Added optional dependencies `eb2` to install packages required by `eb2`
Crivella Jul 31, 2025
9daea7d
Merge branch 'develop' into feature-click_cli
Crivella Feb 11, 2026
f04fe9e
Make the click based CLI opt-in only if you have click installed
Crivella Feb 12, 2026
baa9fa9
Merge branch 'develop' into feature-click_cli
Crivella Feb 17, 2026
cf8bbb2
Add CLI packages to `setup.py`
Crivella Feb 17, 2026
1764d2f
Improvements to pattern matching and removed unused
Crivella Feb 20, 2026
808a173
Replaces standard EB cli with click-wrapped one + ensures that autoco…
Crivella Mar 11, 2026
5439684
Fix args for non-click shim
Crivella Mar 11, 2026
5872704
Apply suggestion from @boegel
Crivella Apr 9, 2026
1f5e1b4
Merge branch 'develop' of https://github.com/easybuilders/easybuild-f…
Crivella Apr 9, 2026
cc0f0d9
Add copyright/license headers to new files
Crivella Apr 9, 2026
e1120f0
Add version option to the click CLI
Crivella Apr 9, 2026
d858e66
Add end2end test on ubuntu 24 using the new click CLI
Crivella Apr 9, 2026
0267a3c
Get correct VENV directory
Crivella Apr 9, 2026
bfc24d8
Run new CLI test on all end2end containers
Crivella Apr 9, 2026
fc21888
Make old python happy with typehints
Crivella Apr 9, 2026
42a1536
choices should probably not be a flag by default unless `store_or_XXX…
Crivella Apr 9, 2026
86b0ab3
Only chown user as group might not exist
Crivella Apr 9, 2026
5413db8
Add `--rebuild` to the end2end test with click
Crivella Apr 10, 2026
74f07b4
Address PR comments
Crivella Jun 15, 2026
a55b273
Merge branch 'develop' into feature-click_cli
Crivella Jun 15, 2026
fcf2dad
`repositorypat` is a strlist already and defaults to a list which is …
Crivella Jun 15, 2026
fe84da6
Add guard to ensure that all custom optparse types are being consider…
Crivella Jun 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,48 @@ jobs:
shell: bash
run: |
sudo -u easybuild bash -l -c "source /tmp/eb_env; eb flex-2.6.4.eb --trace --robot"

- name: Ensure `python3 -m venv` can be used
if: startsWith(matrix.container, 'ubuntu')
shell: bash
run: |
apt update && apt install -y python3-venv

- name: Create a virtual environment and install EasyBuild with the click cli extra
shell: bash
run: |
export VENVDIR=/home/easybuild/venv
python3 -m venv $VENVDIR
source $VENVDIR/bin/activate
pip install --upgrade pip
pip install .[eb_click]
pip install $HOME/easybuild-easyblocks-develop
pip install $HOME/easybuild-easyconfigs-develop
chown -R easybuild $VENVDIR

- name: Run commands to check test environment using the click cli
shell: bash
run: |
export VENVDIR=/home/easybuild/venv
cmds=(
"whoami"
"pwd"
"env | sort"
"eb --help"
"eb --version"
"eb --help | grep '─ Options ─'"
"eb --show-system-info"
"eb --check-eb-deps"
"eb --show-config"
"eb -x bzip2-1.0.8.eb"
)
for cmd in "${cmds[@]}"; do
echo ">>> $cmd"
sudo -u easybuild bash -l -c "export EB_CLI_CLICK=1; source $VENVDIR/bin/activate; $cmd"
done

- name: End-to-end test of installing flex with EasyBuild using the click cli
shell: bash
run: |
export VENVDIR=/home/easybuild/venv
sudo -u easybuild bash -l -c "export EB_CLI_CLICK=1; source $VENVDIR/bin/activate; eb flex-2.6.4.eb --rebuild --trace --robot"
70 changes: 70 additions & 0 deletions easybuild/cli/__init__.py
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/>.
# #

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

"""
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()
28 changes: 28 additions & 0 deletions easybuild/cli/__main__.py
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')
Loading
Loading