pipfile icon indicating copy to clipboard operation
pipfile copied to clipboard

Can't specify minimal python version requirement

Open matthieudelaro opened this issue 7 years ago • 7 comments

Hi all,

Sorry for this stupid question, still... I didn't find the answer anywhere. According to this page, I should be able to specify a minimal python version requirement in Pipfile. Unfortunately, while I can specify an exact python version, it seems like I can't use >= at all. I tried other stuff such as >, 3.6+, etc. But nothing did the job. Any idea? Or is it an issue after all?

[requires]
python_version = "3.6" # works
python_version >= "3.6" #doesn't work => see error message below
# I also tried stuff like python_full_version >= "3.6"
 File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/pipfile/api.py", line 126, in load
    pipfile.data = p.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/pipfile/api.py", line 82, in parse
    config.update(toml.loads(content))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/toml.py", line 176, in loads
    item + "'. Try quoting the key name.")
toml.TomlDecodeError: Found invalid character in key name: '>'. Try quoting the key name.

Here are the version installed on my system:

$pipenv run pip --version
pip 9.0.1 from /somepath/lib/python3.6/site-packages (python 3.6)
$ pipenv --version
pipenv, version 8.2.7
$ pipenv run python --version
Python 3.6.3

matthieudelaro avatar Oct 25 '17 16:10 matthieudelaro

Maybe try:

python_version = "> 3.6"

?

pradyunsg avatar Oct 25 '17 16:10 pradyunsg

Thanks for opening this issue, @matthieudelaro! So this has already been noted in a few other places in the issue tracker but we only support hard version pins for Python at the moment. We've had requests for ranges but it's unclear what the maintainer consensus is on this.

If you feel like making a doc change specifying our current limitations, I'm happy to review it.

nateprewitt avatar Oct 25 '17 16:10 nateprewitt

Thanks @pradyunsg, that gives the following:

$pipenv check
Checking PEP 508 requirements…
Specifier python_version does not match > 3.6 (3.6).
Failed!

Replacing > 3.6 with > 3.5 doesn't do the trick:

$ pipenv check
Checking PEP 508 requirements…
Specifier python_version does not match > 3.5 (3.6).
Failed!

Thanks @nateprewitt. So you mean reporting the problem with more details?

matthieudelaro avatar Oct 25 '17 16:10 matthieudelaro

It's a simple comparison then, not a rich one. :/

Well, I was guessing anyway. :)

pradyunsg avatar Oct 25 '17 16:10 pradyunsg

@matthieudelaro, no not quite, we're aware that this functionality does not work and it isn't supported by pipenv at this time. We may address this in the future but it's not on the immediate roadmap.

If you feel the docs are misleading about this, I'm happy to review a PR that makes corrections.

nateprewitt avatar Oct 25 '17 16:10 nateprewitt

@matthieudelaro, sorry this is also the pipfile repo and this is a functionality question for pipenv. Please feel free to move the discussion over there.

nateprewitt avatar Oct 25 '17 16:10 nateprewitt

Ticket opened in pipenv#1050

gsemet avatar Nov 18 '17 10:11 gsemet