aiidateam / aiida-project

AiiDA project manager
Other
3 stars 7 forks source link

👌 CLI: improve `create --python` versatility #7

Closed mbercx closed 1 year ago

mbercx commented 1 year ago

Currently the --python option expects you to pass the full path to the Python binary. It would be nice if it could figure out the full absolute path to the binary that is found using PATH, so you can simply pass:

❯ aiida-project create cwf --core-version none --python python3.10
Usage: aiida-project create [OPTIONS] NAME
Try 'aiida-project create --help' for help.
╭─ Error ───────────────────────────────────────────────────────────────────────────────────╮
│ Invalid value for '--python': File 'python3.10' does not exist.                           │
╰───────────────────────────────────────────────────────────────────────────────────────────╯

In fact, it should be easy to also just avoid the python duplication, i.e.:

❯ aiida-project create cwf --core-version none --python 3.10
Usage: aiida-project create [OPTIONS] NAME
Try 'aiida-project create --help' for help.
╭─ Error ───────────────────────────────────────────────────────────────────────────────────╮
│ Invalid value for '--python': File '3.10' does not exist.                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────╯

We should then also add some validation and useful error messages e.g. in case a Python version isn't installed.

mbercx commented 1 year ago

Fixed in https://github.com/aiidateam/aiida-project/commit/d16c4e9f7e81895a56cb8c97a660977870cf3b47.