Question - Pipfile usage: From dev to production
vphilippon opened this issue · comments
I've been thinking about the usage of Pipfile
, and this question kept bugging me:
Is the Pipfile
for a project meant to be the same file used both for the dev and prod environments (and any other environment, like QA setups and such, if it applies)?
If yes, how do you do so?
In development, users will usually install one (or many) packages in editable mode, which doesn't match how it should be installed when in production.
"default" is your common set of dependencies, used for both production and development.
"develop" is your development-only dependencies.
@kennethreitz Thanks, that still leaves a question open (unless I missed something):
What about the notion of editable requirements?
I'll take the example Pipfile
from the ReadMe:
[[source]]
url = 'https://pypi.python.org/simple'
verify_ssl = true
name = 'pypi'
[requires]
python_version = '2.7'
[packages]
requests = { extras = ['socks'] }
records = '>0.5.0'
django = { git = 'https://github.com/django/django.git', ref = '1.11.4', editable = true }
"e682b37" = {file = "https://github.com/divio/django-cms/archive/release/3.4.x.zip"}
"e1839a8" = {path = ".", editable = true}
pywinusb = { version = "*", os_name = "=='nt'", index="pypi"}
[dev-packages]
nose = '*'
unittest2 = {version = ">=1.0,<3.0", markers="python_version < '2.7.9' or (python_version >= '3.0' and python_version < '3.4')"}
If I use this Pipfile
(or the generated Pipfile.lock),
djangowill be installed in editable mode. That's not what we want in production, right? I understand that
django` is a common dependency that is needed in all environment. But, in prod, I don't that it to be installed as editable, of course.
So, is there any way to reuse this file in both my dev and prod environment? My guts is telling me "no" here, but whenever I read about Pipfile
, I get the feeling it should be a single file for all environments.
[[source]]
url = 'https://pypi.python.org/simple'
verify_ssl = true
name = 'pypi'
[requires]
python_version = '2.7'
[packages]
requests = { extras = ['socks'] }
records = '>0.5.0'
django = "*"
"e682b37" = {file = "https://github.com/divio/django-cms/archive/release/3.4.x.zip"}
"e1839a8" = {path = ".", editable = true}
pywinusb = { version = "*", os_name = "=='nt'", index="pypi"}
[dev-packages]
nose = '*'
django = { git = 'https://github.com/django/django.git', ref = '1.11.4', editable = true }
unittest2 = {version = ">=1.0,<3.0", markers="python_version < '2.7.9' or (python_version >= '3.0' and python_version < '3.4')"}
@kennethreitz Ah! Yes! Thanks!
That would actually be a good addition to the readme, IMO.
As a side note: last time I tried in pipenv
, IIRC, it failed. I (wrongly) assumed we weren't allowed to put the same package dependency in both sections. I'll try it again and report back on pipenv
side if I still have trouble.