pipenv-to-requirements
Generate requirements[-dev].txt from Pipfile (using pipenv). Used in my modern Python module project cookiecutter. template.
Free software: MIT
Documentation: https://pipenv-to-requirements.readthedocs.org/en/latest/
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:
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 generate at least requirements.txt (without version freeze) for the libraries using PBR that you publish on Pypi. Remember PBR automatically synchronize the content of requirements.txt found at the root of a package with setup.py of this package. This allows automatic installation of the very dependencies of your package. Without this file, your package will be installed by pip, but its dependencies will be ignored. Support in PBR may be added in the future (see this this patch ).
For build reproductibility, I also recommend to check in your lock file even for libraries, so that your CI won’t fail when new packages is published on Pypi.
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), typically for libraries:
pipenv run pipenv_to_requirementsTo generate frozen requirements (ie, all dependencies have their version frozen), typically for applications:
pipenv run pipenv_to_requirements -f
It will generate requirements.txt and, if applicable, requirements-dev.txt, in the current directory.
Also possible:
pipenv run pipenv_to_requirements -d requirements-dev-custom.txt pipenv run pipenv_to_requirements -d requirements-dev-custom.txt -f pipenv run pipenv_to_requirements -o requirements-custom.txt pipenv run pipenv_to_requirements -o requirements-custom.txt -f pipenv run pipenv_to_requirements -d requirements-dev-custom.txt -o requirements-custom.txt -f
Example using a Makefile:
dev:
pipenv install --dev
pipenv run pip install -e .
dists: requirements sdist bdist wheels
requirements:
# For a library, use:
pipenv run pipenv_to_requirements
# For an application, use:
# pipenv run pipenv_to_requirements -f
sdist: requirements
pipenv run python setup.py sdist
bdist: requirements
pipenv run python setup.py bdist
wheels: requirements
pipenv run python setup.py bdist_wheel
Just use make requirements to refresh the requirements.txt.
Read the Docs
Simply commit these files in your tree so that Read the Rocs, and ensure they are synchronized each time you change your Pipfile. Do not forget to ask Read the Docs 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
Metadata
Release files for pipenv-to-requirements 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pipenv-to-requirements-0.9.0.tar.gz | 28.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pipenv_to_requirements-0.9.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 41.3 kB
Release files / pipenv-to-requirements-0.9.0.tar.gz
| Download URL | pipenv-to-requirements-0.9.0.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb70471a17a7d4658caffe989539413313d51df1b3a54838bcd7e7d3ab3fcc18
|
|
BLAKE2b-256 checksum How to use checksums |
ca108d4429dfe9b6cb0b43aab73a5750d3cf85ec74d37d707673e9ec946bc841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9
|
Release files / pipenv_to_requirements-0.9.0-py2.py3-none-any.whl
| Download URL | pipenv_to_requirements-0.9.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1c18682a4ec70eb07261d2b558df3ee22ea00192663a1b98fd1e45e22946c163
|
|
BLAKE2b-256 checksum How to use checksums |
762f2be05e91ebd752dee74ab87796801b1ca1ce94718635558c0847b5199594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9
|
Security for pipenv-to-requirements 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.