Skip to main content

Jiggy Playbook Linter

Project description

JiggyPlaybookLinter

Build Status Coverage Status Code style: black PyPI

Description

Use Jiggy? Want to validate your playbook before deploying a pipeline? jpl or the JiggyPlaybookLinter allows you to validate your JiggyPlaybook outside of an execution.

Installation

From Source

$ git clone https://github.com/thejig/jpl.git
$ cd jpl
$ python3.7 -m venv venv
$ source venv/bin/activate
$ pip install -e .

From Build

$ pip install jpl

Usage

Via CLI

  • jpl has a CLI for easy usage
$ jpl --help

Usage: jpl [OPTIONS]

  Click CLI entrypoint to run JiggyPlaybookLint.

  CLI Args:
  -v --verbose: Run `jpl` with verbosity.
  -s --skip: Skip "PASSED" rules in JiggyPlaybookLint Report.
  -p --playbook: Location of JiggyPlaybook to lint.

  Returns:

      click.echo - `with style`

Options:
  -v, --verbose        Run `jpl` with verbosity.
  -s, --skip           Skip `PASSED` rules in jpl report
  -p, --playbook TEXT  Filepath to Jiggy Playbook  [required]
  --help               Show this message and exit.

A minimal test case

$ jpl -v -p examples/jiggy-playbook.yml
   __        ______      __
  /\ \      /\  == \    /\ \
 _\_\ \     \ \  _-/    \ \ \____
/\_____\     \ \_\       \ \_____\
\/_____/iggy  \/_/laybook \/_____/inter

[F01] FunctionSourceExists - get-weekday:         FAILED      Declared path to function: `examples.utils.dates.GetWeekdayTask` does not exist.

Via python client with .validate()

import jpl

>>> client = jpl.JiggyPlaybookLint(path="path/to/playbook")
>>> result = client.validate()

The validate() method will return a tuple

The tuple denotes the validity of the playbook and the failing rules as JiggyRule objects

(False, [<JiggyRule: F01>, <JiggyRule: F01>, <JiggyRule: F01>, <JiggyRule: F01>, <JiggyRule: F01>, <JiggyRule: F01>])

Overview

A JiggyPlaybook is broken down into chunks

  • Playbook

    • The entire .yml constitutes the "playbook"
  • Pipeline

    • The key pipeline including all tasks constitutes the "pipeline"
  • Task

    • Tasks are chunks of a pipeline having the below attributes:
      • name
      • description
      • function which contains source, params, output
      • requires
name: Hello, world!
author: me@jiggy.dev
description: Show off the usage of jpl
version: 0.0.1

pipeline:
  runner: sequential
  secrets:
    location: examples/secrets/.env-example
    source: jiggy.EnvSecrets
  tasks:

  - name: print-something
    description: Print something
    function:
      source: examples.utils.string_manipulation.PrintThis
      params:
      - type: str
        value: 'THIS PIPELINE IS GREAT'
      output: null
    requires: null

Rules

Etymology:

JiggyRule - JiggyRule.rule consists of 3 characters (i.e.) X01

  • X: (char) - letter describes corresponding ruleset

  • 0: (digit) - incrementing based on third digit

  • 0: (digit) - incrementing

Examples:

Rule: PlaybookHasName

  • rule.rule = I (info) 0 (base 10) 1 (rule number 1)

Rule: PipelineHasDescription

  • rule.rule = P (pipeline) 0 (base 10) 1 (rule number 1)

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

jpl-0.0.3.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

jpl-0.0.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file jpl-0.0.3.tar.gz.

File metadata

  • Download URL: jpl-0.0.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.0

File hashes

Hashes for jpl-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3b9e6b6bb8cea4a7f12aec6ada6a44145a42be0d4439626548f808f0f21fd9ed
MD5 d51998b208d50d88835f91805d8f8d3c
BLAKE2b-256 f2fe9d31e5afc9616bee11cdbfda0a29a2d38451173b46b27ff41146ee74216f

See more details on using hashes here.

File details

Details for the file jpl-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: jpl-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.0

File hashes

Hashes for jpl-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2d23b83f3c34b0530c2404f7002bf3b8e71ce840f4547f47fed8abe8fab8ffb8
MD5 3436d03f5dfc4dc4df74002e7fd22335
BLAKE2b-256 d1aeb6b1031a6cba5b683c2df092c396e58ade9314a67beffdaf6d44e6cfdf00

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