Helper classes to develop executable workflow scripts
Project description
Executable Workflow
Documentation: https://namuan.github.io/py-executable-checklist
Source Code: https://github.com/namuan/py-executable-checklist
PyPI: https://pypi.org/project/py-executable-checklist/
Helper classes to develop executable workflow scripts
Installation
pip install py-executable-checklist
Example Usage
import logging
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from py_executable_checklist.workflow import run_workflow, WorkflowBase
# Common functions across steps
# Workflow steps
class DoSomething(WorkflowBase):
"""
Go to this page
Copy the command
Run the command
Copy the output and paste it into the email
"""
username: str
def execute(self):
logging.info(f"Hello {self.username}")
# output
return {"greetings": f"Hello {self.username}"}
# Workflow definition
def workflow():
return [
DoSomething,
]
# Boilerplate
def parse_args():
parser = ArgumentParser(
description=__doc__, formatter_class=RawDescriptionHelpFormatter
)
parser.add_argument("-u", "--username", type=str, required=True, help="User name")
parser.add_argument(
"-v",
"--verbose",
action="store_true",
default=False,
dest="verbose",
help="Display context variables at each step",
)
return parser.parse_args()
def main(args):
context = args.__dict__
run_workflow(context, workflow())
if __name__ == "__main__":
args = parse_args()
main(args)
Development
- Clone this repository
- Requirements:
- Poetry
- Python 3.7+
- Create a virtual environment and install the dependencies
poetry install
- Activate the virtual environment
poetry shell
Validating build
make build
Release process
A release is automatically published when a new version is bumped using make bump
. See .github/workflows/build.yml
for more details. Once the release is published, .github/workflows/publish.yml
will automatically publish it to PyPI.
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 Distribution
Built Distribution
File details
Details for the file py_executable_checklist-1.3.1.tar.gz
.
File metadata
- Download URL: py_executable_checklist-1.3.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.16 Linux/5.15.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50474fc08e70921221d493a8f943e976b367a0029acf5639c00a7c5f659eb4fd |
|
MD5 | 490cfb1004bdf42455574e22940d04dd |
|
BLAKE2b-256 | 96c7f363be0e486e74dec5034e7d93a0c3728b5ffa7a837eb7d63a6eaa84422c |
File details
Details for the file py_executable_checklist-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: py_executable_checklist-1.3.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.16 Linux/5.15.0-1024-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6434be0110366d5d7e95d78317a1c87ea52cfd2f585e71f71e768a7fbd9c997b |
|
MD5 | 983ddb7f77bd11424ea35054a1b1a42d |
|
BLAKE2b-256 | ff564b8e2e5096898c5fb5cbdc8e08a73e44d83c0b9e49a745bdc095a04220b5 |