Hi,
I'd like to allow multiple python versions on a project.
In the current case, my production environments are in 3.7 (docker image python:slim-stretch
) while python 3.7 is not yet available in my dev environments (archlinux).
But I'm pretty sure that my project will work equally on 3.6 and 3.7, and would like to avoid installing and using another interpreter.
Also, I am using features like f-strings which are not available in 3.5, so I can't specify python_version ="3"
, because on other dev environments like xenial, one must install an interpreter >=3.6.
Allowing a version string in Pipfile
, like:
[requires]
python_version = ">=3.6"
We could also allow a list, like python_version = "3.6,3.7"
.
$ pipenv --support
Pipenv version: '2018.7.1'
Pipenv location: '/usr/local/lib/python3.7/site-packages/pipenv'
Python location: '/usr/local/bin/python'
Other Python installations in PATH
:
2.7
: /usr/bin/python2.7
2.7
: /usr/bin/python2.7
3.5
: /usr/bin/python3.5m
3.5
: /usr/bin/python3.5
3.7
: /usr/local/bin/python3.7m
3.7
: /usr/local/bin/python3.7
3.7
: /usr/local/bin/python3.7
3.7.0
: /usr/local/bin/python
3.7.0
: /usr/local/bin/python
2.7.13
: /usr/bin/python
2.7.13
: /usr/bin/python2
3.7.0
: /usr/local/bin/python3
3.7.0
: /usr/local/bin/python3
3.5.3
: /usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.0',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.4.0-116-generic',
'platform_system': 'Linux',
'platform_version': '#140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018',
'python_full_version': '3.7.0',
'python_version': '3.7',
'sys_platform': 'linux'}
System environment variables:
EMAIL_USE_SSL
LANG
HOSTNAME
EMAIL_USE_TLS
GPG_KEY
EMAIL_USER
SECRET_KEY
PWD
HOME
DOMAIN_NAME
MEMCACHED
TERM
EMAIL_FQDN
ALLOWED_HOST
PYTHON_VERSION
POSTGRES_PASSWORD
EMAIL_HOST
SHLVL
DB
ADMIN_MAIL
PATH
PYTHON_PIP_VERSION
EMAIL_HOST_PASSWORD
_
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
Pipenv鈥搒pecific environment variables:
Debug鈥搒pecific environment variables:
PATH
: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG
: C.UTF-8
PWD
: /app
Contents of Pipfile
('/app/Pipfile'):
[[source]]
url = "https://pypi.org/simple"
name = "pypi"
verify_ssl = true
[dev-packages]
[packages]
ndh = ">=3.6"
django = "<2.1"
django-filter = "*"
"django-tables2" = "*"
requests = "*"
GitPython = "*"
djangorestframework = "*"
[requires]
python_version = ">=3.6"
[pipenv]
allow_prereleases = true
Contents of Pipfile.lock
('/app/Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "8aa12687e2b98dae1d44072f51160fa0bb424048237baa197110c9de93173d07"
},
"pipfile-spec": 6,
"requires": {
"python_version": ">=3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"certifi": {
"hashes": [
"sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",
"sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"
],
"version": "==2018.4.16"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"django": {
"hashes": [
"sha256:97886b8a13bbc33bfeba2ff133035d3eca014e2309dff2b6da0bdfc0b8656613",
"sha256:e900b73beee8977c7b887d90c6c57d68af10066b9dac898e1eaf0f82313de334"
],
"index": "pypi",
"version": "==2.0.7"
},
"django-autoslug-iplweb": {
"hashes": [
"sha256:6ddec119072067e78cbdb53f7ba11ae8bee5a2f2f0fe1d90c6a4d3c0a91489d3",
"sha256:8a3ba49b18f082e29ac9cb17884d4b2149ad14988bd89e118b1c5ddf94fdea8e"
],
"version": "==1.9.4"
},
"django-bootstrap4": {
"hashes": [
"sha256:6db4a27b33851833e68b96344f9df063150dcace8d4787ebfc21eceb55196945"
],
"version": "==0.0.6"
},
"django-filter": {
"hashes": [
"sha256:6f4e4bc1a11151178520567b50320e5c32f8edb552139d93ea3e30613b886f56",
"sha256:86c3925020c27d072cdae7b828aaa5d165c2032a629abbe3c3a1be1edae61c58"
],
"index": "pypi",
"version": "==2.0.0"
},
"django-tables2": {
"hashes": [
"sha256:43b9af69933dd70afd26b5179987fa89a64221379d605a7be86686c4e30933b5"
],
"index": "pypi",
"version": "==2.0.0a5"
},
"djangorestframework": {
"hashes": [
"sha256:b6714c3e4b0f8d524f193c91ecf5f5450092c2145439ac2769711f7eba89a9d9",
"sha256:c375e4f95a3a64fccac412e36fb42ba36881e52313ec021ef410b40f67cddca4"
],
"index": "pypi",
"version": "==3.8.2"
},
"gitdb2": {
"hashes": [
"sha256:87783b7f4a8f6b71c7fe81d32179b3c8781c1a7d6fa0c69bff2f315b00aff4f8",
"sha256:bb4c85b8a58531c51373c89f92163b92f30f81369605a67cd52d1fc21246c044"
],
"version": "==2.0.4"
},
"gitpython": {
"hashes": [
"sha256:563221e5a44369c6b79172f455584c9ebbb122a13368cc82cb4b5addff788f82",
"sha256:8237dc5bfd6f1366abeee5624111b9d6879393d84745a507de0fda86043b65a8"
],
"index": "pypi",
"version": "==2.1.11"
},
"idna": {
"hashes": [
"sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
"sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
],
"version": "==2.7"
},
"ndh": {
"hashes": [
"sha256:4e10cb37591e3b32f45e3c6c5b39403463928390354b41e0c2d516f245a8cfb3",
"sha256:bac98ec967b175d3730e7e7a74e388b1d90c744ff2c955cf5f0ce57b6947b822"
],
"index": "pypi",
"version": "==3.6.0"
},
"pytz": {
"hashes": [
"sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053",
"sha256:ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277"
],
"version": "==2018.5"
},
"requests": {
"hashes": [
"sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1",
"sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a"
],
"index": "pypi",
"version": "==2.19.1"
},
"smmap2": {
"hashes": [
"sha256:0dd53d991af487f9b22774fa89451358da3607c02b9b886a54736c6a313ece0b",
"sha256:dc216005e529d57007ace27048eb336dcecb7fc413cfb3b2f402bb25972b69c6"
],
"version": "==2.0.4"
},
"urllib3": {
"hashes": [
"sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf",
"sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"
],
"version": "==1.23"
}
},
"develop": {}
}
Hi, this has been proposed multiple times (the most informational thread is #1050, I believe), and the resolution is to refrain from doing it, since Pipenv wants to focus on the application aspect of Python development. In an application context, and it is wildly considered best practice to support only one Python minor version in a Python application.
Note that the python_version
key is optional. You can always remove it if it causes problems, and document the version requirements otherwise (i.e. in the README). The checks also should generate only warnings that can be ignored if you really know what you鈥檙e doing.
Thanks for your answer
The checks also should generate only warnings that can be ignored if you really know what you鈥檙e doing.
@uranusjr Are you sure that this is really only a warning, and not an error? I'm seeing pipenv exit with a non-zero exit code (1 in my case) and only printing this message. Should I file a bug?
Most helpful comment
Use
poetry
insteadpoetry env