Skip to main content

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, -h when it comes to command line tools

  • You do not need to check for requirements right away; you can create Requirement at 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

reequirements-1.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

reequirements-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file reequirements-1.0.0.tar.gz.

File metadata

  • Download URL: reequirements-1.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for reequirements-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5bfe365ee2b529ef98ad3adcc36439ac0d8bd093f91ca3f0fe2f714e37f18364
MD5 842e246c8362a6a75a839ebe420ffd2c
BLAKE2b-256 26b6e07f713fb8a5de909337b4a2837e220b36644f64cd1046e6d5702a608a36

See more details on using hashes here.

File details

Details for the file reequirements-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: reequirements-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for reequirements-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c701e988dd2ad483e52b35b565d32f2fb5e1c4a284b770b6dda04c195f4c40
MD5 1c555f9c5896cd40fa76c5cf8e4d88f3
BLAKE2b-256 7ac79edc98ca8fa785e876c99998c8ead4f735b033ef42bc7f2af739f3b440b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page