72

When two developers are working on a project with different operating systems, the Pipfile.lock is different (especially the part inside host-environment-markers).

For PHP, most people recommend to commit composer.lock file.

Do we have to do the same for Python?

BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
Julien Le Coupanec
  • 7,742
  • 9
  • 53
  • 67

2 Answers2

94

Short - Yes!

The lock file tells pipenv exactly which version of each dependency needs to be installed. You will have consistency across all machines.

// update: Same question on github

Al Sweigart
  • 11,566
  • 10
  • 64
  • 92
wiesson
  • 6,544
  • 5
  • 40
  • 68
2

NO, you should not commit Pipfile.lock because:

  • It will contain info on a specific build of each library. Those builds could be platform-dependent, and you don't want to share them with other developers and between environments (potentially).
  • It will cache your credentials used locally to install packages from private feeds.

Just a regular Pipfile should probably be enough.

  • Where does the lock file cache the credentials? Other than if you use a package repo URL of the form `schema://username:password@host/path`, I don't know how it does. – Nick T Jun 28 '23 at 14:18