以requirements格式输出已安装的Python包,包括Python包的哈希值。
项目描述
以requirements格式输出已安装的Python包,包括Python包的哈希值
安装
此工具可以从GitHub安装
pip install git+https://github.com/fridex/pip-preserve.git
您还可以使用PyPI上发布的包(推荐)
pip install pip-preserve
使用方法
安装过程成功完成后,pip-preserve CLI即可使用
pip-preserve --help
默认情况下,该工具使用当前环境查找已安装的包并重建一个requirements.txt文件
$ pip-preserve --ignore-errors
#
# This file is autogenerated by pip-preserve version 0.0.1 with Python 3.9.13.
#
click==8.1.3 \
--hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48
daiquiri==3.2.1 \
--hash=sha256:b797a7ac94219dc26ef8ebf04f1f507eefa83a7d174e9eb41acc33e3ebf16f38
# micropipenv==1.5.0 installed using a direct URL
git+https://github.com/thoth-station/micropipenv@8176862ec96df23e152938659d6f45645246e398
packaging==23.0 \
--hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2
# pip==23.1.dev0 installed using a direct URL
file:///Users/user/git/fridex/pip
# pip-preserve==0.0.1 installed using a direct URL
-e file:///Users/user/git/fridex/pip-preserve
python-json-logger==2.0.7 \
--hash=sha256:f380b826a991ebbe3de4d897aeec42760035ac760345e57b812938dc8b35e2bd
如果您希望获取已安装包的直接URL,可以传递--direct-url标志
$ pip-preserve --direct-url --ignore-errors
2023-04-05 12:36:26,168 [41348] WARNING pip_preserve._lib: No provenance_url.json or direct_url.json found for 'setuptools' in version '58.1.0'
2023-04-05 12:36:26,168 [41348] WARNING pip_preserve._lib: The generated output will miss information from '/Users/user/git/fridex/pip-preserve/.venv/lib/python3.9/site-packages/setuptools-58.1.0.dist-info', please review any missing packages in the output
#
# This file is autogenerated by pip-preserve version 0.0.1 with Python 3.9.13.
#
https://files.pythonhosted.org/packages/c2/f1/df59e28c642d583f7dacffb1e0965d0e00b218e0186d7858ac5233dce840/click-8.1.3-py3-none-any.whl \
--hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48
https://files.pythonhosted.org/packages/43/b0/b916172eee4e946dea7155ed969865c1b2c01c883101e33d1eb0c224a6a0/daiquiri-3.2.1-py3-none-any.whl \
--hash=sha256:b797a7ac94219dc26ef8ebf04f1f507eefa83a7d174e9eb41acc33e3ebf16f38
# micropipenv==1.5.0 installed using a direct URL
git+https://github.com/thoth-station/micropipenv@8176862ec96df23e152938659d6f45645246e398
https://files.pythonhosted.org/packages/ed/35/a31aed2993e398f6b09a790a181a7927eb14610ee8bbf02dc14d31677f1c/packaging-23.0-py3-none-any.whl \
--hash=sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2
# pip==23.1.dev0 installed using a direct URL
file:///Users/user/git/fridex/pip
# pip-preserve==0.0.1 installed using a direct URL
-e file:///Users/user/git/fridex/pip-preserve
https://files.pythonhosted.org/packages/35/a6/145655273568ee78a581e734cf35beb9e33a370b29c5d3c8fee3744de29f/python_json_logger-2.0.7-py3-none-any.whl \
--hash=sha256:f380b826a991ebbe3de4d897aeec42760035ac760345e57b812938dc8b35e2bd
如果工具无法确定包是从哪里安装的,它将失败。可以通过提供--ignore-errors标志来忽略此错误。任何错误都会转换为可以在工具打印结果后审查的警告。
要显式指向一个 site-packages 目录,请使用 --site-packages 选项。
要获取有关此工具的更多信息,请输入 --help。
常见问题解答 (FAQ)
问:工具无法正常工作或我收到类似于以下警告,我的输出中缺少一些包
No provenance_url.json or direct_url.json found
答:您很可能没有启用 PEP-710 支持的 pip。请安装支持 PEP-710 的 pip,例如使用 此补丁(实验性)
pip install git+https://github.com/fridex/pip.git@provenance-url
许可证
请参阅 LICENSE 文件。
项目详情
关闭
pip-preserve-0.0.2.post1.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 3b7ecb2064d293221f1bd7560ca2564af53620fb0b3cdeef9515644993f5ca6a |
|
MD5 | 5a784bf6afea037ada4eccb4376819d8 |
|
BLAKE2b-256 | 0c6485453d196cc521f83dc9ebe0e8ba7ce2ec9f53528f5714fd9fd2c7fc9fad |
关闭
pip_preserve-0.0.2.post1-py3-none-any.whl 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 2f0a8c2b5c4724711b046ff506ccc2ffa010f21f81812ee51794920baf3c1901 |
|
MD5 | 1de99518940baf50b8f6a0da7b72847e |
|
BLAKE2b-256 | fddbb94c8131a20065ee4f4450b8d6d86844cf68784efd024490e739bd967311 |