The YAMLpp language (introduced in that article) evolved a lot, particularly with the introduction of imported modules, and it deserved a better name to describe what it could do for project developers or people involved in system administration or deployment.
Nowadays, a lot of tools ara data-driven. You describe the result you want, and the system figures out how to produce it.
The original name YAMLpp was a reference to its basic syntax (it is YAML-compliant) and it initially produced YAML.
But Protein is so much more than that. It is a data composer and a templating tool.
A data composer can be seen as similar to a typographical composer: you start from a small set of data, and you use that too to compose your data (arrange them in space) in the same way as you would lay out a small set of a letters on a page, to form a text. You can output formally correct data structures (typically in YAML or JSON), or store them in files, for later use.
A templating tool: you can also use the embedded templating engine (Jinja), to produce output files, typically in HTML format; or produce Javascript snippets.
Protein is simply regular YAML, with commands called constructs (which are simply keys starting with a dot, such as .do, .foreach, etc.). Protein is essentially a tree builder and transformer.
The result is surprisingly effective, typically for web development: in a few lines of code (it's YAML) you describe what YAML or JSON you want to produce, as well as HTML, Javascript, etc.
You don't have to worry about boiler plate any more, or about repeating the same data across different files; Protein helps you producing them from one single source (or a set of source files).
Protein has functions with their own scope as well as modules. The "magic" is done through the Jinja templating engine, which can produce new YAML structures.
Furthermore, you can define your own functions to be used in Jinja (developed in Python). Hence you can use Protein for what it does best (composing and templating), and delegate complicated and delicate calculations to Python. You get the best of both worlds.
Protein is installable as a Python package:
pip install protein-lang
Protein:
Top comments (0)