Python configuration library
Project description
lynx
====
Simple python configuration library and format. The format is very similar to YAML with the enhancment of sections.
##Installation
Install the ``lynx`` package with [pip](<https://pypi.python.org/pypi/lynx>):
pip install lynx
##Example use
Configuration example:
```
# section example
section {
# fields
field1: myfield1 value
field2: Another field value
# lists
mylist: [5, mystr, value, 8]
}
# Another section
section2 {
# sub section example
my_section {
name: lynx
}
# sections can have same name.
my_section {
# multiline fields
Library description:|
Lynx is a python
Configuration library
supporting many features
including multiline fields!$%$!%#@
Yay!
myfloat: 5.3
}
}
```
Load the configuration:
```
>>> import lynx
# Load file
>>> with open("config.conf", "r") as fp:
... config = lynx.load(fp)
# Get the first section
>>> config[0].name()
'section'
>>> config[0].fields()
{'field2': 'Another field value', 'field1': 'myfield1 value', 'mylist': [5, 'mystr', 'value', 8]}
# Get sub sections
>>> config[1].sub_sections()
[<lynx.Section object at 0x7f4ab28dfdd0>, <lynx.Section object at 0x7f4ab28dfe10>]
>>> config[1].sub_sections()[0].name()
'my_section'
```
## Features
Features include:
* Sections
* Sub sections
* Lists
* Multiline fields
* Load & dump
* Types:
* Strings
* Integers
* Floats
====
Simple python configuration library and format. The format is very similar to YAML with the enhancment of sections.
##Installation
Install the ``lynx`` package with [pip](<https://pypi.python.org/pypi/lynx>):
pip install lynx
##Example use
Configuration example:
```
# section example
section {
# fields
field1: myfield1 value
field2: Another field value
# lists
mylist: [5, mystr, value, 8]
}
# Another section
section2 {
# sub section example
my_section {
name: lynx
}
# sections can have same name.
my_section {
# multiline fields
Library description:|
Lynx is a python
Configuration library
supporting many features
including multiline fields!$%$!%#@
Yay!
myfloat: 5.3
}
}
```
Load the configuration:
```
>>> import lynx
# Load file
>>> with open("config.conf", "r") as fp:
... config = lynx.load(fp)
# Get the first section
>>> config[0].name()
'section'
>>> config[0].fields()
{'field2': 'Another field value', 'field1': 'myfield1 value', 'mylist': [5, 'mystr', 'value', 8]}
# Get sub sections
>>> config[1].sub_sections()
[<lynx.Section object at 0x7f4ab28dfdd0>, <lynx.Section object at 0x7f4ab28dfe10>]
>>> config[1].sub_sections()[0].name()
'my_section'
```
## Features
Features include:
* Sections
* Sub sections
* Lists
* Multiline fields
* Load & dump
* Types:
* Strings
* Integers
* Floats
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lynx-0.3.1.tar.gz
(5.6 kB
view details)
File details
Details for the file lynx-0.3.1.tar.gz
.
File metadata
- Download URL: lynx-0.3.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d1d17d367ed340bb805e827926340a46bde346dbd9cb3565aad4083c0ae1a48 |
|
MD5 | 7b8222feb5e012922d9be26e58f6b400 |
|
BLAKE2b-256 | aead82353da78e6ab95fce445c44afce6a1230fffe25f57c4652f27c2ecfc447 |