Skip to main content

Generic Configuration Language

Project description

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.


Detailed documentation is available at [](

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 ];


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 =;

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

# Translate the whole thing to a Python dict (for example to convert to JSON)
dict_model = util.to_python(model)

import json


* Uses `pyparsing`.


* Vim syntax definitions available:

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

gcl-0.6.11.tar.gz (32.0 kB view hashes)

Uploaded source

Built Distribution

gcl-0.6.11-py2.py3-none-any.whl (38.9 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page