Skip to main content

Helper classes to develop executable workflow scripts

Project description

Executable Workflow

PyPI PyPI - Python Version PyPI - License


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:
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_executable_checklist-1.3.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

py_executable_checklist-1.3.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file py_executable_checklist-1.3.0.tar.gz.

File metadata

  • Download URL: py_executable_checklist-1.3.0.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

Hashes for py_executable_checklist-1.3.0.tar.gz
Algorithm Hash digest
SHA256 79d667177589020732538e6a140f710ea8aaa450a0ac86d13528378ecce1dd54
MD5 72bca8977278a48b5ef318156df744dd
BLAKE2b-256 bca7a75759f00f6b99d6fb6fada5c9d25db6377d3453cc7592dae2f9f9481eb7

See more details on using hashes here.

File details

Details for the file py_executable_checklist-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_executable_checklist-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b8ea3f75d5d647e7d08bdf8f985d3fb55b8c800c3554255612d612a545ad641
MD5 a713deb13e80617c45b143db63057d49
BLAKE2b-256 19b5a22d788078eb26865ca1856f50d31c5f8899159c95aa6446b1e6381d7ae9

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