{ "info": { "author": "Pierre Baillet", "author_email": "pierre@baillet.name", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "===============================\nfwissr\n===============================\n\n.. image:: https://badge.fury.io/py/fwissr.png\n :target: http://badge.fury.io/py/fwissr\n \n.. image:: https://travis-ci.org/fotonauts/fwissr-python.png?branch=master\n :target: https://travis-ci.org/fotonauts/fwissr-python\n\n.. image:: https://pypip.in/d/fwissr/badge.png\n :target: https://crate.io/packages/fwissr?version=latest\n\n\nfwissr-python is a registry configuration tool, compatible with fwissr, its ruby counterpart. Made by fotonauts.\n\n* Free software: MIT license\n* Documentation: http://fwissr-python.rtfd.org.\n\nInstall\n=======\n\n\n``$ [sudo] pip install fwissr``\n\nUsage\n=====\n\nCreate the main ``fwissr.json`` configuration file in either ``/etc/fwissr/`` or ``~/.fwissr/`` directory::\n\n {\n \"foo\" : \"bar\",\n \"horn\" : { \"loud\" : true, \"sounds\": [ \"TUuuUuuuu\", \"tiiiiiiIIiii\" ] }\n }\n\nIn your application, you can access ``fwissr``'s global registry that way::\n\n\n from fwissr.fwissr import Fwissr\n Fwissr['/foo']\n # u'bar'\n Fwissr['/horn']\n # {u'sounds': [u'TUuuUuuuu', u'tiiiiiiIIiii'], u'loud': True}\n Fwissr['/horn/loud']\n # True\n Fwissr['/horn/sounds']\n # [u'TUuuUuuuu', u'tiiiiiiIIiii']\n\n\nIn bash you can call the `fwissr` tool::\n\n $ fwissr /foo\n bar\n\n # json output\n $ fwissr -j /horn\n {\"loud\": true, \"sounds\": [\"TUuuUuuuu\", \"tiiiiiiIIiii\"]}\n\n # pretty print json output\n $ fwissr -j -p /horn\n {\n \"loud\": true,\n \"sounds\": [\n \"TUuuUuuuu\",\n \"tiiiiiiIIiii\"\n ]\n }\n\n # dump all registry with pretty print json output\n # NOTE: yes, that's the same as 'fwissr -jp /'\n $ fwissr --dump -jp\n {\n \"horn\": {\n \"loud\": true,\n \"sound\": [\n \"TUuuUuuuu\",\n \"tiiiiiiIIiii\"\n ]\n }\n }\n\n\n\nAdditional configuration file\n=============================\n\nProvide additional configuration files with the ``fwissr_sources`` setting in ``fwissr.json``::\n\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/etc/my_app.json\" }\n ]\n }\n\n\nThe settings for that configuration will be prefixed with the file name.\n\nFor example, with that ``/etc/my_app.json``::\n\n { \"foo\": \"bar\", \"bar\": \"baz\" }\n\nthe settings can be accessed that way::\n\n from fwissr.fwissr import Fwissr\n \n Fwissr['/my_app']\n #=> { \"foo\": \"bar\", \"bar\": \"baz\" }\n \n Fwissr['/my_app/foo']\n #=> \"bar\"\n\n Fwissr['/my_app/bar']\n #=> \"baz\"\n\nYou can bypass that behaviour with the ``top_level`` setting::\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/etc/my_app.json\", \"top_level\": true }\n ]\n }\n\n\nWith the ``top_level`` setting activated the configuration settings are added to registry root::\n\n from fwissr.fwissr import Fwissr\n\n Fwissr['/']\n #=> { \"foo\": \"bar\", \"bar\": \"baz\" }\n\n Fwissr['/foo']\n #=> \"bar\"\n\n Fwissr['/bar']\n #=> \"baz\"\n\n\nNote that you can provide ``.json`` and ``.yaml`` configuration files.\n\n\nDirectory of configuration files\n================================\n\nIf the ``filepath`` setting is a directory, then all ``.json`` and ``.yaml`` files in that directory (but NOT in subdirectories) will be imported in the global registry::\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/mnt/my_app/conf/\" },\n ],\n }\n\n\nWith ``/mnt/my_app/conf/database.yaml``::\n\n production:\n adapter: mysql2\n encoding: utf8\n database: my_app_db\n username: my_app_user\n password: my_app_pass\n host: db.my_app.com\n\n\nand ``/mnt/my_app/conf/credentials.json``::\n\n { \"key\": \"i5qw64816c\", \"code\": \"448e4wef161\" }\n\n\nthe settings can be accessed that way::\n\n from fwissr.fwissr import Fwissr\n\n Fwissr['/database']\n #=> { \"production\": { \"adapter\": \"mysql2\", \"encoding\": \"utf8\", \"database\": \"my_app_db\", \"username\": \"my_app_user\", \"password\": \"my_app_pass\", \"host\": \"db.my_app.com\" } }\n\n Fwissr['/database/production/host']\n #=> \"db.my_app.com\"\n\n Fwissr['/credentials']\n #=> { \"key\": \"i5qw64816c\", \"code\": \"448e4wef161\" }\n\n Fwissr['/credentials/key']\n #=> \"i5qw64816c\"\n\n\nFile name mapping to setting path\n=================================\n\nUse dots in file name to define a path for configuration settings.\n\nFor example::\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/etc/my_app.database.slave.json\" }\n ]\n }\n\nwith that ``/etc/my_app.database.slave.json``::\n\n\n { \"host\": \"db.my_app.com\", \"port\": \"1337\" }\n\nThe settings can be accessed that way::\n\n from fwissr.fwissr import Fwissr\n\n Fwissr['/my_app/database/slave/host']\n #=> \"db.my_app.com\"\n\n Fwissr['/my_app/database/slave/port']\n #=> \"1337\"\n\n\nMongodb source\n==============\n\nYou can define a mongob collection as a configuration source::\n\n {\n \"fwissr_sources\": [\n { \"mongodb\": \"mongodb://db1.example.net/my_app\", \"collection\": \"config\" }\n ]\n }\n\n\nEach document in the collection is a setting for that configuration.\n\nThe ``_id`` document field is the setting key, and the ``value`` document field is the setting value.\n\nFor example::\n\n > db[\"my_app.stuff\"].find()\n { \"_id\" : \"foo\", \"value\" : \"bar\" }\n { \"_id\" : \"database\", \"value\" : { \"host\": \"db.my_app.com\", \"port\": \"1337\" } }\n\n::\n\n from fwissr.fwissr import Fwissr\n\n Fwissr['/my_app/stuff/foo']\n #=> \"bar\"\n\n Fwissr['/my_app/stuff/database']\n #=> { \"host\": \"db.my_app.com\", \"port\": \"1337\" }\n\n Fwissr['/my_app/stuff/database/port']\n #=> \"1337\"\n\nAs with configuration files you can use dots in collection name to define a path for configuration settings. The ``top_level`` setting is also supported to bypass that behaviour. Note too that the ``fwissr`` collection is by default a ``top_level`` configuration (as the ``/etc/fwissr/fwissr.json`` configuration file).\n\n\nRefreshing registry\n===================\n\nEnable registry auto-update with the `refresh` source setting.\n\nFor example::\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/etc/my_app/my_app.json\" },\n { \"filepath\": \"/etc/my_app/stuff.json\", \"refresh\": true },\n { \"mongodb\": \"mongodb://db1.example.net/my_app\", \"collection\": \"production\" },\n { \"mongodb\": \"mongodb://db1.example.net/my_app\", \"collection\": \"config\", \"refresh\": true }\n ]\n }\n\nThe ``/etc/my_app/my_app.json`` configuration file and the ``production`` mongodb collection are read only once, whereas the settings holded by the ``/etc/my_app/stuff.json`` configuration file and the ``config`` mongodb collection are expired periodically and re-fetched.\n\nThe default freshness is 30 seconds, but you can change it with the ``fwissr_refresh_period`` setting::\n\n {\n \"fwissr_sources\": [\n { \"filepath\": \"/etc/my_app/my_app.json\" },\n { \"filepath\": \"/etc/my_app/stuff.json\", \"refresh\": true },\n { \"mongodb\": \"mongodb://db1.example.net/my_app\", \"collection\": \"production\" },\n { \"mongodb\": \"mongodb://db1.example.net/my_app\", \"collection\": \"config\", \"refresh\": true }\n ],\n \"fwissr_refresh_period\": 60\n }\n\nThe refresh is done periodically in a thread::\n\n from fwissr.fwissr import Fwissr\n import time\n\n Fwissr['/stuff/foo']\n #=> \"bar\"\n\n # > Change '/etc/my_app/stuff.json' file by setting: {\"foo\":\"baz\"}\n\n # Wait 2 minutes\n time.sleep(120)\n\n # The new value is now in the registry\n Fwissr['/stuff/foo']\n #=> \"baz\"\n\n\nCreate a custom registry\n========================\n\n``fwissr`` is intended to be easy to setup: just create a configuration file and that configuration is accessible via the global registry. But if you need to, you can create your own custom registry::\n\n from fwissr.fwissr import Fwissr\n from fwissr.registry import Registry\n from fwissr.source.source import Source\n # create a custom registry\n registry = Registry(refresh_period=20)\n\n # add configuration sources to registry\n registry.add_source(Source.from_settings({ 'filepath': '/etc/my_app/my_app.json' }))\n registry.add_source(Source.from_settings({ 'filepath': '/etc/my_app/stuff.json', 'refresh': true }))\n registry.add_source(Source.from_settings({ 'mongodb': 'mongodb://db1.example.net/my_app', 'collection': 'production' }))\n registry.add_source(Source.from_settings({ 'mongodb': 'mongodb://db1.example.net/my_app', 'collection': 'config', 'refresh': True }))\n\n registry['/stuff/foo']\n #=> 'bar'\n\nCreate a custom source\n======================\n\nCurrently ``fwissr.source.file.File`` and ``fwissr.source.mongodb.Mongodb`` are the two kinds of possible registry sources, but you can define your own source:\n\n\nTODO\n\n\nCredits\n=======\n\nThe Fotonauts team: http://www.fotopedia.com\n\nCopyright (c) 2013 Fotonauts released under the MIT license.\n\n\n\n\nHistory\n-------\n\n0.1.1 (2013-11-04)\n++++++++++++++++++\n* Dictionary provided by API is now Read only\n\n0.1.0 (2013-11-01)\n++++++++++++++++++\n\n* First release on PyPI.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fotonauts/fwissr-python", "keywords": "fwissr", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "fwissr", "package_url": "https://pypi.org/project/fwissr/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/fwissr/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/fotonauts/fwissr-python" }, "release_url": "https://pypi.org/project/fwissr/1.0.5/", "requires_dist": null, "requires_python": null, "summary": "fwissr is a registry configuration tool.", "version": "1.0.5" }, "last_serial": 936498, "releases": { "0.1.0": [], "1.0.0": [ { "comment_text": "", "digests": { "md5": "cbf5e04308a2d746eed328af6f6bcba6", "sha256": "041a421f21d4101cf4cfb7cbda997b12ea2960741234533a8daa02e45cc4d9b1" }, "downloads": -1, "filename": "fwissr-1.0.0.tar.gz", "has_sig": false, "md5_digest": "cbf5e04308a2d746eed328af6f6bcba6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12153, "upload_time": "2013-12-03T14:08:55", "url": "https://files.pythonhosted.org/packages/8f/19/39a2d10f6fe03ef942f41f17d9d045ce26a91c2b3a5b8365669b3b183b13/fwissr-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "71b17bfcd4ed06f4ba34ca7ce3657fea", "sha256": "7d32643d21c55787124b1f86375cf660e031e1254a52b08106f2f8b4f4227f6f" }, "downloads": -1, "filename": "fwissr-1.0.1.tar.gz", "has_sig": false, "md5_digest": "71b17bfcd4ed06f4ba34ca7ce3657fea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12155, "upload_time": "2013-12-03T14:21:33", "url": "https://files.pythonhosted.org/packages/7f/0a/87d3938a1aa8a437599af2caa2dd31a8bea07adf8bcf80bd672e8ebe8c01/fwissr-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "8c34200d41cf4c5ba0612f192a60ddd3", "sha256": "63699114895c04fa424cc8afd8b9349b137dc7bf3258876035be1153f7d6b200" }, "downloads": -1, "filename": "fwissr-1.0.2.tar.gz", "has_sig": false, "md5_digest": "8c34200d41cf4c5ba0612f192a60ddd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12122, "upload_time": "2013-12-03T16:01:32", "url": "https://files.pythonhosted.org/packages/46/75/3e970cfaddeb0e9051e761e9e703389d47a863efa6507850616e0fac8249/fwissr-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "16480b6a03b729f1f860c20ce20fc715", "sha256": "b345c793c14c7b277ca0a8fb3e83d31c5d30d2ededf124856eb4a7e01a0edbe0" }, "downloads": -1, "filename": "fwissr-1.0.3.tar.gz", "has_sig": false, "md5_digest": "16480b6a03b729f1f860c20ce20fc715", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12249, "upload_time": "2013-12-04T09:40:33", "url": "https://files.pythonhosted.org/packages/e9/d4/f25c381f55e89e7e5f8dfa71b7c64c90206425d29c02772ca828dc4de492/fwissr-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "24dbd29c4f0139332cd48549be16a266", "sha256": "1fc1cb278525d4d16cd955d9b2d66877256fd01a83529cc1666e268775022afc" }, "downloads": -1, "filename": "fwissr-1.0.4.tar.gz", "has_sig": false, "md5_digest": "24dbd29c4f0139332cd48549be16a266", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12380, "upload_time": "2013-12-04T10:40:53", "url": "https://files.pythonhosted.org/packages/b6/bc/b9aaef5385e8580374f5fd5d50602692af1846fd2a4d1875706a53208d7a/fwissr-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "c04ab251bb020f5e113ba580a5c8ffe1", "sha256": "53a71201c92f9d9dc016631c2d32a9e12d7cf632fd55312842058da6bc50f242" }, "downloads": -1, "filename": "fwissr-1.0.5.tar.gz", "has_sig": false, "md5_digest": "c04ab251bb020f5e113ba580a5c8ffe1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12434, "upload_time": "2013-12-05T08:47:21", "url": "https://files.pythonhosted.org/packages/01/0e/8ea578db0077bfe714452f06869254abd7809599be16f4e5c3f425b062b3/fwissr-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c04ab251bb020f5e113ba580a5c8ffe1", "sha256": "53a71201c92f9d9dc016631c2d32a9e12d7cf632fd55312842058da6bc50f242" }, "downloads": -1, "filename": "fwissr-1.0.5.tar.gz", "has_sig": false, "md5_digest": "c04ab251bb020f5e113ba580a5c8ffe1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12434, "upload_time": "2013-12-05T08:47:21", "url": "https://files.pythonhosted.org/packages/01/0e/8ea578db0077bfe714452f06869254abd7809599be16f4e5c3f425b062b3/fwissr-1.0.5.tar.gz" } ] }