Skip to main content

A CLI tool to convert Pipfile/Pipfile.lock to requirments.txt

Project description

pipfile-freeze

English | 简体中文

CLI tool to convert Pipfile/Pipfile.lock to requirments.txt

Required Python version

>=2.7, >=3.4

What does it do?

The tool is built on top of requirementslib to provide a simple CLI to convert the Pipenv-managed files to requirements.txt.

Pipenv is a great tool for managing virtualenv and dependencies, but it may be not that useful in deployment. Pip installation is much faster than Pipenv manipulation, since the latter needs extra requests to PyPI for hash checking. Installing a Pipenv in deployment may be overkilled, especially using docker to deploy. We just need a requirements.txt to tell CI or production server which packages and versions should be installed.

Installation

$ pip install pipfile-freeze

An executable named pipfile will be ready for use in the bin path.

Examples:

Output requirements directly to the console:
$ pipfile freeze

Output requirements to the file, default './requirements.txt' with -o:
$ pipfile freeze -o
$ pipfile freeze -o /path/requirements.txt

Specify a project root path
$ pipfile freeze -p myproject

Complex example
$ pipfile freeze -p myproject --hashes -d -o /path/requirements.txt

If your Pipfile like this:

[[source]]
name = "tuna"
url = "http://pypi.tuna.tsinghua.edu.cn/simple"
verify_ssl = true

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
requests = "*"
ilogger = "==0.1"
apscheduler = "*"
pywinusb = {version = "1.1", sys_platform = "== 'win32'"}

[requires]
python_version = "3.7"

Here is the output (requirements.txt):

--index-url http://pypi.tuna.tsinghua.edu.cn/simple
--trusted-host pypi.tuna.tsinghua.edu.cn
--extra-index-url https://pypi.org/simple

apscheduler
ilogger==0.1
pywinusb; sys_platform == 'win32'
requests

Usage:

$ pipfile freeze --help
usage: pipfile freeze [-h] [-p PROJECT] [--hashes] [-d] [-o [file]] [file]

positional arguments:
  file                  The file path to convert, support both Pipfile and
                        Pipfile.lock. If it isn't given, will try Pipfile.lock
                        first then Pipfile.

optional arguments:
  -h, --help            show this help message and exit
  -p PROJECT, --project PROJECT
                        Specify another project root
  --hashes              whether to include the hashes
  -d, --dev             whether to choose both develop and default packages
  -o [file], --outfile [file]
                        Output requirements to the file
                        

License

MIT

This tool is improved based on the pipfile-requirements tool, thanks to @frostming for his contribution.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipfile-freeze-0.1.4.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file pipfile-freeze-0.1.4.tar.gz.

File metadata

  • Download URL: pipfile-freeze-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for pipfile-freeze-0.1.4.tar.gz
Algorithm Hash digest
SHA256 46d79b1ddf6a540163de04417ef7e7aa3965bece8f886adf685f14aabf52fb86
MD5 b18c3aa59f38cc683dd383eb0e325cfb
BLAKE2b-256 8b72ae964e77fcee771c98eed42efbdecd0f310f6c7de6e2386515e8d7625cc2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page