Skip to content

Question - Pipfile usage: From dev to production #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vphilippon opened this issue Nov 14, 2017 · 4 comments
Closed

Question - Pipfile usage: From dev to production #91

vphilippon opened this issue Nov 14, 2017 · 4 comments

Comments

@vphilippon
Copy link
Member

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.

@kennethreitz
Copy link
Contributor

"default" is your common set of dependencies, used for both production and development.
"develop" is your development-only dependencies.

@vphilippon
Copy link
Member Author

@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 thatdjango` 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.

@kennethreitz
Copy link
Contributor

[[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')"}

@vphilippon
Copy link
Member Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants