A pure-Python libconfig reader with permissive license
Project description
libconf is a pure-Python reader for configuration files in libconfig format, which is often used in C/C++ projects. It’s interface is similar to the json module: the two main methods are load() and loads().
Example usage:
import libconf >>> with open('example.cfg') as f: ... config = libconf.load(f) >>> config {'capabilities': {'can-do-arrays': [3, 'yes', True], 'can-do-lists': (True, 14880, ('sublist',), {'subgroup': 'ok'})}, 'version': 7, 'window': {'position': {'h': 600, 'w': 800, 'x': 375, 'y': 210}, 'title': 'libconfig example'}} >>> config['window']['title'] 'libconfig example' >>> config.window.title 'libconfig example'
The data can be accessed either via indexing (['title']) or via attribute access .title.
Comparison to other Python libconfig libraries
Pylibconfig2 is another pure-Python libconfig reader. It’s API is based on the C++ interface, instead of the Python json module. It’s licensed under GPLv3, which makes it unsuitable for use in a large number of projects.
Python-libconfig is a library that provides Python bindings for the libconfig++ C++ library. While permissively licensed (BSD), it requires a compilation step upon installation, which can be a drawback.
I wrote libconf (this library) because both of the existing libraries didn’t fit my requirements. I had a work-related project which is not open source (ruling out pylibconfig2) and I didn’t want the deployment headache of python-libconfig. Further, I enjoy writing parsers and this seemed like a nice opportunity :-)
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
Built Distribution
File details
Details for the file libconf-0.9.1.zip
.
File metadata
- Download URL: libconf-0.9.1.zip
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15b0a9c527357b02e5c6adb7d3a4637d15a7c952dec3dd2e613132a36bf89501 |
|
MD5 | e20f48a7621b8475c0501768f2b0ec6f |
|
BLAKE2b-256 | feff5953dcd7923789c6cb0f7dd5643c37bb336183548a00eeb194eed06b72a1 |
Provenance
File details
Details for the file libconf-0.9.1-py2.py3-none-any.whl
.
File metadata
- Download URL: libconf-0.9.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee3f3f296df5a358de033e04c8d7eacf7e5313d880ae1ef695c0960d4c5adf50 |
|
MD5 | 17693dc29b54ee3c3071ab8a346adeb3 |
|
BLAKE2b-256 | 83e1ca3263a5b702df34b5317af372cf56f63c2a9afcc734272fe507e98776bb |