pipenv
pipenv copied to clipboard
Different source for the same package between dev and production
Issue description
[[source]]
url = "https://some_index
name = "some_index"
[packages]
mypkg = "3.0.0"
[dev-packages]
mypkg = {path = "./mypkg", editable = true}
Consider the Pipfile above. I would like to have the same package installed as a editable on dev and picked up from the index in production. Even when I run pipenv sync --dev
the definition of the package in [packages] prevails.
Expected result
I would expect that pipenv sync --dev
deploys the package as it is defined in [dev-packages]
Actual result
Instead the [packages] one is always deployed.
Steps to replicate
Define the same package in [packages] and [dev-packages] and then runpipenv sync --dev
$ pipenv --support
Pipenv version: '2020.8.13'
Pipenv location: '/usr/local/lib/python3.7/dist-packages/pipenv'
Python location: '/usr/bin/python3'
Python installations found:
-
3.7.3
:/root/.local/share/virtualenvs/myproject-PzJHYJGi/bin/python3.7
-
3.7.3
:/root/.local/share/virtualenvs/myproject-PzJHYJGi/bin/python3
-
3.7.3
:/root/.local/share/virtualenvs/myproject-PzJHYJGi/bin/python3.7
-
3.7.3
:/root/.local/share/virtualenvs/myproject-PzJHYJGi/bin/python3
-
3.7.3
:/usr/bin/python3.7
-
3.7.3
:/usr/bin/python3.7m
-
3.7.3
:/usr/bin/python3
-
2.7.16
:/usr/bin/python2
-
2.7.16
:/usr/bin/python2.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.3',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.19.76-linuxkit',
'platform_system': 'Linux',
'platform_version': '#1 SMP Tue May 26 11:42:35 UTC 2020',
'python_full_version': '3.7.3',
'python_version': '3.7',
'sys_platform': 'linux'}
System environment variables:
-
PIPENV_ACTIVE
-
HOSTNAME
-
PWD
-
PIP_PYTHON_PATH
-
HOME
-
VIRTUAL_ENV
-
TERM
-
PIP_DISABLE_PIP_VERSION_CHECK
-
SHLVL
-
PYTHONDONTWRITEBYTECODE
-
LC_CTYPE
-
PS1
-
PATH
-
OLDPWD
-
_
-
PIP_SHIMS_BASE_MODULE
-
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
-
PIPENV_ACTIVE
:1
Debug–specific environment variables:
-
PATH
:/root/.local/share/virtualenvs/myproject-PzJHYJGi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-
PWD
:/opt/myproject
-
VIRTUAL_ENV
:/root/.local/share/virtualenvs/myproject-PzJHYJGi
Contents of Pipfile
('/opt/myproject/Pipfile'):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
redis = {path = "./redis-src", editable = true}
[packages]
redis = "*"
[requires]
python_version = "3.7"
Contents of Pipfile.lock
('/opt/myproject/Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "db63a9d0678f2fddbedf919a6760d2a634862e2920745fe22beeb091fa6e7e56"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"redis": {
"hashes": [
"sha256:0e7e0cfca8660dea8b7d5cd8c4f6c5e29e11f31158c0b0ae91a397f00e5a05a2",
"sha256:432b788c4530cfe16d8d943a09d40ca6c16149727e4afe8c2c9d5580c59d9f24"
],
"index": "pypi",
"version": "==3.5.3"
}
},
"develop": {
"redis": {
"hashes": [
"sha256:0e7e0cfca8660dea8b7d5cd8c4f6c5e29e11f31158c0b0ae91a397f00e5a05a2",
"sha256:432b788c4530cfe16d8d943a09d40ca6c16149727e4afe8c2c9d5580c59d9f24"
],
"index": "pypi",
"version": "==3.5.3"
}
}
}
One remark: For the following Pipfile:
https://github.com/dim0x69/pipenvbug/blob/main/Pipfile
"editable = true" is also ignored for [dev-packages]. The pacakge is always installed in a non-editable way.
I wanted to achieve the exact same mechanism to be able to user released library versions in prod and overwrite them with git submodules while working locally. After doing some googling I couldn't find any reasonable way to achieve this.
Any comments of it from the Pipenv team? Thanks in advance!
Same here, I end up with a ci editing the Pipfile / Pipfile.lock to have it in non editable in built artefacts and editable in default mode... Not ideal
Still an open question on 2022.1.8
?
I'm on 2022.3.23, and would also like to see this feature.
Imo, having [dev-packages] replace packages already declared in [packages] is the most logical. I can't think of a situation where that behavior would not be the expected.
I am on 2023.11.15 and also would like to have this feature implemented. Currently I have to comment in/out the 2 versions in [packages] and [dev-packages] depending if I am developing or ready to deploy, which updating the pipfile and pipfile.lock each time...