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
Metadata
Release files for reequirements 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reequirements-1.2.1.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reequirements-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / reequirements-1.2.1.tar.gz
| Download URL | reequirements-1.2.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
143f651c54f18b0d3d92a67747f64f0c6e4a3b965c3adedbf54dc0fdacf7c2c2
|
|
BLAKE2b-256 checksum How to use checksums |
ba6a4220c6e015a8a4b30fa6c38f0b223e6c8f5c50cc3d18aae09fe1755d47fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / reequirements-1.2.1-py3-none-any.whl
| Download URL | reequirements-1.2.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10888e43e742310c036aeeebaf43577841ba23e83f055f41e5794076e236a5f6
|
|
BLAKE2b-256 checksum How to use checksums |
285ef9ece9a7eee34a648dc2972160fd554034eb397893021ca66924249c6c7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|