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
Tackle box is a tool for making modular code generators and declarative CLIs. It can make any yaml / json file callable by giving users access to a collection of hooks to perform any number of special actions with flow control common to a general purpose programming language.
Warning: Tool is in it's very early phases and only now considered stable enough to use. It may never reach 1.x version as, if it gets enough stars, it will be converted to a spec and re-written in rust (ie give it a star if you'd like to see that).
Install
Note: tackle can install dependencies on its own. Check docs for advanced installation methods to isolate tackle from your system python.
python -m venv env
pip install tackle-box
Hello world
To call tackle, create a yaml file and run tackle hello-world.yaml
.
Use the print hook.
hw->: print Hello world!
Using jinja templating, hooks can be called in four different ways.
words: Hello world!
expanded:
->: print
objects: "{{words}}"
compact->: print {{words}}
jinja_extension->: "{{ print(words) }}"
jinja_filter->: "{{ words | print }}"
Interactive example with prompt hooks.
name->: input
target:
->: select Say hi to who?
choices:
- world
- universe
hello->: print My name is {{name}}. Hello {{target}}!
Hooks can have for loops, conditionals, and other base methods.
words:
- Hello
- cruel
- world!
expanded:
->: print {{item}}
for: keys(words)
if: item != 'cruel'
compact->: print {{item}} --for words --if "item != 'cruel'"
Hooks can be written in python.
from tackle import BaseHook
class Greeter(BaseHook):
hook_type: str = "greeter"
target: str
args: list = ['target']
def exec(self):
print(f"Hello {self.target}")
Or new hooks can be declaratively created with tackle.
greeter<-:
target: str
args: ['target']
exec:
hi->: print Hello {{target}}
And both can be called in the same way.
hello: world!
compact->: greeter {{hello}}
expanded:
->: greeter
target: "{{hello}}"
jinja_extension->: "{{ greeter(hello) }}"
jinja_filter->: "{{ hello | greeter }}"
Or can be imported / called remotely.
local-call->: tackle hello-world.yaml
remote-call->: tackle robcxyz/tackle-hello-world
# Or
import-hello_>: import robcxyz/tackle-hello-world
call->: greeter world!
Creating a web of declarative CLIs.
Topics
- Writing Tackle Files
- Creating Providers
- Blocks and Flow Control - wip
- Memory Management
- Special Variables - wip
- Declarative Hooks
- Declarative CLIs - wip
Roadmap
- Declarative hook inheritance
- Declarative schemas
- Declarative methods
- Cached providers
- State management
Code of Conduct
Everyone interacting in the tackle-box 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
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 tackle-box-0.3.0b1.tar.gz
.
File metadata
- Download URL: tackle-box-0.3.0b1.tar.gz
- Upload date:
- Size: 148.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61026de149619d50e7a7d88836b8f086848d84e8ecf001035826f9e0980dc8fb |
|
MD5 | 54781084470bad9d62594fe41d16a5be |
|
BLAKE2b-256 | c83f6fb4d68a9e35ef6adb96073e1fb0a6ced0e6cb114c1a04b8d6ad2d76a0bc |
File details
Details for the file tackle_box-0.3.0b1-py2.py3-none-any.whl
.
File metadata
- Download URL: tackle_box-0.3.0b1-py2.py3-none-any.whl
- Upload date:
- Size: 216.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 092799e9765e959ce5ad7cea4596c107b959e19ef804138af922636c81211c36 |
|
MD5 | 5ea876683bbd29fdb51b74db225289c7 |
|
BLAKE2b-256 | 1e86ecb8248d46b18fa8aecb2fe10e7a46c57eec568f38f18cb03ef4dcdd3243 |