pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Allow for looser restrictions on require python version

Open alexanderepstein opened this issue 6 years ago • 3 comments

Is your feature request related to a problem? Please describe.

I constantly switch machines when developing a python project and between machines there are minor differences in the version of python installed on these machines. However my project only requires that I work in python 3 it does not matter if I work in python 3.6 or python 3.7.5.

Please let me know if something like this already exists as I am having trouble finding any documentation regarding this behavior.

Describe the solution you'd like

To use specific characters to signify what version of python I require.

Doing things like:

python_version = "3*" to signify any version that starts with 3

python_version = "3.6.*" to signify any version that starts with 3.6

python_version = "3.6+" to signify at least 3.6 or greater

python_version = "3.6.1+" to signify at least 3.6.1 or greater

I think those examples cover all the cases I can think of, but there could be more.

alexanderepstein avatar Nov 14 '19 06:11 alexanderepstein

One edge case would be if the user used

python_version = "3.6.1*"

I don't think this should be allowed because according to my examples above this means pipenv would allow 3.6.10 but not allow 3.6.2 and that just doesn't seem to make any sense.

alexanderepstein avatar Nov 14 '19 06:11 alexanderepstein

Duplicate of https://github.com/pypa/pipenv/issues/1050 which indicated the maintainers will not consider this.

https://github.com/pypa/pipenv/issues/1050#issuecomment-346203646 https://github.com/pypa/pipenv/issues/1050#issuecomment-418917769

If they did, I'd suggest semantics identical to package versions, rather than anything new (like the +)

nicktimko avatar Nov 18 '19 19:11 nicktimko

I have been playing around with a concept related to this and I have opened a draft PR: https://github.com/pypa/pipenv/pull/5931

This patches the environment method used by the resolver for the duration of the resolve phase allowing overrides to be read in from the Pipfile resolver section (which would be a new reserved category). Here is an example.

[resolver]
python_full_version = "3.7.13"  # Markers evaluate to True that require any python_full_version markers in this range (in theory)
python_version = "3.7"   # Markers evaluate to True that require any python_version markers in this range (in theory)
finder_python = "3.7"  # The base python version to resolve against (used in the package finder)
os_name="win32"  # What operating system markers should evaluate to true (in theory)

Would appreciate if anyone has time to try it out and provide feedback.

matteius avatar Sep 12 '23 12:09 matteius