gcl -- Generic Configuration Language
=====================================
GCL is an declarative modeling language that can be dropped into any Python project. It supports
dictionaries with name-value pairs, all the basic types you'd expect, lists, includes, and methods
for abstraction.
The goal for GCL is to be a modeling language with lots of expressive power, intended to make
complex configurations extremely DRY. Behavior is not part of the goal of the language; behavior and
semantics are added by scripts that interpret the GCL model.
Documentation
-------------
Detailed documentation is available at [http://gcl.readthedocs.org](http://gcl.readthedocs.org)
Quick GCL showcase
------------------
GCL is built around named tuples, written with curly braces:
# This is a comment
# Various data types:
number = 1;
string = 'value'; # Strings can be doubly-quoted as well
bool = true; # Note: lowercase
expression = number * 2;
list = [ 1, 2, 3 ];
Expressions:
a = 1 + 1;
b = 'foo' + 'bar';
c = 80 * '-';
d = inc(1); # Function application
e = inc 1; # Can omit parens with 1 argument
# Conditionals
allow_test_commands = if stage == 'alpha' then true else false;
# List comprehension
evens = [ x * 2 for x in [1, 2, 3, 4, 5] if x % 2 == 0 ];
Tuples and accessing tuple members:
tuple = {
foo = 3;
}
that_foo = tuple.foo;
Includes and tuple composition:
http = include 'library/http.gcl';
server = http.Server {
port = 8080;
}
Using the library
-----------------
You now know enough GCL to get started. Using the library looks like this:
import gcl
from gcl import util
# Load and evaluate the given file
model = gcl.load('myfile.gcl')
# This gives you a dict-like object back, that you can just index
print(model['element'])
# Translate the whole thing to a Python dict (for example to convert to JSON)
dict_model = util.to_python(model)
import json
print(json.dumps(dict_model))
Requirements
------------
* Uses `pyparsing`.
Extra
-----
* Vim syntax definitions available: https://github.com/rix0rrr/vim-gcl
=====================================
GCL is an declarative modeling language that can be dropped into any Python project. It supports
dictionaries with name-value pairs, all the basic types you'd expect, lists, includes, and methods
for abstraction.
The goal for GCL is to be a modeling language with lots of expressive power, intended to make
complex configurations extremely DRY. Behavior is not part of the goal of the language; behavior and
semantics are added by scripts that interpret the GCL model.
Documentation
-------------
Detailed documentation is available at [http://gcl.readthedocs.org](http://gcl.readthedocs.org)
Quick GCL showcase
------------------
GCL is built around named tuples, written with curly braces:
# This is a comment
# Various data types:
number = 1;
string = 'value'; # Strings can be doubly-quoted as well
bool = true; # Note: lowercase
expression = number * 2;
list = [ 1, 2, 3 ];
Expressions:
a = 1 + 1;
b = 'foo' + 'bar';
c = 80 * '-';
d = inc(1); # Function application
e = inc 1; # Can omit parens with 1 argument
# Conditionals
allow_test_commands = if stage == 'alpha' then true else false;
# List comprehension
evens = [ x * 2 for x in [1, 2, 3, 4, 5] if x % 2 == 0 ];
Tuples and accessing tuple members:
tuple = {
foo = 3;
}
that_foo = tuple.foo;
Includes and tuple composition:
http = include 'library/http.gcl';
server = http.Server {
port = 8080;
}
Using the library
-----------------
You now know enough GCL to get started. Using the library looks like this:
import gcl
from gcl import util
# Load and evaluate the given file
model = gcl.load('myfile.gcl')
# This gives you a dict-like object back, that you can just index
print(model['element'])
# Translate the whole thing to a Python dict (for example to convert to JSON)
dict_model = util.to_python(model)
import json
print(json.dumps(dict_model))
Requirements
------------
* Uses `pyparsing`.
Extra
-----
* Vim syntax definitions available: https://github.com/rix0rrr/vim-gcl
Metadata
Release files for gcl 0.6.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gcl-0.6.11.tar.gz | 32.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gcl-0.6.11-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 70.9 kB
Release files / gcl-0.6.11.tar.gz
| Download URL | gcl-0.6.11.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c8d67eb17d3e01ba803c9ca372123a74b6a81853a6d6570cad38267ed93701e
|
|
BLAKE2b-256 checksum How to use checksums |
853c2f50af3da80686bfe53124a204ef9ff64a3b4903dbd7bdbe512d2e4d3591
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / gcl-0.6.11-py2.py3-none-any.whl
| Download URL | gcl-0.6.11-py2.py3-none-any.whl |
|---|---|
| Size | 38.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
16ccc170b422d876ddfc723ca1ea8a234a1d80fb305c2ff75516e0c848b1ef87
|
|
BLAKE2b-256 checksum How to use checksums |
809fa32a67143ea66128d147638565a15c546c213da7efd494f3e6201a448f75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |