37

Is there a way in pipenv to specify the minimum version of python in the Pipfile?

Would something like this work?

[requires]
python_version = ">=python 3.5"
Jasonca1
  • 3,598
  • 6
  • 19
  • 32
  • 7
    it seems they just support hard version pins for Python. There is an [issue on Github](https://github.com/pypa/pipfile/issues/87) – lmiguelvargasf Jul 24 '18 at 07:07
  • Thanks @lmiguelvargasf. I appreciate the prompt response. I hope that they will implement support for this feature down the road. – Jasonca1 Jul 24 '18 at 11:07
  • I agree with you. It would be awesome if they provide this feature. – lmiguelvargasf Jul 24 '18 at 14:35
  • 7
    To follow up on this, the devs have [explicitly](https://github.com/pypa/pipenv/issues/1050#issuecomment-346203646) said that they will not be adding this feature - even though it puzzles quite a lot of users. [The issue.](https://github.com/pypa/pipenv/issues/1050) – Bram Vanroy Dec 19 '18 at 14:00
  • I agree @BramVanroy, I think this feature would be very handy. Hopefully the devs, given enough pressure from the community, change their mind on this and implement it. I would love to see pipenv ship with future versions of python and become the defacto standard for managing virtualenvs in the python language. – Jasonca1 Dec 19 '18 at 14:29

1 Answers1

27

No, pipenv does not support this. Per pipenv issue 1050 feature request, the pipenv authors have explicitly chosen not to implement it.

Note that you can specify:

 python_version = "3"

to allow any version of Python 3. Not exactly what you asked for, but it might be sufficient for some projects.

Rob Bednark
  • 22,937
  • 20
  • 77
  • 112
  • 1
    for any version 3 of python, this is what worked for me python_version = "3" – Jean-Frederic PLANTE Dec 31 '20 at 02:07
  • I think this is the correct answer. But I'd like to note that I've found that using "3" means that `pipenv check` will always fail. This is because 3 != 3.8 or whatever version is used. I presume that is in the backlog of things to fix. – John Nov 09 '21 at 21:58