Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to freeze a requirement with pipenv?

Tags:

For example we have some pipfile (below) and I'd like to freeze the django version. We don't have a requirements.txt and we only use pipenv. How can I freeze the django version?

[[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi"  [packages] django = "*"  [dev-packages] black = "*"  [requires] python_version = "3.6" 
like image 731
arshbot Avatar asked Aug 14 '18 16:08

arshbot


People also ask

How do I freeze pip requirements?

The most common command is pip freeze > requirements. txt , which records an environment's current package list into requirements. txt. If you want to install the dependencies in a virtual environment, create and activate that environment first, then use the Install from requirements.

What does Pipenv lock do?

$ pipenv lock is used to create a Pipfile. lock , which declares all dependencies (and sub-dependencies) of your project, their latest available versions, and the current hashes for the downloaded files. This ensures repeatable, and most importantly deterministic, builds.

Does Pipenv use requirements txt?

That said, pipenv supports generating a requirements. txt from a Pipfile. lock at any time, (we could just generate it at build time) so it wouldn't be an insurmountable problem. It states that it uses the requirements.


1 Answers

Pipenv do natively implement freezing requirements.txt. It is as simple as:

pipenv lock -r > requirements.txt 
like image 160
Aratz Manterola Lasa Avatar answered Sep 28 '22 16:09

Aratz Manterola Lasa