inveniosoftware / invenio-cli

CLI module for Invenio
https://invenio-cli.readthedocs.io
MIT License
10 stars 43 forks source link

Check for `pyenv` in `check-requirements -d` #294

Open max-moser opened 2 years ago

max-moser commented 2 years ago

Introduction

If the cookiecutter'd version of InvenioRDM specifies a different Python version than the one globally installed, pyenv (or asdf with asdf-python) is required to create a virtual environment with the specified Python version. Example: The installed Python is 3.10, but the cookiecutter'd InvenioRDM instance requires 3.8: image

Note: In the screenshot, pipenv v2022.5.2 is used.

Problem

pipenv is a direct dependency of invenio-cli and is thus very hard to miss. However, becausepipenv can work without a Python version manager (i.e. pyenv or asdf) if the global Python version matches the required one from the Pipfile, they are not strict dependencies of pipenv. Thus, pyenv/asdf are easy to miss and can lead to unexpected errors (see screenshot above).

Describe the solution you'd like

I feel that check-requirements --development should check if one of the Python version managers is installed, because it's likely that the Pipfile requires a different Python version than the one installed globally.

Alternatives that you've considered

We could remove the Python version requirement from the Pipfile in the cookiecutter, causing the instance to use whatever is installed. However, this would give up some control over the Python version in use, and thus open up other possibilities for errors.