toy language on yaml or json
Project description
zenmai
========================================
.. image:: https://travis-ci.org/podhmo/zenmai.svg?branch=master
:target: https://travis-ci.org/podhmo/zenmai
toylang on yaml or json
command line example
----------------------------------------
main.yaml
.. code-block:: yaml
code:
$import: ./filters.py
as: f
definitions:
$let:
nums: {$load: ./nums.yaml#/definitions/nums0/enum}
odds:
type: integer
enum:
$f.odds: {$get: nums}
even:
type: integer
enum:
$f.evens: {$get: nums}
nums.yaml
.. code-block:: yaml
definitions:
nums0:
type: integer
enum:
[1, 2, 3, 4, 5, 6]
nums1:
type: integer
enum:
[1, 2, 3, 5, 7, 11]
filters.py
.. code-block:: python
def odds(nums):
return [n for n in nums if n % 2 == 1]
def evens(nums):
return [n for n in nums if n % 2 == 0]
run.
.. code-block:: bash
$ zenmai examples/readme2/main.yaml
output
.. code-block:: yaml
zenmai main.yaml
definitions:
odds:
type: integer
enum:
- 1
- 3
- 5
even:
type: integer
enum:
- 2
- 4
- 6
config loader
----------------------------------------
using zenmai as config loader.
```python
from zenma.loader import load
with open("config.yaml") as rf:
d = load(rf)
```
0.2.0
- add `$inherit` action
- zenmai as config loader
0.1.0:
- first release
========================================
.. image:: https://travis-ci.org/podhmo/zenmai.svg?branch=master
:target: https://travis-ci.org/podhmo/zenmai
toylang on yaml or json
command line example
----------------------------------------
main.yaml
.. code-block:: yaml
code:
$import: ./filters.py
as: f
definitions:
$let:
nums: {$load: ./nums.yaml#/definitions/nums0/enum}
odds:
type: integer
enum:
$f.odds: {$get: nums}
even:
type: integer
enum:
$f.evens: {$get: nums}
nums.yaml
.. code-block:: yaml
definitions:
nums0:
type: integer
enum:
[1, 2, 3, 4, 5, 6]
nums1:
type: integer
enum:
[1, 2, 3, 5, 7, 11]
filters.py
.. code-block:: python
def odds(nums):
return [n for n in nums if n % 2 == 1]
def evens(nums):
return [n for n in nums if n % 2 == 0]
run.
.. code-block:: bash
$ zenmai examples/readme2/main.yaml
output
.. code-block:: yaml
zenmai main.yaml
definitions:
odds:
type: integer
enum:
- 1
- 3
- 5
even:
type: integer
enum:
- 2
- 4
- 6
config loader
----------------------------------------
using zenmai as config loader.
```python
from zenma.loader import load
with open("config.yaml") as rf:
d = load(rf)
```
0.2.0
- add `$inherit` action
- zenmai as config loader
0.1.0:
- first release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zenmai-0.2.0.tar.gz
(8.1 kB
view hashes)
Built Distribution
zenmai-0.2.0-py2.py3-none-any.whl
(14.3 kB
view hashes)
Close
Hashes for zenmai-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e6aa7df7913e30d0e7a36435358a5f09f2d6c80005327f10451a277a6ab968d |
|
MD5 | 59c18b6687599db859be4dd4d2339f5b |
|
BLAKE2b-256 | e16458e834671a5341f75f9eb098c51c7aa288846a5237a9eb703de236c3642e |