Check the missing packages in requirements.txt
Project description
check-requirements-txt
A tool (and also a pre-commit hook) to automatically check the missing packages in requirements.txt.
Install
First install this package into current python env
pip install check-requirements-txt
Then set up pre-commit
hooks
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
NOTE:
Due to the pre-commit isolated pyenv runtime, this package can't be act as a normal git repo pre-commit hooks.
If the project's requirements.txt does not match pattern
*requirement*.txt
, you'll need to specify it.
default_stages: [commit]
repos:
- repo: local
hooks:
- id: check-requirements-txt
name: check-requirements-txt
description: Check the missing packages in requirements.txt.
entry: check-requirements-txt
args: ['--dst_dir', '.', '--ignore', 'pip,whatever,modules,you,want,to,ignore,with,comma,separated']
language: python
types: [python]
check-requirements-txt
can be used as a normal cli tool, see check-requirements-txt --help
for more details.
Output sample
Bad import detected: "bs4"
/Users/ferstar/PycharmProjects/xxx_demo/xxx_spider.py:12
Bad import detected: "requests"
/Users/ferstar/PycharmProjects/xxx_demo/xxx_handler.py:17
"numpy" required by: {'numpy', 'scikit-learn', 'tensorflow', 'pandas'}
# NOTE: the output of cli is the total bad import count
~ echo $?
~ 2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for check_requirements_txt-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8fcaf5fd4adf10b88ec2798e84e29ec8e2ea81acddebd4c15490a2a1ef5e6a |
|
MD5 | 811b06b24dc58dcd0b78d318c6233fcb |
|
BLAKE2b-256 | 86c2fb7c64bce1c9b178f8e66429cf458e2478fb85db6eb928a6786444aaaf07 |