Skip to content

Commit

Permalink
refactor: tackle-box to tackle
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Nov 28, 2022
1 parent 4bbbd23 commit 3977a85
Show file tree
Hide file tree
Showing 60 changed files with 180 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ body:
id: version
attributes:
label: Version
description: What version of tackle-box are you running?
description: What version of tackle are you running?
# TODO: Update this with tackle
options:
- 0.4.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Commit documentation changes
run: |
git clone https://github.com/robcxyz/tackle-box.git --branch docs --single-branch gh-pages
git clone https://github.com/robcxyz/tackle.git --branch docs --single-branch gh-pages
cp -r site/* gh-pages/
cd gh-pages
touch .nojekyll
Expand Down
85 changes: 43 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,76 @@
<img align="right" width="280" height="280" src="https://raw.githubusercontent.com/robcxyz/tackle-box/main/docs/assets/logo-box.png">
<img align="right" width="280" height="280" src="https://raw.githubusercontent.com/robcxyz/tackle/main/docs/assets/logo-box.png">

# tackle-box
# tackle

[![pypi](https://img.shields.io/pypi/v/tackle-box.svg)](https://pypi.python.org/pypi/tackle-box)
[![python](https://img.shields.io/pypi/pyversions/tackle-box.svg)](https://pypi.python.org/pypi/tackle-box)
[![codecov](https://codecov.io/gh/robcxyz/tackle-box/branch/main/graphs/badge.svg?branch=main)](https://codecov.io/github/robcxyz/tackle-box?branch=main)
[![codeql](https://github.com/robcxyz/tackle-box/actions/workflows/codeql.yml/badge.svg)](https://github.com/robcxyz/tackle-box/actions/workflows/codeql.yml)
[![pypi](https://img.shields.io/pypi/v/tackle.svg)](https://pypi.python.org/pypi/tackle)
[![python](https://img.shields.io/pypi/pyversions/tackle.svg)](https://pypi.python.org/pypi/tackle)
[![codecov](https://codecov.io/gh/robcxyz/tackle/branch/main/graphs/badge.svg?branch=main)](https://codecov.io/github/robcxyz/tackle?branch=main)
[![codeql](https://github.com/robcxyz/tackle/actions/workflows/codeql.yml/badge.svg)](https://github.com/robcxyz/tackle/actions/workflows/codeql.yml)
[![Foresight Docs](https://api-public.service.runforesight.com/api/v1/badge/success?repoId=4abde40b-565a-4557-afc0-983461857bb4)](https://docs.runforesight.com/)
[![Foresight Docs](https://api-public.service.runforesight.com/api/v1/badge/test?repoId=4abde40b-565a-4557-afc0-983461857bb4)](https://docs.runforesight.com/)
[![Foresight Docs](https://api-public.service.runforesight.com/api/v1/badge/utilization?repoId=4abde40b-565a-4557-afc0-983461857bb4)](https://docs.runforesight.com/)

[//]: # ([![main-tests]&#40;https://github.com/robcxyz/tackle-box/actions/workflows/main.yml/badge.svg&#41;]&#40;https://github.com/robcxyz/tackle-box/actions&#41;)
[//]: # ([![main-tests]&#40;https://github.com/robcxyz/tackle/actions/workflows/main.yml/badge.svg&#41;]&#40;https://github.com/robcxyz/tackle/actions&#41;)

* [Documentation](https://robcxyz.github.io/tackle-box)
* [Documentation](https://robcxyz.github.io/tackle)
* [Discord](https://discord.gg/7uVUfUVD7K)
* [PyPI](https://pypi.org/project/tackle-box/)
* [PyPI](https://pypi.org/project/tackle/)
* [BSD License](LICENSE)

[//]: # (* [Slack]&#40;https://join.slack.com/t/slack-y748219/shared_invite/zt-1cqreswyd-5qDBE53QlY97mQOI6DhcKw&#41;)

Tackle-box is an experimental DSL for building modular code generators and declarative CLIs. Built as a fork of [cookiecutter](https://github.com/cookiecutter/cookiecutter), it can make any config file into a CLI with both strong and weakly typed programmable flow control common to a general purpose programming language. Basically you can write a fully functional Turing-complete program out of a config file. It's wild.
Tackle is an experimental DSL for building modular code generators and declarative CLIs. Built as a fork of [cookiecutter](https://github.com/cookiecutter/cookiecutter), it can make any config file dynamic or into a CLI with both strong and weakly typed programmable flow control common to a general purpose programming language. Basically you can write a fully functional Turing-complete program out of a config file. It's wild.

**With tackle-box, you can build:**
**With tackle, you can build:**
- Modular code generators / repo scaffolding tools that can be updated over time
- Declarative makefile alternatives for advanced toolchain management
- Interactive glue code for infrastructure-as-code deployment strategies
- Generic utilities like SSH registries and dotfile managers
- Combinations of all of the above and anything else you can think of

> If this project gets enough adoption / stars, it will be re-written in a compiled language. Its current goal is defining the syntax which should remain stable after a rewrite.
[//]: # (- Declarative makefile alternatives for advanced toolchain management)

> If this project gets enough adoption / stars, it will be re-written in a compiled language.
### Features

- Makes arbitrary yaml / json / toml [dynamic](https://robcxyz.github.io/tackle-box/hook-methods/)
- Makes arbitrary yaml / json / toml [dynamic](https://robcxyz.github.io/tackle/hook-methods/)
- Embed loops, conditionals, and other custom logic
- Self documenting CLI to call logic
- Ships with a collection of over [100 hooks](https://robcxyz.github.io/tackle-box) that act like plugins within your config file
- [Prompt user for inputs](https://robcxyz.github.io/tackle-box)
- [Generate code from templates](https://robcxyz.github.io/tackle-box/providers/Generate/)
- Read and write [yaml](https://robcxyz.github.io/tackle-box/providers/Yaml/) / [toml](https://robcxyz.github.io/tackle-box/providers/Toml/) / [json](https://robcxyz.github.io/tackle-box/providers/Json/) [files](https://robcxyz.github.io/tackle-box/providers/Files/)
- [Make http calls](https://robcxyz.github.io/tackle-box/providers/Web/)
- [Run arbitrary system commands](https://robcxyz.github.io/tackle-box/providers/Command/)
- [Manipulate the context](https://robcxyz.github.io/tackle-box/providers/Context/)
- [Run other tackle files](https://robcxyz.github.io/tackle-box/providers/Tackle/tackle/)
- Ships with a collection of over [100 hooks](https://robcxyz.github.io/tackle) that act like plugins within your config file
- [Prompt user for inputs](https://robcxyz.github.io/tackle)
- [Generate code from templates](https://robcxyz.github.io/tackle/providers/Generate/)
- Read and write [yaml](https://robcxyz.github.io/tackle/providers/Yaml/) / [toml](https://robcxyz.github.io/tackle/providers/Toml/) / [json](https://robcxyz.github.io/tackle/providers/Json/) [files](https://robcxyz.github.io/tackle/providers/Files/)
- [Make http calls](https://robcxyz.github.io/tackle/providers/Web/)
- [Run arbitrary system commands](https://robcxyz.github.io/tackle/providers/Command/)
- [Manipulate the context](https://robcxyz.github.io/tackle/providers/Context/)
- [Run other tackle files](https://robcxyz.github.io/tackle/providers/Tackle/tackle/)
- Modular design allows creating / importing new hooks easy
- Supports both [python](https://robcxyz.github.io/tackle-box/python-hooks/) and [declarative](https://robcxyz.github.io/tackle-box/declarative-hooks/) hooks which can be imported / called / defined in-line or within jinja templates
- Supports both [python](https://robcxyz.github.io/tackle/python-hooks/) and [declarative](https://robcxyz.github.io/tackle/declarative-hooks/) hooks which can be imported / called / defined in-line or within jinja templates

### Install

> Note: tackle can install dependencies on its own. Check [docs](https://robcxyz.github.io/tackle-box/installation#best-installation-method) for advanced installation methods to isolate tackle from your system python.
> Note: tackle can install dependencies on its own. Check [docs](https://robcxyz.github.io/tackle/installation#best-installation-method) for advanced installation methods to isolate tackle from your system python.
```shell
python -m venv env && source env/bin/activate
pip install tackle-box
pip install tackle
```

**Quick Demo:** `tackle robcxyz/tackle-hello-world`

### Hello world

Check out the [docs](https://robcxyz.github.io/tackle-box/hello-worlds/) for >10 hello worlds that demonstrate the various aspects of the syntax with the simplest one using the [print](https://robcxyz.github.io/tackle-box/providers/Console/print/) hook.
Check out the [docs](https://robcxyz.github.io/tackle/hello-worlds/) for >10 hello worlds that demonstrate the various aspects of the syntax with the simplest one using the [print](https://robcxyz.github.io/tackle/providers/Console/print/) hook, one of [>100 hooks](https://robcxyz.github.io/tackle/installation#best-installation-method).

**hello.yaml**
```yaml
# Any time a key ends with `->`, we are calling a hook
hw->: print Hello world!
```

To run, call `tackle hello.yaml`. Can also be [version controlled](https://robcxyz.github.io/tackle-box/creating-providers/) -> [`tackle robcxyz/tackle-hello-world`](https://github.com/robcxyz/tackle-hello-world).
To run, call `tackle hello.yaml`. Can also be [version controlled](https://robcxyz.github.io/tackle/creating-providers/) -> [`tackle robcxyz/tackle-hello-world`](https://github.com/robcxyz/tackle-hello-world).

Can also use [loops, conditionals, and other base methods](https://robcxyz.github.io/tackle-box/hook-methods/).
Can also use [loops, conditionals, and other base methods](https://robcxyz.github.io/tackle/hook-methods/).

**hello.yaml**
```yaml
Expand All @@ -87,7 +88,7 @@ multiple lines:
# Or combinations of the above with other methods like try/except
```

New hooks can be [made in python](https://robcxyz.github.io/tackle-box/python-hooks/)
New hooks can be [made in python](https://robcxyz.github.io/tackle/python-hooks/)
which under the hood is a [pydantic](https://github.com/pydantic/pydantic) model.

```python
Expand All @@ -103,7 +104,7 @@ class Greeter(BaseHook):
return expression
```

Or can be [defined inline within your tackle file.](https://robcxyz.github.io/tackle-box/declarative-hooks/).
Or can be [defined inline within your tackle file.](https://robcxyz.github.io/tackle/declarative-hooks/).

```yaml
# Keys ending with `<-` mean we are creating a hook / method
Expand All @@ -116,7 +117,7 @@ greeter<-:
return: expression
```

And both can be [called in the same way](https://robcxyz.github.io/tackle-box/writing-tackle-files/).
And both can be [called in the same way](https://robcxyz.github.io/tackle/writing-tackle-files/).

```yaml
hello: world!
Expand Down Expand Up @@ -177,7 +178,7 @@ Hooks can be imported, linked, and/or combined creating a web of CLIs.

### Use Cases

- [Code Generation](https://robcxyz.github.io/tackle-box/tutorials/code-generation/)
- [Code Generation](https://robcxyz.github.io/tackle/tutorials/code-generation/)

**WIP Tutorials**

Expand All @@ -190,14 +191,14 @@ Hooks can be imported, linked, and/or combined creating a web of CLIs.

### Topics

- [Writing Tackle Files](https://robcxyz.github.io/tackle-box/writing-tackle-files/)
- [Creating Providers](https://robcxyz.github.io/tackle-box/creating-providers/)
- [Python Hooks](https://robcxyz.github.io/tackle-box/python-hooks/)
- [Declarative Hooks](https://robcxyz.github.io/tackle-box/declarative-hooks/)
- [Blocks](https://robcxyz.github.io/tackle-box/writing-tackle-files/#blocks) and [Flow Control](https://robcxyz.github.io/tackle-box/hook-methods/)
- [Memory Management](https://robcxyz.github.io/tackle-box/memory-management/)
- [Special Variables](https://robcxyz.github.io/tackle-box/special-variables/)
- [Declarative CLIs](https://robcxyz.github.io/tackle-box/declarative-cli/)
- [Writing Tackle Files](https://robcxyz.github.io/tackle/writing-tackle-files/)
- [Creating Providers](https://robcxyz.github.io/tackle/creating-providers/)
- [Python Hooks](https://robcxyz.github.io/tackle/python-hooks/)
- [Declarative Hooks](https://robcxyz.github.io/tackle/declarative-hooks/)
- [Blocks](https://robcxyz.github.io/tackle/writing-tackle-files/#blocks) and [Flow Control](https://robcxyz.github.io/tackle/hook-methods/)
- [Memory Management](https://robcxyz.github.io/tackle/memory-management/)
- [Special Variables](https://robcxyz.github.io/tackle/special-variables/)
- [Declarative CLIs](https://robcxyz.github.io/tackle/declarative-cli/)

### Contributing

Expand All @@ -207,11 +208,11 @@ Contributions are welcome but please be advised of the following notes.
- For making changes to providers, please include test coverage using the existing fixtures and patterns from prior tests or communicate any suggestions that deviate from this style. Tests should be runnable from the test's directory and via `make test`.
- For making changes to the core parser, please create a proposal first outlining your suggestions with examples before spending time working on code.

It is very easy to create new providers / hooks with tackle-box. Over time, it will adopt the same import pattern of what Ansible does where all provider / hooks (modules) are stored in version controlled locations. In the meantime, please feel free to contribute to this repository for hooks that have general applicability or create your own hooks in other repositories that are more bespoke / opinionated in nature.
It is very easy to create new providers / hooks with tackle. Over time, it will adopt the same import pattern of what Ansible does where all provider / hooks (modules) are stored in version controlled locations. In the meantime, please feel free to contribute to this repository for hooks that have general applicability or create your own hooks in other repositories that are more bespoke / opinionated in nature.

### 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](https://www.pypa.io/en/latest/code-of-conduct/).
Everyone interacting in the tackle project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [PyPA Code of Conduct](https://www.pypa.io/en/latest/code-of-conduct/).

## Credit

Expand Down
2 changes: 1 addition & 1 deletion docs/.old/comparisons.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Most code generators out there have only one way of building a render context.
- Input spec
- User points to an OpenAPI spec

Tackle-box being more of a DSL allows all these configuration options in a completely modular way with the only catch, that you need to explicitly declare all the functionality in a tackle file. This tutorial walks through how to setup code generators based on each of the above patterns.
Tackle being more of a DSL allows all these configuration options in a completely modular way with the only catch, that you need to explicitly declare all the functionality in a tackle file. This tutorial walks through how to setup code generators based on each of the above patterns.
2 changes: 1 addition & 1 deletion docs/command-line.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Calling from the Command Line

Tackle-box is extremely flexible on the inputs that it accepts to run against. Basically any file, directory, or repo are acceptable inputs or no input at all. This document describes the logic behind how tackle takes in inputs including how additional args, kwargs, and flags are interpreted from the command line.
Tackle is extremely flexible on the inputs that it accepts to run against. Basically any file, directory, or repo are acceptable inputs or no input at all. This document describes the logic behind how tackle takes in inputs including how additional args, kwargs, and flags are interpreted from the command line.

For how to structure files for a tackle provider, check out [creating providers](./creating-providers.md) or creating self documenting CLIs check out [declarative cli](./declarative-cli.md).

Expand Down
Loading

0 comments on commit 3977a85

Please sign in to comment.