Skip to main content

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

Project description

pipfile-freeze

CLI tool to covert 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 virtualenvs 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. 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.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipfile_freeze-0.1.2-py3.7.egg (8.1 kB view details)

Uploaded Egg

File details

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

File metadata

  • Download URL: pipfile-freeze-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pipfile-freeze-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bf7caf825f01ad90db42116a16b15aab1263920c077f81d8f04be8650fdd8cee
MD5 ebe148bdf7c075c1d7ea7e18981fa84d
BLAKE2b-256 c14b34f5ca9f7f5b21c4dd6d6cf7872819617445476978d35cacf479586aae75

See more details on using hashes here.

File details

Details for the file pipfile_freeze-0.1.2-py3.7.egg.

File metadata

  • Download URL: pipfile_freeze-0.1.2-py3.7.egg
  • Upload date:
  • Size: 8.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pipfile_freeze-0.1.2-py3.7.egg
Algorithm Hash digest
SHA256 242232e704cb872cce4fa88a0110fcf87aeb140378553048e6f91559a07372b5
MD5 24174c33f4fc900c9b7d7cc9b5de2735
BLAKE2b-256 da41b025fd2d4c0b25fb572cddccd997d3a77eb809107c835709eee94538f104

See more details on using hashes here.

Supported by

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