Skip to main content

Generate requirements[-dev].txt from Pipfile using pipenv

Project description

https://travis-ci.org/gsemet/pipenv-to-requirements.svg?branch=master Pypi package MIT licensed

Generate requirements[-dev].txt from Pipfile (using pipenv).

Rational

Pipfile and its sibling Pipfile.lock are clearly superior tools defining clear dependencies or a package. Pipfile is to be maintained by the package’s developer while Pipfile.lock represent a clear image of what is currently installed on the current system, guarantying full reproductibility of the setup. See more information about Pipfile format here. Most of the time, Pipfile.lock should be ignored (ie, not tracked in your git) for packages published on Pypi.

pipenv is a great tool to maintain Pipfile, but developers might be stuck with backward compatibility issues for tools and services that still use requirements.txt and does not know how to handle Pipfile or Pipfile.lock yet.

For examples:

  • ReadTheDocs

  • Pyup (experimental support is arriving )

  • Any library that uses PBR (*)

  • pip install (if you install a package with pip that does not have a requirements.txt, its dependencies won’t be installed, even if you use Pipfile)

(*): for the moment, I recommend to use generate at least requirements.txt (without version freeze) for the libraries using PBR that you publish on Pypi. This allows automatic installation of the very dependencies of your package. Without this file, your package will be installed by pip without its dependencies. Support in PBR may be added in the future (see this this patch ).

Usage

Just before building source/binary/wheel package of your python module, only of the following commands:

  • To generate requirements files (ie, dependencies are described eventually by range):

    pipenv run pipenv_to_requirements
  • To generate frozen requirements (ie, all dependencies have their version frozen):

    pipenv run pipenv_to_requirements -f

It will generate requirements.txt and, if applicable, requirements-dev.txt, in the current directory.

ReadTheDocs

Simply commit these files in your tree so that readthedocs, and ensure they are synchronized each time you change your Pipfile. Do not forget to ask ReadTheDocs to use requirements-dev.txt when building the documentation.

Contributing

Create your development environment with

$ make dev

Execute unit tests:

$ make test

Code formatter:

$ make style

Code Style Checks:

$ make check

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

pipenv-to-requirements-0.4.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

pipenv_to_requirements-0.4.0-py2.py3-none-any.whl (8.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pipenv-to-requirements-0.4.0.tar.gz.

File metadata

File hashes

Hashes for pipenv-to-requirements-0.4.0.tar.gz
Algorithm Hash digest
SHA256 175144c7367e906c46a126037d320498879cd8a1a1be40807131d6084db0c351
MD5 0b8052e6aac7f74ed72dcaac2953ca21
BLAKE2b-256 55e3c7a525c133ee24153ecd2a8e6d80647cd6b3a5910d8dae1732605cacb664

See more details on using hashes here.

File details

Details for the file pipenv_to_requirements-0.4.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pipenv_to_requirements-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4e881b0cc01bdae49c7780a5a4273f7023744e4bdb838b3a677ab9d22decd893
MD5 c77993e6485cc1248bd019c98f09d1e8
BLAKE2b-256 ddc963daa1d51d7d6525e31d0f5811acf57fd5d1476c40d849a330342abecf76

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