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.
Table of Contents
Installation
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
License
check-requirements-txt
is distributed under the terms of the MIT license.
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 Distribution
Built Distribution
Hashes for check_requirements_txt-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77d9b639eadb470931de72e7a507bef1e010e7ca930aa26208c049d2836b1e3a |
|
MD5 | 4c0845d9f35a91bc1a3d4e5e9ff34cd6 |
|
BLAKE2b-256 | a631d85b0f25fb1fddf33a50b78712e0100a01254671397d5830f5992aec0084 |
Hashes for check_requirements_txt-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a312c289099038f8d6c85414df2eb1092e54f8552cce609437bc9bdeb7e071b |
|
MD5 | e3a82f988718243a904a24d940c941ab |
|
BLAKE2b-256 | 722c1ad0e568523413e7f7095af814d8db86f38bbc9b75ae8c66a04f5930c701 |