All Projects → metakirby5 → Zenbu

metakirby5 / Zenbu

Licence: mit
🏮 A Jinja2 + YAML based config templater.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Zenbu

coAST
Universal and language-independent abstract syntax tree
Stars: ✭ 30 (-73.68%)
Mutual labels:  yaml, jinja2
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (+237.72%)
Mutual labels:  yaml, template
logya
Logya is a static site generator written in Python designed to be easy to use and flexible.
Stars: ✭ 16 (-85.96%)
Mutual labels:  yaml, jinja2
gen-cisco
🧨 Generates Cisco scripts based on YAML files
Stars: ✭ 29 (-74.56%)
Mutual labels:  yaml, jinja2
Perun
A command-line validation tool for AWS Cloud Formation that allows to conquer the cloud faster!
Stars: ✭ 82 (-28.07%)
Mutual labels:  yaml, template
Prinder
Free Pull Request reminder for Github. Has configurations to post reminders to Slack and email along with jinja templating
Stars: ✭ 21 (-81.58%)
Mutual labels:  yaml, jinja2
Grow
A declarative website generator designed for high-quality websites, with a focus on easy maintenance and localization.
Stars: ✭ 360 (+215.79%)
Mutual labels:  yaml, jinja2
Jinja2 Cli
CLI for Jinja2
Stars: ✭ 302 (+164.91%)
Mutual labels:  yaml, jinja2
Pytorch Project Template
Deep Learning project template for PyTorch (Distributed Learning is supported)
Stars: ✭ 76 (-33.33%)
Mutual labels:  yaml, template
Pynms
A vendor-agnostic NMS for carrier-grade network simulation and automation
Stars: ✭ 73 (-35.96%)
Mutual labels:  yaml, jinja2
Home Assistant Config
My Home Assistant Configuration 🏡🏡
Stars: ✭ 133 (+16.67%)
Mutual labels:  yaml, jinja2
Kapitan
Generic templated configuration management for Kubernetes, Terraform and other things
Stars: ✭ 1,383 (+1113.16%)
Mutual labels:  yaml, jinja2
Napalm Salt
Modules for event-driven network automation and orchestration using Salt
Stars: ✭ 116 (+1.75%)
Mutual labels:  yaml, jinja2
smacha
SMACHA is a meta-scripting, templating, and code generation engine for rapid prototyping of ROS SMACH state machines.
Stars: ✭ 15 (-86.84%)
Mutual labels:  yaml, jinja2
Yadm
Yet Another Dotfiles Manager
Stars: ✭ 2,982 (+2515.79%)
Mutual labels:  template, jinja2
Ansible Skeleton
The skeleton to create new ansible roles.
Stars: ✭ 5 (-95.61%)
Mutual labels:  yaml, template
Python Training For Network Engineers
Python hands-on training for network engineers. How to automate Junos with Python
Stars: ✭ 92 (-19.3%)
Mutual labels:  yaml, jinja2
Gin Template
golang template for gin framework!
Stars: ✭ 106 (-7.02%)
Mutual labels:  rice, template
Dotfiles
▒ rice ░░ custom linux config files
Stars: ✭ 1,514 (+1228.07%)
Mutual labels:  rice
Jade Html5 Boilerplate
HTML5 Boilerplate ported to Jade. Great as a drop and go markup skeleton for Express apps.
Stars: ✭ 111 (-2.63%)
Mutual labels:  template

============== zenbu (全部)

|Sample Usage|

A setup-agnostic cascading theme engine. Uses Jinja2 for templates and YAML for variable definition.

The above gif was brought to you by wzb-utils_.

Installation

::

pip install zenbu

or just move zenbu.py to somewhere in your $PATH. If you do the latter, you must install the dependencies in the following section manually.

If you are running Arch Linux, you can also use the AUR package zenbu-git_ (AUR).

If you are running Gentoo:

::

layman -o https://raw.githubusercontent.com/azahi/ricerlay/master/overlay.xml -f -a ricerlay layman -s ricerlay emerge app-misc/zenbu

Dependencies

  • Python (2 or 3)

The below are Python libraries that should be installed via pip. Alternatively, if you did pip install zenbu, these should have been automatically installed.

  • argcomplete
  • colorlog
  • Jinja2
  • PyYAML
  • termcolor
  • watchdog

Tab completion

::

sudo activate-global-python-argcomplete

If you installed via pip, you may need to run the following before autocompletion works:

::

grep 'PYTHON_ARGCOMPLETE_OK' "$(which zenbu)" &>/dev/null || sudo sed -i "1a # PYTHON_ARGCOMPLETE_OK" "$(which zenbu)"

Usage

Check the example_ folder for some sample usage!

For a more detailed explanation, check out the wiki homepage_.

For common issues, check the common gotchas wiki page_.

For some neat tools (including automatic desktop reloads), check the tools wiki page_.

::

usage: zenbu [-h] [-l] [-t TEMPLATE_DIR] [-d DEST_DIR] [-s VAR_SET_DIR] [-f FILTERS_FILE] [-i IGNORES_FILE] [-e] [-w] [--watch-command WATCH_COMMAND] [--watch-dirs WATCH_DIRS] [--diff] [--dry] [variable_files [variable_files ...]]

A Jinja2 + YAML based config templater.

Searches for an optional yaml file with a variable mapping in ~/.config/zenbu/defaults.yaml,

an optional python file with filters in (by default) ~/.config/zenbu/filters.py,

an optional yaml file with an ignore scalar of regexes in (by default) ~/.config/zenbu/ignores.yaml,

and uses the Jinja2 templates in (by default) ~/.config/zenbu/templates/

to render into your home directory (by default).

Additional variable files can be applied by supplying them as arguments, in order of application.

They can either be paths or, if located in (by default) ~/.config/zenbu/variable_sets/, extension-less filenames.

Environment variable support is available; simply run with the -e flag and put the name of the variable in Jinja2 brackets.

The default Jinja2 globals and filters are available.

Order of precedence is: last YAML variable defined > first YAML variable defined > environment variables.

Variables are shallowly resolved once. Thus, for example you may have the following in your defaults.yaml for convenience:

n_primary: "{{ colors[colors.primary].normal }}"

Autocomplete support available, but only for the default variable set directory.

A file watcher is available via the -w flag. Whenever a variable file in use, the filters file, the ignores file, or a template file changes, the templates are rendered if there are any differences. This can be overridden with a custom list of directories via the --watch-dirs flag.

Diffs between the current destination files and template renderings are available via the --diff flag.

For help on designing templates, refer to http://jinja.pocoo.org/docs/dev/templates/

For help on creating filters, refer to http://jinja.pocoo.org/docs/dev/api/#custom-filters

positional arguments: variable_files additional variable files

optional arguments: -h, --help show this help message and exit -l list variable sets. -t TEMPLATE_DIR template directory. Default: /Users/echan/.config/zenbu/templates -d DEST_DIR destination directory. Default: /Users/echan -s VAR_SET_DIR variable set directory. Default: /Users/echan/.config/zenbu/variable_sets -f FILTERS_FILE filters file. Default: /Users/echan/.config/zenbu/filters.py -i IGNORES_FILE ignores file. Default: /Users/echan/.config/zenbu/ignores.yaml -e whether or not to use environment variables. Default: don't use environment variables -w start file watcher. --watch-command WATCH_COMMAND what to execute when a change occurs. Default: Nothing --watch-dirs WATCH_DIRS override what directories to watch, colon-separated. Default: Nothing --diff show diff between template renderings and current destination files --dry do a dry run

Zenbu in the wild

|enju|

What happened to whizkers?

This project may seem awfully similar to whizkers_; in fact, this is a fork of whizkers which swaps the Mustache backend out with Jinja2. I'm keeping whizkers around for compatibility reasons. So what are the reasons for switching?

  • Comprehensive documentation: See the Jinja2 Template Designer Documentation_.
  • Better logic: Everything from if/else to macros. I originally praised Mustache for its logic-less philosophy, but then I realized that there would be no place to put logic other than the variable sets, which is a nightmare.
  • Expressions: You can now do {{ ':bold' if use_bold else '' }}. You can even do {{ colors[colors.primary]['normal'] }}, which has led to the deprecation of the {` ... `} eval syntax.
  • Filters: You can now do {{ colors.black.bold | to_rgb }}. A lot better than Mustache's syntax.
  • Better whitespace control: This means increased readability.

To help ease the transition to zenbu, there are some tips under the migration wiki page_.

Thanks to

.. |Sample Usage| image:: http://i.imgur.com/auBfvx0.gif :target: https://u.teknik.io/FUkHM.webm :alt: zenbu with fullsalvo's wzb-utils. .. |enju| image:: http://i.imgur.com/EkT9OY5.gif :target: http://asator.xyz/img/dad9.webm :alt: enju on 2bwm. .. _wzb-utils: https://github.com/fullsalvo/wzb-utils .. _zenbu-git: https://aur.archlinux.org/packages/zenbu-git .. _whizkers: https://github.com/metakirby5/whizkers .. _Jinja2: http://jinja.pocoo.org/ .. _Jinja2 Template Designer Documentation: http://jinja.pocoo.org/docs/dev/templates/ .. _YAML: http://yaml.org/ .. _wiki homepage: https://github.com/metakirby5/zenbu/wiki .. _migration wiki page: https://github.com/metakirby5/zenbu/wiki/Migration .. _common gotchas wiki page: https://github.com/metakirby5/zenbu/wiki/Common-gotchas .. _tools wiki page: https://github.com/metakirby5/zenbu/wiki/Tools .. _example: example .. _fullsalvo: https://github.com/fullsalvo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].