Skip to main content

ModCFG

YEs

codecov Documentation Status Code style: black CI

YEs, another configuration language

Seriously, how many configuration languages do we have? From the top of my head, I can only name:

Hmmm... that's it I think. wE NeEd MOrE cOnfIGURaTion LanGuaGEs!!1!1!!

But actually though

I originally based this off of the Ruby/DSL for homebrew formulas.

Here are my complaints for the alternatives:

  • JSON, while simple, isn't too readable and only has the bear minimum of datatypes. That may be a feature for some people, though.
  • YAML is dangerous. And unpredictable.
  • INI and TOML are quite similar and they both are quite nice with a lot of datatypes but, in my opinion, the format isn't as natural to read as YAML. TOML supports dates and datetime, though.
  • Finally, XML is garbage. It's barely human-readable and can decode into a super wonky format. So no.

Finally, I just wanted an excuse to play with Lark.

Features

  • Enums with a built-in resolver
  • Date time and Date support
  • YAML-like syntax
  • Support for comments, unicode escape sequences, string modifications, and cleanly managed indented strings

Examples

Given this modcfg document:

module hello_world:
    hello => world
    this: "also works"
    'single quotes' = "equals double quotes"
    how -> {
            about: {
                some:
                    - very
                    - crazy
                    - data:
                        structures = o_0
            }
        }

and this python script:

import modcfg
modcfg.loads(DOC)  # `DOC` is the document above

The output is

[
    Module(
        name="hello_world",
        contents=[
            {
                "hello": "world",
                "this": "also works",
                "single quotes": "equals double quotes",
                "how": {
                    "about": {
                        "some": ["very", "crazy", {"data": {"structures": "o_0"}}]
                    }
                },
            }
        ],
    )
]

Crazy, right? It gets better with enums and date(time)s... You might as well read the whole documentation.

Installation

$ pip install modcfg

Develop-install

The classic method:

$ git clone https://github.com/ThatXliner/modcfg.git
$ cd modcfg
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -e .

The best method (requires Poetry):

$ git clone https://github.com/ThatXliner/modcfg.git
$ cd modcfg
$ poetry install

FAQ

Why did you make this

why

Lark is epic.

Why the name?

Modular Configuration language.

Metadata

Release files for modcfg 0.1.3

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

Source distribution (sdist)

Source distribution for modcfg 0.1.3
File Size Uploaded Provenance Actions
modcfg-0.1.3.tar.gz 22.9 kB Without provenance Details for modcfg-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for modcfg 0.1.3
File Interpreter ABI Platform Actions
modcfg-0.1.3-py3-none-any.whl Python 3 none any Details for modcfg-0.1.3-py3-none-any.whl

Total release size: 44.9 kB

Release files / modcfg-0.1.3.tar.gz

Download URL modcfg-0.1.3.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3ccb0a228d86879c63d35fe7b52002bbb66206ca5707890f0f4ccd1fdd3e97e0
BLAKE2b-256 checksum
How to use checksums
8ad281fbfca8582d234ad790a68a115b2228e55b1840115154ec7248092a601f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.6.12 Darwin/19.6.0

Release files / modcfg-0.1.3-py3-none-any.whl

Download URL modcfg-0.1.3-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71f0ea40b2f72cc05b116f12aff072824e05338d1593802b9df7f14d60506d3c
BLAKE2b-256 checksum
How to use checksums
b611817703287404adc39b5cb72d0707841518a30a46b30149aba32efed7ac61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.6.12 Darwin/19.6.0

Security for modcfg 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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