Library for defining and checking for the status of requirements needed for your Python project
Project description
reequirements
reequirements is a useful library for defining and checking for the status of (not necessarily Python) requirements needed for your Python project.
Usage
Create some Requirement objects. Specify a friendly name for the requirement, a command to be able to check that requirement, and if it should issue a warning or halt the program if it is missing.
from reequirements import Requirement
REQUIREMENTS = [
Requirement("docker", ["docker", "-v"], warn=False)
Requirement("fortune", ["fortune", "-v"], warn=True)
]
Now, iterate through these requirements and check them.
for r in REQUIREMENTS:
r.check()
RequirementMissing will be raised if docker -v exits with exit code 127 (command not found), or the more generic RequirementError will be raised if it exits with any other nonzero exit code.
RequirementMissingWarning will be warned if fortune -v exits with exit code 127 (command not found), or the more generic RequirementErrorWarning will be warned if it exits with any other nonzero exit code.
Tips
- Make sure your commands to check requirements end with the correct exit code! This often means using flags like
-v,-hwhen it comes to command line tools - You do not need to check for requirements right away; you can create
Requirementat any time and check it whenever you want
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reequirements-1.2.1.tar.gz.
File metadata
- Download URL: reequirements-1.2.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
143f651c54f18b0d3d92a67747f64f0c6e4a3b965c3adedbf54dc0fdacf7c2c2
|
|
| MD5 |
5f1a78d60f961f5c9d648e4cfecc133b
|
|
| BLAKE2b-256 |
ba6a4220c6e015a8a4b30fa6c38f0b223e6c8f5c50cc3d18aae09fe1755d47fe
|
File details
Details for the file reequirements-1.2.1-py3-none-any.whl.
File metadata
- Download URL: reequirements-1.2.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10888e43e742310c036aeeebaf43577841ba23e83f055f41e5794076e236a5f6
|
|
| MD5 |
0c144c7623504b31c11d886ce5852fdb
|
|
| BLAKE2b-256 |
285ef9ece9a7eee34a648dc2972160fd554034eb397893021ca66924249c6c7e
|