Access application configuration using dot notation
Project description
dotdotdot
A minimalist python library to access application configuration using dot notation.
Usage
(dot3.6) narora@nararombp ~/s/d/tests ๐๐ฎ๐ฑ๐ช๐ป > cat test_config.yml
test:
nest:
inty: 1
stringy: 'string'
listy: [1]
(dot3.6) narora@nararombp ~/s/d/tests ๐๐ฎ๐ฑ๐ช๐ป > python
Python 3.6.4 (default, Dec 21 2017, 20:32:22)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotdotdot as dot
>>> c = dot.load('test_config.yml')
>>> type(c)
<class 'dotdotdot.config.Config'>
>>> type(c.test)
<class 'dotdotdot.config.test'>
>>> type(c.test.nest)
<class 'dotdotdot.config.nest'>
>>> type(c.test.nest.inty)
<class 'int'>
>>> type(c.test.nest.stringy)
<class 'str'>
>>> type(c.test.nest.listy)
<class 'list'>
>>> c.test.nest.inty
1
>>> c.test.nest.stringy
'string'
>>> c.test.nest.listy
[1]
>>>
Run tests
- Python 2.7
(dot2.7) nehar@nehar-macbook ~/D/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป > pytest
=============== test session starts ===============
platform darwin -- Python 2.7.15, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/nehar/Documents/src/dotdotdot, inifile: pytest.ini
plugins: pep8-1.0.6, flake8-1.0.4
collected 3 items
tests/test_config.py ... [100%]
=============== deprecated python version ===============
You are using Python 2.7.15, which will no longer be supported in pytest 5.0
For more information, please read:
https://docs.pytest.org/en/latest/py27-py34-deprecation.html
=============== 3 passed in 0.10 seconds ===============
(dot2.7) nehar@nehar-macbook ~/D/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป >
- Python 3.7
(dot2.7) nehar@nehar-macbook ~/D/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป > vf activate dot3.7
(dot3.7) nehar@nehar-macbook ~/D/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป > pytest
/Users/nehar/venvs/dot3.7/lib/python3.7/site-packages/pep8.py:110: FutureWarning: Possible nested set at position 1
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
=============== test session starts ===============
platform darwin -- Python 3.7.1, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: /Users/nehar/Documents/src/dotdotdot, inifile: pytest.ini
plugins: pep8-1.0.6, flake8-1.0.4
collected 3 items
tests/test_config.py ... [100%]
=============== 3 passed in 0.09 seconds ===============
(dot3.7) nehar@nehar-macbook ~/D/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป >
Building the wheel
(3.6) nehar@mac ~/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป > python setup.py bdist_wheel
Installation
(3.6) nehar@mac ~/s/dotdotdot ๐๐ฎ๐ฑ๐ช๐ป > pip install dist/dotdotdot-1.0.0-py3-none-any.whl
Processing ./dist/dist/dotdotdot-1.0.0-py3-none-any.whl
Installing collected packages: dotdotdot
Successfully installed dotdotdot-1.0.0
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
dotdotdot-1.0.12.tar.gz
(6.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotdotdot-1.0.12.tar.gz.
File metadata
- Download URL: dotdotdot-1.0.12.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ee00cfa7c6bc5b9840ea9693f9a0f0fea1475cdb5397189406c48cf91590bf
|
|
| MD5 |
426d7b345982b504521c7c5e346dc2b7
|
|
| BLAKE2b-256 |
ee296db1795f3056c3a343478b59b2993a5b5e3335bd153f5c6a96953eec4438
|
File details
Details for the file dotdotdot-1.0.12-py3-none-any.whl.
File metadata
- Download URL: dotdotdot-1.0.12-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be7532579aecd5f37e6f63c0a457c56cf8b80b809eea582ceaf545ac34b631da
|
|
| MD5 |
b7618d2e1beb28b78501055b9052e0c4
|
|
| BLAKE2b-256 |
772af968a035919cf8d71dc096fb693e36416fe9e668276ba8916063c77f11b9
|