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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264904a35af1aeec16e01325dfe68412089361518eabf881baf6ec73ce1978e9 |
|
MD5 | 9c8452523dbb81d199f024fc6a22313b |
|
BLAKE2b-256 | 9c5504f945e65d0f6b871995fe9741f81f48a367c69bfd5ab76c163adaeecd4e |
Hashes for check_requirements_txt-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6534d1e087f1662f75c2a5dba34acafc99229fe31e5b60c1bafdfff51d2ec63c |
|
MD5 | 5f9deb0fc9e1dcfe5a51d170226f22e5 |
|
BLAKE2b-256 | a473832ed018e28afa2019301f54a3c8ca8ef47e44eb885ac10b3a329b20e120 |