<!-- markdownlint-disable -->
<p align="center">
<a href="https://github.com/DevelopersToolbox/">
<img src="https://cdn.wolfsoftware.com/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png" alt="DevelopersToolbox logo" />
</a>
<br />
<a href="https://github.com/DevelopersToolbox/check-prerequisite/actions/workflows/cicd.yml">
<img src="https://img.shields.io/github/actions/workflow/status/DevelopersToolbox/check-prerequisite/cicd.yml?branch=master&label=build%20status&style=for-the-badge" alt="Github Build Status" />
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/blob/master/LICENSE.md">
<img src="https://img.shields.io/github/license/DevelopersToolbox/check-prerequisite?color=blue&label=License&style=for-the-badge" alt="License">
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite">
<img src="https://img.shields.io/github/created-at/DevelopersToolbox/check-prerequisite?color=blue&label=Created&style=for-the-badge" alt="Created">
</a>
<br />
<a href="https://github.com/DevelopersToolbox/check-prerequisite/releases/latest">
<img src="https://img.shields.io/github/v/release/DevelopersToolbox/check-prerequisite?color=blue&label=Latest%20Release&style=for-the-badge" alt="Release">
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/releases/latest">
<img src="https://img.shields.io/github/release-date/DevelopersToolbox/check-prerequisite?color=blue&label=Released&style=for-the-badge" alt="Released">
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/releases/latest">
<img src="https://img.shields.io/github/commits-since/DevelopersToolbox/check-prerequisite/latest.svg?color=blue&style=for-the-badge" alt="Commits since release">
</a>
<br />
<a href="https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/CODE_OF_CONDUCT.md">
<img src="https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge" />
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/CONTRIBUTING.md">
<img src="https://img.shields.io/badge/Contributing-blue?style=for-the-badge" />
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/SECURITY.md">
<img src="https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge" />
</a>
<a href="https://github.com/DevelopersToolbox/check-prerequisite/issues">
<img src="https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge" />
</a>
</p>
## Overview
When you write a script or tool which uses subprocess to execute shell commands, you want to know if the commands are installed or not. This is
particularly important if you are running multiple commands which rely on each other.
You can of course catch the exceptions through using `check=True` but if you need to know they all exist before you start your execution run then
this doesn't help you as it only handled the failure it currently has.
This little package assist with that problem by taking a list of commands that must be installed and available and verifies that list at the start to
ensure all of them are available.
## Installation
```shell
pip install wolfsoftware.prereqs
```
## Usage
```python
import sys
from wolfsoftware.prereqs import check_prerequisite, PrerequisiteCheckError
prerequisites: list[str] = ["python", "git"]
try:
command_paths: dict = check_prerequisite(prerequisites)
except PrerequisiteCheckError as err:
print("Prerequisite check failed:")
for error in err.errors:
print(error)
sys.exit(0)
print(command_paths['python'])
```
Once the checks have completed, you now have a dict of commands and their associated paths which you can then utilise to ensure you are executing
your subprocesses with the full path.
<br />
<p align="right"><a href="https://wolfsoftware.com/"><img src="https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge" /></a></p>
Raw data
{
"_id": null,
"home_page": "https://github.com/DevelopersToolbox/check-prerequisite-package",
"name": "wolfsoftware.prereqs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "python, prereqs",
"author": "Wolf Software",
"author_email": "pypi@wolfsoftware.com",
"download_url": "https://files.pythonhosted.org/packages/d4/f0/9301834900202d97858c34be9b7278960a29667431cef39ad431777b2132/wolfsoftware_prereqs-0.1.5.tar.gz",
"platform": null,
"description": "<!-- markdownlint-disable -->\n<p align=\"center\">\n <a href=\"https://github.com/DevelopersToolbox/\">\n <img src=\"https://cdn.wolfsoftware.com/assets/images/github/organisations/developerstoolbox/black-and-white-circle-256.png\" alt=\"DevelopersToolbox logo\" />\n </a>\n <br />\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/actions/workflows/cicd.yml\">\n <img src=\"https://img.shields.io/github/actions/workflow/status/DevelopersToolbox/check-prerequisite/cicd.yml?branch=master&label=build%20status&style=for-the-badge\" alt=\"Github Build Status\" />\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/blob/master/LICENSE.md\">\n <img src=\"https://img.shields.io/github/license/DevelopersToolbox/check-prerequisite?color=blue&label=License&style=for-the-badge\" alt=\"License\">\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite\">\n <img src=\"https://img.shields.io/github/created-at/DevelopersToolbox/check-prerequisite?color=blue&label=Created&style=for-the-badge\" alt=\"Created\">\n </a>\n <br />\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/releases/latest\">\n <img src=\"https://img.shields.io/github/v/release/DevelopersToolbox/check-prerequisite?color=blue&label=Latest%20Release&style=for-the-badge\" alt=\"Release\">\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/releases/latest\">\n <img src=\"https://img.shields.io/github/release-date/DevelopersToolbox/check-prerequisite?color=blue&label=Released&style=for-the-badge\" alt=\"Released\">\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/releases/latest\">\n <img src=\"https://img.shields.io/github/commits-since/DevelopersToolbox/check-prerequisite/latest.svg?color=blue&style=for-the-badge\" alt=\"Commits since release\">\n </a>\n <br />\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/CODE_OF_CONDUCT.md\">\n <img src=\"https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/CONTRIBUTING.md\">\n <img src=\"https://img.shields.io/badge/Contributing-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/blob/master/.github/SECURITY.md\">\n <img src=\"https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/DevelopersToolbox/check-prerequisite/issues\">\n <img src=\"https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge\" />\n </a>\n</p>\n\n## Overview\n\nWhen you write a script or tool which uses subprocess to execute shell commands, you want to know if the commands are installed or not. This is\nparticularly important if you are running multiple commands which rely on each other.\n\nYou can of course catch the exceptions through using `check=True` but if you need to know they all exist before you start your execution run then\nthis doesn't help you as it only handled the failure it currently has.\n\nThis little package assist with that problem by taking a list of commands that must be installed and available and verifies that list at the start to\nensure all of them are available.\n\n## Installation\n\n```shell\npip install wolfsoftware.prereqs\n```\n\n## Usage\n\n```python\nimport sys\n\nfrom wolfsoftware.prereqs import check_prerequisite, PrerequisiteCheckError\n\nprerequisites: list[str] = [\"python\", \"git\"]\n\ntry:\n command_paths: dict = check_prerequisite(prerequisites)\nexcept PrerequisiteCheckError as err:\n print(\"Prerequisite check failed:\")\n for error in err.errors:\n print(error)\n sys.exit(0)\n\nprint(command_paths['python'])\n```\n\nOnce the checks have completed, you now have a dict of commands and their associated paths which you can then utilise to ensure you are executing\nyour subprocesses with the full path.\n\n<br />\n<p align=\"right\"><a href=\"https://wolfsoftware.com/\"><img src=\"https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge\" /></a></p>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Check for the presence of prerequisite commands and returns their paths.",
"version": "0.1.5",
"project_urls": {
"Documentation": "https://github.com/DevelopersToolbox/check-prerequisite-package",
"Homepage": "https://github.com/DevelopersToolbox/check-prerequisite-package",
"Source": "https://github.com/DevelopersToolbox/check-prerequisite-package",
"Sponsor": "https://github.com/sponsors/WolfSoftware",
"Tracker": "https://github.com/DevelopersToolbox/check-prerequisite-package/issues/"
},
"split_keywords": [
"python",
" prereqs"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "43dec1be0999b2114b22e7c976e8313ca3f55eb33e2d243b387258e3cbd3cd85",
"md5": "954ec2551317827ebf8ab59804628e54",
"sha256": "25dba49a0b9599457f449414c7c474ae808cfe05ca7ec86fa668b8b0ef59f0a5"
},
"downloads": -1,
"filename": "wolfsoftware.prereqs-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "954ec2551317827ebf8ab59804628e54",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6865,
"upload_time": "2024-06-26T10:30:22",
"upload_time_iso_8601": "2024-06-26T10:30:22.393084Z",
"url": "https://files.pythonhosted.org/packages/43/de/c1be0999b2114b22e7c976e8313ca3f55eb33e2d243b387258e3cbd3cd85/wolfsoftware.prereqs-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d4f09301834900202d97858c34be9b7278960a29667431cef39ad431777b2132",
"md5": "718cc07bd86e4ea5bec19c47fd856242",
"sha256": "f0e4e54508e2440dd92a2a7c3f5394f07b78d13c7791e0574240b734419eb590"
},
"downloads": -1,
"filename": "wolfsoftware_prereqs-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "718cc07bd86e4ea5bec19c47fd856242",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8413,
"upload_time": "2024-06-26T10:30:23",
"upload_time_iso_8601": "2024-06-26T10:30:23.535933Z",
"url": "https://files.pythonhosted.org/packages/d4/f0/9301834900202d97858c34be9b7278960a29667431cef39ad431777b2132/wolfsoftware_prereqs-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-26 10:30:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DevelopersToolbox",
"github_project": "check-prerequisite-package",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "wolfsoftware.prereqs"
}