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 run(self, context):
        logging.info(f"Hello {self.username}")

        # output
        context["greetings"] = f"Hello {context['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-0.10.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file py-executable-checklist-0.10.2.tar.gz.

File metadata

  • Download URL: py-executable-checklist-0.10.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.10 Linux/5.11.0-1028-azure

File hashes

Hashes for py-executable-checklist-0.10.2.tar.gz
Algorithm Hash digest
SHA256 b5d13bf543be3d8cc0ffeac97b01864d78cc1ce872719d6db433b6406908c9b1
MD5 49554d0412e39a2ac987ad8e9cf75b60
BLAKE2b-256 34334c5c4f94b1815018180fadd9058a1ff87e93da95d13cbd567ed2ae6b8e32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_executable_checklist-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84fcf4053160533ded068223554a69c9be3734fa27d025340b3b42e1db21f2c9
MD5 92be6db8b9f9bad1a2b9d642733b0835
BLAKE2b-256 8752634518cea5383b1967f86af7f3c3473e7caf7b343f0d9b8e2887ef72cb45

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