Skip to main content

Access application configuration using dot notation

Project description

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description:
# dotdotdot

A minimalist python library to access application configuration using dot notation.

---
## Usage
```bash
(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
```bash
(3.6) nehar@mac ~/s/dotdotdot ๐“๐“ฎ๐“ฑ๐“ช๐“ป > python setup.py bdist_wheel
```

---
## Installation
```bash
(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
```

Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown

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.6.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

dotdotdot-1.0.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file dotdotdot-1.0.6.tar.gz.

File metadata

  • Download URL: dotdotdot-1.0.6.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.6

File hashes

Hashes for dotdotdot-1.0.6.tar.gz
Algorithm Hash digest
SHA256 078ec19da261d0c5628508cb69311a10ca9f896b0900b95f783a96d67d199ddb
MD5 c9505cbc1faa368f05692e59d02d3a31
BLAKE2b-256 52ed784b11dccc9e9c92c3332da5a6f616d5d87f34da4cbf3e000caa85f0e17e

See more details on using hashes here.

File details

Details for the file dotdotdot-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: dotdotdot-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.6

File hashes

Hashes for dotdotdot-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5bac0cd736d0c29eddd81d22611c408e69c83f9eaf47e2eb85a46ab46285d167
MD5 836f705c739ce3f6916798394b7e814c
BLAKE2b-256 49bb86377e5b56f4e29d76e28e7b65b005f38a546c9607350d2f0e255f7baac1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page