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

Unified CLI #1232

Open
wants to merge 33 commits into
base: release
Choose a base branch
from
Open

Unified CLI #1232

wants to merge 33 commits into from

Conversation

pgierz
Copy link
Member

@pgierz pgierz commented Oct 17, 2024

Cleans up the CLI for a more unified experience:

Feature List

  • All programs start with esm-tools <command>
  • Beautiful colours
  • Old commands still work as expected esm-tools main test

To consider

  • question Further information is requested Version and model are combined by minus. Maybe adopt a spack-like syntax?

Test

  • esm-tools get fesom-2.5 (Note: no added minus, the subcommand is just get)
  • esm-tools comp fesom-2.5
  • esm-tools install fesom-2.5
  • esm-tools run ...

@pgierz
Copy link
Member Author

pgierz commented Oct 18, 2024

Incomplete, but here is a preview:

image

@pgierz pgierz added enhancement New feature or request question Further information is requested continuous integration cleanup Issues related to the cleanup phase labels Oct 19, 2024
@pgierz
Copy link
Member Author

pgierz commented Oct 19, 2024

This PR includes continuous integration label, since there is a new CI step specifically for the new syntax, e.g.:

$ esm-tools get <model>

esm-tools new cli test

@pgierz pgierz self-assigned this Oct 21, 2024
@pgierz
Copy link
Member Author

pgierz commented Oct 22, 2024

02_50_57

Almost done, just need meta-commands inside esm-master.

@pgierz pgierz marked this pull request as ready for review October 22, 2024 13:32
@pgierz pgierz requested a review from mandresm October 22, 2024 13:33
@pgierz pgierz requested a review from seb-wahl October 22, 2024 13:40
@pgierz
Copy link
Member Author

pgierz commented Oct 22, 2024

Copilot Summary

This pull request includes several key changes to the esm-tools project, focusing on adding new CLI tests, updating dependencies, and refactoring CLI scripts to use rich-click for improved command-line interfaces.

CI/CD Improvements:

  • Added a new GitHub Actions workflow for testing the new CLI (.github/workflows/new-cli.yml).

Dependency Updates:

  • Updated setup.py to include new dependencies: rich-click and click-repl and restructured the console_scripts entry points. [1] [2] [3]

CLI Refactoring:

  • Refactored multiple CLI scripts to use rich-click for enhanced command-line interfaces:
    • src/esm_archiving/cli.py
    • src/esm_cleanup/cli.py
    • src/esm_database/cli.py
    • src/esm_master/cli.py
    • src/esm_master/cli-broken.py

Code Clean-Up:

  • Removed unused imports from setup.py and other minor code clean-ups. [1] [2]

These changes enhance the project's maintainability and user experience by improving the CLI's usability and ensuring the CI/CD pipeline tests the new CLI functionality.

@JanStreffing
Copy link
Contributor

JanStreffing commented Oct 23, 2024

I don't see esm-master clean and recomp there. Has something changed in this regard?

Edit: In the second picture there is clean, but no recomp or install, which it seems are on your radar.

@pgierz
Copy link
Member Author

pgierz commented Oct 23, 2024

That is in there now, here is an up-to-date version:

image

Feel free to try it out and give feedback.

NOTE You need to install with pip install . (not in editable mode, I still need to fix that)

@pgierz pgierz marked this pull request as draft December 2, 2024 08:35
@pgierz
Copy link
Member Author

pgierz commented Dec 2, 2024

Todo: symlinks for configs, namelists, etc

@pgierz pgierz marked this pull request as ready for review December 2, 2024 09:40
@pgierz
Copy link
Member Author

pgierz commented Dec 2, 2024

@mandresm I am not sure if the setup.py still needs to be adapted to get the right paths. You worked on that more recently than I did, maybe you can have a look?

@seb-wahl
Copy link
Contributor

seb-wahl commented Dec 2, 2024

Something that you/we should definitely check if the updated works correctly from an existing installation i.e. that the move of namelists folder and the symlinking afterwards works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Issues related to the cleanup phase continuous integration enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants