Skip to main content

Output installed Python packages in requirements format, including also hashes of Python packages.

Project description

Output installed Python packages in requirements format, including also hashes of Python packages

Installation

The tool can be installed from GitHub:

pip install git+https://github.com/fridex/pip-preserve.git

You can also consume the published package on PyPI (recommended):

pip install pip-preserve

Usage

After the installation process is successfully done, pip-preserve CLI is available:

pip-preserve --help

By default, the tool uses the current environment to find installed packages and reconstruct a requirements.txt file:

pip-preserve
#
# This file is autogenerated by pip-preserve version 0.0.0 with Python 3.9.9.
#
packaging==23.0 \
  --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2

If you wish to obtain direct URLs of packages installed, you can pass --direct-url flag:

#
# This file is autogenerated by pip-preserve version 0.0.0 with Python 3.9.9.
#
https://files.pythonhosted.org/packages/ed/35/a31aed2993e398f6b09a790a181a7927eb14610ee8bbf02dc14d31677f1c/packaging-23.0-py3-none-any.whl \
  --hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2

If the tool cannot determine from where a package was installed, it will fail. This error can be ignored by supplying --ignore-errors flag. Any errors are turned into warnings that can be reviewed once the tool prints results.

To explicitly point to a site-packages directory, use the --site-packages option.

To get more information about this tool, issue --help.

FAQ

Q: The tool fails or I’m getting warnings similar to the one below and my output is missing some packages:

No provenance_url.json or direct_url.json found

A: You most probably don’t have pip with PEP-710 support. Please install pip with PEP-710 support, for example using this patch).

License

See the LICENSE file.

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

pip-preserve-0.0.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

pip_preserve-0.0.1-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

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