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 Distributions
Built Distribution
File details
Details for the file check_requirements_txt-1.2.3-py3-none-any.whl
.
File metadata
- Download URL: check_requirements_txt-1.2.3-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06a36a3db84f7c67c4758b4513f2189a24c952c0904a31a62b7fb911464756b3 |
|
MD5 | 007224514512d9fd35cb99c8509a01a8 |
|
BLAKE2b-256 | cd99336f2083b6f3951ec7a9af6843f24c09cb12fc6fc810253a397e77d43c45 |