You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git - Should Pipfile.lock be committed to version control? #598
When two developers are working on a projet with different operating systems, the Pipfile.lock is different (especially the part inside host-environment-markers).
Reacted by Douglas Thor, Mani Hamidi, Philippe Gonzaga, Bruno Gelb, Daniel Hoherd, Lukas Martini, Emil, Mirhossein Mousavi, Martin Czygan, stew and 20 more
Especially for applications. For libraries, less so.
Reacted by Actarus, Mani Hamidi, Felipe Ojeda, Philippe Gonzaga, Paul Garner, Davi Medeiros, Shawn Niederriter, Chad Glinsky, Diogo Felix, Roller Angel and 9 more
Should this recommendation be documented? Perhaps in a section similar to Composer's.
Reacted by Eugene Kuznetsov, Binoj David, Mikołaj Chwalisz, Mani Hamidi, Tomáš Bedřich, Felipe Ojeda, Jannis Gebauer, Philippe Gonzaga, Bruno Gelb, Paul Garner and 15 more
Are their negative consequences to using a Pipfile.lock across OS types? In other words, if I generate my Pipfile.lock on MacOS, then deploy to Linux will Pipenv "do bad things"?
Reacted by ritchie, ns-cweber, Mike Feoktistov, Ashley Kotian, Simon Lammer, Connor McCormick, Cameron Taggart, Subodh Malgonde, Jesse-Zhang-Bose, Artem Smirnov and 9 more
@dougireton This depends on your dependencies. Using a lockfile from a different OS is fine if all your packages are modern and well-behaved (either platform-agnostic or have good cross-platform support). Otherwise Pipenv can do things wrong, like installing dependencies that don’t work, or not installing all needed dependencies.
Reacted by Harrison Kiang, Ashley Kotian, Cameron Taggart, neuron, Abdo Karaky, Chris Mountford, piermarcob and Tonghe Wang
How come pipenv's own Pipefile.lock is not added to git then?
Reacted by Maria Sophia Stefan, neuron, CoeJoder, Zakarias Laws, Babatunde Adenowo, Wesley J. Landaker, asrelo, Prithvijit , mmmvvvppp, Pim de Vroom and 3 more
Reacted by Harrison Kiang, Felix Hummel, Gaurav Kanoongo, carl colglazier, YY Ahn, Andreas Bresser, Nicholas Musolino, Diogo Felix, Alejandro Fontal, stew and 61 more
Reacted by Behrang Saeedzadeh, snejku, Markus Rudel, eisenlaub, Ademar Peixoto, Lenka42, Weston Johnson, Vivek R, Andrew Berkowitz, Dmitrii Shamrikov and 79 more
Reacted by Fab Ian Fuerste
Reacted by Matt Dodge, Zaymon Antonio, Luca Palmieri, Felipe de Morais, Jon Grace-Cox, Diogo Felix, Sourab Jha, Christian Påbøl Jacobsen, Roller Angel, Chad Chapman and 14 more
Reacted by Alex Zagoro, Lucas Schneider, Gerard Casas Saez, David Mora and Javier Porras-Valenzuela
I'm happy to take this advice as correct but I would like to understand why it is given.
the docs say:
Generally, keep both Pipfile and Pipfile.lock in version control.
but I couldn't find any more reasoning in the docs, can you point me to it?
Pipfile.lock is auto-generated and contents will differ depending on platform. If I'm developing on macOS and deploying to Debian ...already it sounds to me like I don't want the lock file in version control.
Then the comment above says:
Using a lockfile from a different OS is fine if all your packages are modern and well-behaved (either platform-agnostic or have good cross-platform support). Otherwise Pipenv can do things wrong, like installing dependencies that don’t work, or not installing all needed dependencies.
Again it sounds like I would not want the lock file in version control.
Reading through the responses on that issue I have a clearer idea of why I would want it. I think the docs need more elaboration.
The related question is how explicitly should versions be specified in the Pipfile?
If I do pipenv install <package> during development to get the latest version, it will go in the Pipfile with no version specifier. If everyone else gets my Pipfile.lock from vc and does pipenv install --ignore-pipfile they get pinned to the versions I installed, and no need to be more specific in the Pipfile. All good. If they don't do --ignore-pipfile then the lock file may change if a package updated and they have to decide whether to commit the changes. Ok. At any time devs can pipenv update <package> and the Pipfile won't change but the lock file will, and we would commit that. Ok. Is this the intended workflow?
But if the other dev is on a different platform the lock file contents will change(?) but it's not necessarily due to different package versions and we wouldn't want to commit it. Hmm.
And I would only add version specifier to Pipfile if for example I knew at dev time that I needed to install a non-latest version?
Also I noticed in the example Dockerfile you use pipenv install --deploy rather than pipenv install --ignore-pipfile ...they seem to have similar meaning, I would like to understand the subtlety of one vs the other.
(loving pipenv so far though!)
Reacted by Markus Rudel, Daniel Waltrip, Alan Parker Lue, Björn Pollex, Spacehug, Vijay Gaikwad, Nicholas Musolino, Wu Yongwei, Davi Wesley, NeroVanbiervliet and 40 more
I just found some more opinion from the pipenv tool itself:
requirements.txt found, instead of Pipfile! Converting…
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
This thread is quite old, but since it emerges again I guess it is best to make a definite, up-to-date statement. As of March 2018, the answer to this question is yes, you should always commit the lock file. Always.
Reacted by Dakota Nelson, ClericPy, Matt Wheeler, Vivek R, Giuseppe Crinò, Kevin Kirsche, Rolando Galindo, Chad Glinsky, Kyle King, Lucas Carvalho and 17 more
what has changed in March 2018 that changed the answer from "generally yes" to "always yes"?
What about the issue you explain earlier, is it fixed?
Using a lockfile from a different OS is fine if all your packages are modern and well-behaved (either platform-agnostic or have good cross-platform support). Otherwise Pipenv can do things wrong, like installing dependencies that don’t work, or not installing all needed dependencies.
Reacted by Weston Johnson, Alexander Lisianoi, GiraffeTree, Manos, Vasiliy Bolshakov, Daniyar Kussainov, Frank Villaro-Dixon, FullJoinIO, Simon Lammer, Semnodime and 5 more
Nothing is different. You should commit it to version control. If there are os-specific markers they should be included automatically. Because setup.py files are non-deterministic, it is possible to resolve a package on linux and find that it resolves differently on windows, but there is nothing we or anyone else besides the package maintainer can do about that. You won't know that's a problem unless you encounter it. If and when you do, simply re-lock and see the diff.
Activity
kennethreitz commentedon Sep 19, 2017
i recommend it.
kennethreitz commentedon Sep 19, 2017
Especially for applications. For libraries, less so.
LeCoupa commentedon Sep 19, 2017
Thanks a lot @kennethreitz
salty-horse commentedon Oct 1, 2017
Should this recommendation be documented? Perhaps in a section similar to Composer's.
dougireton commentedon Jan 30, 2018
Are their negative consequences to using a Pipfile.lock across OS types? In other words, if I generate my Pipfile.lock on MacOS, then deploy to Linux will Pipenv "do bad things"?
uranusjr commentedon Jan 31, 2018
@dougireton This depends on your dependencies. Using a lockfile from a different OS is fine if all your packages are modern and well-behaved (either platform-agnostic or have good cross-platform support). Otherwise Pipenv can do things wrong, like installing dependencies that don’t work, or not installing all needed dependencies.
kennethreitz commentedon Feb 17, 2018
Generally, yes you should commit it to version control.
behrangsa commentedon Feb 28, 2018
How come pipenv's own
Pipefile.lockis not added to git then?kennethreitz commentedon Feb 28, 2018
because we are special snowflakes.
anentropic commentedon Mar 7, 2018
I'm happy to take this advice as correct but I would like to understand why it is given.
the docs say:
but I couldn't find any more reasoning in the docs, can you point me to it?
Pipfile.lock is auto-generated and contents will differ depending on platform. If I'm developing on macOS and deploying to Debian ...already it sounds to me like I don't want the lock file in version control.
Then the comment above says:
Again it sounds like I would not want the lock file in version control.
Here is someone asking similar question #954
Reading through the responses on that issue I have a clearer idea of why I would want it. I think the docs need more elaboration.
The related question is how explicitly should versions be specified in the Pipfile?
If I do
pipenv install <package>during development to get the latest version, it will go in thePipfilewith no version specifier. If everyone else gets myPipfile.lockfrom vc and doespipenv install --ignore-pipfilethey get pinned to the versions I installed, and no need to be more specific in the Pipfile. All good. If they don't do--ignore-pipfilethen the lock file may change if a package updated and they have to decide whether to commit the changes. Ok. At any time devs canpipenv update <package>and the Pipfile won't change but the lock file will, and we would commit that. Ok. Is this the intended workflow?But if the other dev is on a different platform the lock file contents will change(?) but it's not necessarily due to different package versions and we wouldn't want to commit it. Hmm.
And I would only add version specifier to
Pipfileif for example I knew at dev time that I needed to install a non-latest version?Also I noticed in the example Dockerfile you use
pipenv install --deployrather thanpipenv install --ignore-pipfile...they seem to have similar meaning, I would like to understand the subtlety of one vs the other.(loving pipenv so far though!)
anentropic commentedon Mar 13, 2018
I just found some more opinion from the pipenv tool itself:
uranusjr commentedon Mar 14, 2018
This thread is quite old, but since it emerges again I guess it is best to make a definite, up-to-date statement. As of March 2018, the answer to this question is yes, you should always commit the lock file. Always.
mmohaveri commentedon Apr 1, 2018
@uranusjr could you please explain why?
what has changed in March 2018 that changed the answer from "generally yes" to "always yes"?
What about the issue you explain earlier, is it fixed?
techalchemy commentedon Apr 1, 2018
Nothing is different. You should commit it to version control. If there are os-specific markers they should be included automatically. Because
setup.pyfiles are non-deterministic, it is possible to resolve a package on linux and find that it resolves differently on windows, but there is nothing we or anyone else besides the package maintainer can do about that. You won't know that's a problem unless you encounter it. If and when you do, simply re-lock and see the diff.107 remaining items
Initial commit
Index: .idea/.gitignore
Create .gitignore
Index: .idea/.gitignore
# Byte-compiled / optimized / DLL files
Update README.md
gitignore
refactor: remove pipfile.lock from the gitignore according to pypa/pi…
Update README.md
I# Byte-compiled / optimized / DLL files
# Private test pics
Refactored backend to use Groq llama-3.3-70b-versatile and Groq Resp…
Refactored backend to use Groq llama-3.3-70b-versatile and Groq Resp…
# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.c…
Merge pull request #369