Skip to main content

cfgr

Build Status

Install

pip install cfgr

What is it?

pycfgr is part of a cross-language exploration in search of new ways to create software systems.

Other repositories that perform similar (but not -yet- compatible) research;

Cfgr provides a set of APIs that encourage separation of configuration from logic. It helps organising the application logic in small, modular components and lets you put those together through configuration (json) files to create complex systems.

The approach borrows concepts from Visual Programming Languages (VPLs) which generally let you create instances of pre-built building blocks and connect them together to perform complex tasks. These concepts are translated back into a text-based workflow.

MaxMSP Blueprints TouchDesigner

three famous examples of VPLs (from left to right); Cyling '74's Max, Unreal Engine's Blueprints and Derivative's TouchDesigner

Why?

  • A text-based workflow using standard formats (like JSON) allows for the most flexible/customizable development pipelines and benefit of massive set of available tools (version control systems, text-editors, IDEs, command-line, ssh, etc.).
  • Separating configuration from the logic provides possiblity to make and actuate changes at runtime (from minor properties to major application structures).
  • Removing configuration (as much as possible) from your application code keeps the code clear and concise.
  • Enforcing a modular component structure encourages best practices like the single responsibility principle and writing modular code that is truly reusable.

Some history

Motivation for this exploration came from many years of experience in professional software development, specifically non web-based UI software development in C++ and Java using frameworks like OpenFrameworks, Cinder and Processing and noticing patterns of repetition, both in code and in general workflow. This experience lead to, initially, the JavaLibUiBuilder which builds on top of a UI framework (JavaLibUi, inspired by the ofxInterface library for OpenFrameworks/C++), which started the concept of building and configuring application logic from json config files (which feels a bit like writing CSS from a web-page).

This concept was translated into C++ using in the ciCMS package for the Cinder framework and extended to provide "native" events and states to further reduce the amount of custom application code that needs to be written to make the different components communicate.

Examples

Hello World

Below is an example of what an Hello World implementation could look like. Obviously this level of abstraction doesn't make much sense in a HelloWorld scenario, but it demonstrates the concepts of configuration, logic, components and events.

cfgr.json (config)

{
  "App": {"started":"#appstarted", "stop":"#stopapp"},
  "App.String": {"value": "Hello World!", "in-emit":"#appstarted", "out-emit":"#sayhello,#stopapp"},
  "App.Print": {"on": "#sayhello"}
}

Invoke the above configuration using the default cfgr.app:

python -m cfgr.app --data ./cfgr.json # uses the default cfgr.app runner

Metadata

Release files for cfgr 0.0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cfgr 0.0.2.6
File Size Uploaded
cfgr-0.0.2.6.tar.gz 15.9 kB Details

Release files / cfgr-0.0.2.6.tar.gz

Download URL cfgr-0.0.2.6.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
455ec42f8565d89e2285d5bf5c0fa13a18ea8fcbfd46dfddd3bc349ba5fff086
BLAKE2b-256 checksum
How to use checksums
c8dda8e02ed0c440530ee4864cec29c9e41a06cc511302f2ed385b8696709ec2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

Release history Release notifications | RSS feed

0.0.3

1 release file

0.0.2.7

1 release file

This release

0.0.2.6 This release

1 release file

0.0.2.5

1 release file

0.0.2.4

1 release file

0.0.2.3

1 release file

0.0.2.2

1 release file

0.0.2.1

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page