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
- Documentation (WIP)
- PyPI
- BSD License
Tackle box is a language for making modular declarative CLIs. It can make any yaml/json configuration file dynamic/callable with turing complete flow control common to any general purpose programming language.
Warning: Language is in it's 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 another language (ie give it a star if you'd like to see that).
- Install
- Use Cases
- Hello world
- Advanced Topics
- Contributing
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
Use Cases
- Modular code generation - wip
- Kubernetes management - wip
- Declarative toolchains - wip
- Declarative utilities - wip
Hello worlds
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: 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<-:
help: A thing that says hi!
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
- Memory Management
- Declarative CLIs
- Declarative Hooks
- Special Variables
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.0a0.tar.gz
.
File metadata
- Download URL: tackle-box-0.3.0a0.tar.gz
- Upload date:
- Size: 136.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18622f35c6a4363509a58ffd40a4243d01c060c1180ad3a49cca1a39b5a7274 |
|
MD5 | a352dbd368721691abc2962bc7dbbb75 |
|
BLAKE2b-256 | 205d89fa21c2487fd76d7846adfccf7bbfa257d7087c38b855d4eff94c984c09 |
File details
Details for the file tackle_box-0.3.0a0-py2.py3-none-any.whl
.
File metadata
- Download URL: tackle_box-0.3.0a0-py2.py3-none-any.whl
- Upload date:
- Size: 199.5 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 | cd732a3e3bbb13c363e076a41b5e5314deae329848752193cc818f360391b28c |
|
MD5 | 2cd176df6561206da2f7947a99066dc4 |
|
BLAKE2b-256 | 2c38eebf212e359705d9506ef80892d9611b13767d1c45ba0dcf0b81ac5f5b17 |