简体   繁体   中英

Pipenv & lock file - depolyment

I have just started using PIPENV and I found it amazing as I have never used virtual environments before. However, I am still confused with the PIPENV file and the lock file. I understand through videos that both files are essential for PIPENV.

I have two questions regarding the two files:

1) If I wish to deploy it on my friends laptop (lets take him as the end user), which of those two files do I need to pass him and what are their purposes?

2) If I wish to deploy it on my other friends laptop (lets take him as my project partner) who requires development libraries, which of those two files do I need to pass him and what are their purposes?

3) What is the difference between 'freeze' and 'lock'?

Thanks in advance!

Pipfile is the file describing which dependencies are directly needed by your application.

Pipfile.lock is generated from Pipfile and describes everything that needs to be installed for your application to work, ie your direct dependencies, their dependencies etc.

Answering your questions 1 and 2, you should ship both Pipfile and Pipfile.lock in both scenarios.

However, the installation process will be slightly different.

An end user would need to install the dependencies with pipenv install --deploy to make sure that Pipfile.lock is fresh -- the installation will fail if the lockfile is out of date.

Another developer of your project might install the dependencies with plain pipenv install . If Pipfile.lock is out of date, it will be regenerated during installation.


Answering your question 3: freeze is a pip command, not a pipenv command.

pip freeze prints current contents of your virtual environment in a text format, and its output is typically saved in a file named requirements.txt . If your virtual environment is somehow out of date, its contents will still be output as-is.

pipenv lock builds and outputs the project's dependency list , whether or not they are currently installed. It generates the lockfile under the name Pipfile.lock for further usage with pipenv .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM