Skip to main content

Tackle box is a declarative DSL for building modular workflows and code generators. Tool is plugins based and can easily be extended by writing additional hooks or importing external providers creating a web of interoperable CLIs.

Project description

Tackle Box

pypi python codecov main-tests

Tackle box is a DSL for turning static configuration files into dynamic workflows. Tool is plugins based and can easily be extended by writing additional hooks or importing external providers.

Demo

pip3 install tackle-box

# Create a new provider in one minute
tackle robcxyz/tackle-provider

# Push to github and now you can call it directly
tackle <your GH username>/<tackle-your-provider>

# Or alternatively create a tackle file
echo '
name->: input What is your name?
print->: print Hi {{name}}, lets make a provider now!
call->: tackle robcxyz/tackle-provider
' > tackle.yaml
tackle

Features

  • Modular: New providers / hooks can be created or imported remotely
  • Declarative: Everything is in yaml with easy to use interfaces
  • Turing complete: Loops, conditionals and branching is supported
  • Lean: Tackle box has only 4 dependencies - core logic <1k LOC

Usage

Tackle-box in its simplest form is a structured data parser taking in arbitrary yaml or json and only applying logic with keys ending in an arrow (ie '->'). By default, tackle looks for a tackle.yaml file in the target location which is parsed sequentially with each key / value or item in a list traversed, parsed, and rendered on hook calls indicated by an arrow (->). Tackle box ships with ~70 hooks to do basic prompting / code generation / system operations but can easily be extended by writing additional hooks or importing other providers.

Provider Structure

For instance given the following directory structure:

├── hooks
│ └── stuff.py
└── tackle.yaml

With stuff.py looking like:

from tackle import BaseHook

class Stuff(BaseHook):
    hook_type: str = "do-stuff"
    things: str
    _args: list = ['things']

    def execute(self):
        return self.things.title()

One could write a tackle.yaml that looks like this:

compact->: do-stuff a string
expanded:
  if: compact == 'A String'
  ->: do-stuff
  things: "{{compact}} That Renders!"

Which if you call tackle in that directory would result in the following context:

compact: A String
expanded: A String That Renders!

Which you can use to then generate code, print out to file, or do any number of custom actions with additional hook calls or calls to other tackle providers. For instance if you wanted to use it in another tackle provider and generate code, you would use:

remote_call->: tackle robcxyz/tackle-do-stuff  # Fictitious repo
gen->: generate path/to/jinja/templates output/path

Which would result in the same context embedded under the remote_call key and would be used to generate files / directories of templates to the output path.

Road Map

The main challenge with this project is going to be reaching a stable syntax that people can reliably build on. Until that happens any feedback is welcome both on the core parsing logic or hook interfaces. A place outside of github issues will be made to better accommodate those conversations.

Code of Conduct

Everyone interacting in the Cookiecutter project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

Credit

Special thanks to the cookiecutter community for laying the basis for this project.

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

tackle-box-0.2.1a2.tar.gz (124.0 kB view details)

Uploaded Source

Built Distribution

tackle_box-0.2.1a2-py2.py3-none-any.whl (180.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tackle-box-0.2.1a2.tar.gz.

File metadata

  • Download URL: tackle-box-0.2.1a2.tar.gz
  • Upload date:
  • Size: 124.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for tackle-box-0.2.1a2.tar.gz
Algorithm Hash digest
SHA256 5174e27efbc6fccde2e7745c31d9a7fd3adee3ca0b500d5cd36cd17d24b775c0
MD5 4fe28de297eb44747126c8cf4e5733dc
BLAKE2b-256 92262daefea84fcf95bad40f473e031c83e02728a61eab0b600dfe8e41431f6a

See more details on using hashes here.

File details

Details for the file tackle_box-0.2.1a2-py2.py3-none-any.whl.

File metadata

  • Download URL: tackle_box-0.2.1a2-py2.py3-none-any.whl
  • Upload date:
  • Size: 180.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for tackle_box-0.2.1a2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0330401a1ec41cf2688842f6636bc9d4011d79e2b2e804eb083101a2ec96999e
MD5 3f3ffbb3f375eb9ee94048fe41ac02c3
BLAKE2b-256 d8aaece1b9428f82a4ad3689fdd7ebc48ab6bb7278c466321d00d4559cdb62f4

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