pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Specify Python Version Range in Pipfile

Open Semnodime opened this issue 1 year ago • 3 comments

Issue description

[requires]
python_version = ">=3.12"

Expected result

Choose the latest python version available on the system to satisfy the constraints or raise the constraint error.

Actual result

Warning: Python >=3.12 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.

Steps to replicate

pipenv --python 3.12
# Change last line in Pipfile to `python_version = ">=3.12"`
pipenv --rm
pipenv --install

Semnodime avatar Apr 27 '24 02:04 Semnodime

Only absolute values are supported, and when upgrading python versions virtualenvs need to be recreated.

matteius avatar Apr 27 '24 03:04 matteius

Only absolute values are supported, and when upgrading python versions virtualenvs need to be recreated.

Correct. That's what I observed. This is a bug since the rest of the Pipfile uses the same version specifiers and pipenv --install does not communicate that only absolute values are supported and a range has been specified. I acknowledge that one could conclude that from the pipenv error, but IMHO it'd be better to signal this parsing constraint explicitly along the error message.

Semnodime avatar Apr 27 '24 12:04 Semnodime

@Semnodime @matteius I'd love to handle this issue. I'll send a PR to fix this in near future.

sanspareilsmyn avatar May 24 '24 03:05 sanspareilsmyn

@sanspareilsmyn I think I have it solved in my open PR that fixes a number of issues -- if either of you or @Semnodime can check out this branch: https://github.com/pypa/pipenv/pull/6282 and give it a whirl.

matteius avatar Oct 26 '24 03:10 matteius