=====================
dict-recursive-update
=====================
.. image:: https://travis-ci.org/Maples7/dict-recursive-update.svg?branch=master
:target: https://travis-ci.org/Maples7/dict-recursive-update
.. image:: https://img.shields.io/pypi/v/dict-recursive-update.svg
:target: https://pypi.python.org/pypi/dict-recursive-update
A Python module who does recursive update work on 2 dicts.
Usage
=====
Installation
------------
.. code:: shell
pip install dict-recursive-update
Examples
--------
.. code:: python
>>> from dict_recursive_update import recursive_update
>>> recursive_update({'a': {'b': 2}}, {'a': {'b': 3, 'd': 4}, 'e': 5})
{'a': {'b': 3, 'd': 4}, 'e': 5}
>>> recursive_update('a', 'b')
Traceback (most recent call last):
...
TypeError: Params of recursive_update should be dicts
>>> recursive_update({'a': [1]}, {'a': [2], 'c': {'d': {'c': 3}}})
{'a': [2], 'c': {'d': {'c': 3}}}
>>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'b': 5})
{'a': {'c': 1, 'd': {}}, 'b': 5}
>>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'a': 2})
{'a': 2, 'b': 4}
Why?
====
This is originally designed for merge multiple configurations in different running environment such as production or stage.
As a node.js developer, package `config <https://github.com/lorenwest/node-config>`_ and `lodash <https://github.com/lodash/lodash>`_ are very handy for me. This package is the base of `a python-version config package <https://github.com/Maples7/py-config>`_.
In a normal project, there is usually a copy of default configuration, but when we deploy it, some configurations differ from default ones like database address. So a handy configuration-loading package is supposed to load right configurations according to the running environment.
License
=======
`MIT <./LICENSE.txt>`_
Raw data
{
"_id": null,
"home_page": "https://github.com/Maples7/dict-recursive-update",
"name": "dict-recursive-update",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "dict recursive update",
"author": "Maples7",
"author_email": "maples7@163.com",
"download_url": "",
"platform": "",
"description": "=====================\ndict-recursive-update\n=====================\n\n.. image:: https://travis-ci.org/Maples7/dict-recursive-update.svg?branch=master\n :target: https://travis-ci.org/Maples7/dict-recursive-update\n\n.. image:: https://img.shields.io/pypi/v/dict-recursive-update.svg\n :target: https://pypi.python.org/pypi/dict-recursive-update\n\nA Python module who does recursive update work on 2 dicts.\n\nUsage\n=====\n\nInstallation\n------------\n\n.. code:: shell\n\n pip install dict-recursive-update\n\n\nExamples\n--------\n\n.. code:: python\n\n >>> from dict_recursive_update import recursive_update\n\n >>> recursive_update({'a': {'b': 2}}, {'a': {'b': 3, 'd': 4}, 'e': 5})\n {'a': {'b': 3, 'd': 4}, 'e': 5}\n\n >>> recursive_update('a', 'b')\n Traceback (most recent call last):\n ...\n TypeError: Params of recursive_update should be dicts\n\n >>> recursive_update({'a': [1]}, {'a': [2], 'c': {'d': {'c': 3}}})\n {'a': [2], 'c': {'d': {'c': 3}}}\n\n >>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'b': 5})\n {'a': {'c': 1, 'd': {}}, 'b': 5}\n\n >>> recursive_update({'a': {'c': 1, 'd': {}}, 'b': 4}, {'a': 2})\n {'a': 2, 'b': 4}\n\n\nWhy?\n====\n\nThis is originally designed for merge multiple configurations in different running environment such as production or stage.\n\nAs a node.js developer, package `config <https://github.com/lorenwest/node-config>`_ and `lodash <https://github.com/lodash/lodash>`_ are very handy for me. This package is the base of `a python-version config package <https://github.com/Maples7/py-config>`_.\n\nIn a normal project, there is usually a copy of default configuration, but when we deploy it, some configurations differ from default ones like database address. So a handy configuration-loading package is supposed to load right configurations according to the running environment.\n\nLicense\n=======\n`MIT <./LICENSE.txt>`_\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python module who does recursive update work on 2 dicts.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/Maples7/dict-recursive-update"
},
"split_keywords": [
"dict",
"recursive",
"update"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88402cb6ba8f04590f41bb43f5ddb50217705aa6fcb9499f424160259e7e2b8c",
"md5": "8e9d6145370f3b0050540ac5b6a1523e",
"sha256": "24bfdd88ff2bf7bd85870b8c65918002638888a790f7453865bdce6f3b83f8ff"
},
"downloads": -1,
"filename": "dict_recursive_update-1.0.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e9d6145370f3b0050540ac5b6a1523e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 4413,
"upload_time": "2018-01-23T12:14:07",
"upload_time_iso_8601": "2018-01-23T12:14:07.854767Z",
"url": "https://files.pythonhosted.org/packages/88/40/2cb6ba8f04590f41bb43f5ddb50217705aa6fcb9499f424160259e7e2b8c/dict_recursive_update-1.0.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2018-01-23 12:14:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Maples7",
"github_project": "dict-recursive-update",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "dict-recursive-update"
}