/usr/lib/python2.7/dist-packages/kaptan-0.5.9.egg-info/PKG-INFO is in python-kaptan 0.5.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | Metadata-Version: 1.1
Name: kaptan
Version: 0.5.9
Summary: Configuration manager
Home-page: https://github.com/emre/kaptan
Author: Emre Yilmaz
Author-email: mail@emreyilmaz.me
License: BSD
Description-Content-Type: UNKNOWN
Description: kaptan
======
|pypi| |docs| |build-status| |coverage| |license|
configuration parser.
installation
------------
.. code-block:: console
$ pip install kaptan
Also available as a package on FreeBSD, Debian, Arch Linux and Slackware.
usage
-----
**supported handlers**
- dict
- json
- yaml
- .ini
- python file
**default (dict) handler**
.. code-block:: python
config = kaptan.Kaptan()
config.import_config({
'environment': 'DEV',
'redis_uri': 'redis://localhost:6379/0',
'debug': False,
'pagination': {
'per_page': 10,
'limit': 20,
}
})
print config.get("pagination.limit")
# output: 20
**json handler**
.. code-block:: python
config = kaptan.Kaptan(handler="json")
config.import_config('{"everything": 42}')
print config.get("everything")
# output: 42
**yaml handler**
.. code-block:: python
config = kaptan.Kaptan(handler="yaml")
config.import_config("""
product:
price:
value: 12.65
currency_list:
1. TL
2. EURO
""")
print config.get("product.price.currency_list.0")
# output: TL
or you can get from directly from the filename:
``config.import_config("configuration.yaml")``
**.ini handler**
config.ini
.. code-block:: ini
[development]
database_uri = mysql://root:123456@localhost/posts
[production]
database_uri = mysql://poor_user:poor_password@localhost/poor_posts
.. code-block:: python
config = kaptan.Kaptan(handler="ini")
config.import_config('config.ini')
print config.get("production.database_uri")
# output: mysql://poor_user:poor_password@localhost/poor_posts
**file handler**
config.py
.. code-block:: python
DATABASE = 'mysql://root:123456@localhost/posts'
DEBUG = False
PAGINATION = {
'per_page': 10,
'limit': 20,
}
.. code-block:: python
config = kaptan.Kaptan(handler="file")
config.import_config('config')
print config.get("DEBUG")
# output: False
exporting configuration
-----------------------
.. code-block:: python
config = kaptan.Kaptan(handler="file")
config.import_config({
'environment': 'DEV',
'redis_uri': 'redis://localhost:6379/0',
'debug': False,
'pagination': {
'per_page': 10,
'limit': 20,
}
})
print config.export("yaml")
**output**:
.. code-block:: yaml
debug: false
environment: DEV
pagination: {limit: 20, per_page: 10}
redis_uri: redis://localhost:6379/0
``print config.export("json")``
outputs unindented json. ``.export`` accepts kwargs which pass into
`json.dumps`.
.. _json.dumps: http://docs.python.org/2/library/json.html#json.dump
.. code-block:: python
print config.export("json", indent=4)
**output**:
.. code-block:: json
{
"environment": "DEV",
"debug": false,
"pagination": {
"per_page": 10,
"limit": 20
},
"redis_uri": "redis://localhost:6379/0"
}
``config.export('yaml')`` also supports the `kwargs for pyyaml`_.
.. _kwargs for pyyaml: http://pyyaml.org/wiki/PyYAMLDocumentation#Dumper
New in Version 0.5.7: ``config.export('yaml', safe=True)`` will use ``.safe_dump``.
cli
---
exporting (defaults to json)
.. code-block:: console
$ echo "environment: DEV" > config.yaml
$ kaptan config.yaml --export json > config.json
$ cat config.json
{"environment": "DEV"}
getting a value
.. code-block:: console
$ kaptan config.yaml --key environment
DEV
specifying the handler
.. code-block:: console
$ mv config.yaml config.settings
$ kaptan config.settings:yaml --export json
{"environment": "DEV"}
config from stdin
.. code-block:: console
$ echo '{"source": "stdin"}' | kaptan -
{"source": "stdin"}
$ echo 'source: stdin' | kaptan -:yaml
{"source": "stdin"}
merging configs
.. code-block:: console
$ echo "environment: PROD" > config.settings
$ echo '{"source": "stdin"}' | kaptan - config.json config.settings:yaml
{"environment": "PROD", "source": "stdin"}
setting default handler
.. code-block:: console
$ echo "source: stdin" | kaptan --handler yaml - config.settings
{"environment": "PROD", "source": "stdin"}
writing json with yaml
.. code-block:: console
$ kaptan -:yaml -e json
<type yaml here>
<Ctrl + D>
<get json here>
running tests
-------------
with ``py.test``:
.. code-block:: console
$ py.test
contributors
------------
- `Cenk Altı <http://github.com/cenkalti>`_
- `Wesley Bitter <http://github.com/Wessie>`_
- `Mark Steve <http://github.com/marksteve>`_
- `Tony Narlock <http://github.com/tony>`_
- `Berker Peksag <http://github.com/berkerpeksag>`_
- `Pradyun S. Gedam <https://github.com/pradyunsg>`_
see more at https://github.com/emre/kaptan/graphs/contributors.
.. |pypi| image:: https://img.shields.io/pypi/v/kaptan.svg
:alt: Python Package
:target: http://badge.fury.io/py/kaptan
.. |build-status| image:: https://img.shields.io/travis/emre/kaptan.svg
:alt: Build Status
:target: https://travis-ci.org/emre/kaptan
.. |coverage| image:: https://codecov.io/gh/emre/kaptan/branch/master/graph/badge.svg
:alt: Code Coverage
:target: https://codecov.io/gh/emre/kaptan
.. |license| image:: https://img.shields.io/github/license/emre/kaptan.svg
:alt: License
.. |docs| image:: https://readthedocs.org/projects/kaptan/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://readthedocs.org/projects/kaptan/
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
|