{"id":19035769,"url":"https://github.com/paylogic/settei","last_synced_at":"2025-04-17T14:33:22.265Z","repository":{"id":12493484,"uuid":"15163013","full_name":"paylogic/settei","owner":"paylogic","description":"Config system which based on setuptools' entry points.","archived":true,"fork":false,"pushed_at":"2014-06-28T20:50:32.000Z","size":289,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-02-21T21:38:09.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paylogic.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-13T12:25:53.000Z","updated_at":"2024-07-01T09:50:49.000Z","dependencies_parsed_at":"2022-09-13T20:31:37.100Z","dependency_job_id":null,"html_url":"https://github.com/paylogic/settei","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paylogic%2Fsettei","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paylogic%2Fsettei/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paylogic%2Fsettei/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paylogic%2Fsettei/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paylogic","download_url":"https://codeload.github.com/paylogic/settei/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249348701,"owners_count":21255306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:52:02.611Z","updated_at":"2025-04-17T14:33:21.973Z","avatar_url":"https://github.com/paylogic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Settei: Config system which bases on entry points of setuptools\n===============================================================\n\nThe ``settei`` package is a library which gives you possibility to get config settings from entry points for\nspecific application and environment.\nGeneric purpose python settings library which uses entry points as a registry.\n\nIntroduces terms ``application`` and ``environment``:\n\n- ``application`` is part of group's name in which you are storing entry points\n\n- ``environment`` is name of entry point\n\n\n.. image:: https://api.travis-ci.org/paylogic/settei.png\n   :target: https://travis-ci.org/paylogic/settei\n.. image:: https://pypip.in/v/settei/badge.png\n   :target: https://crate.io/packages/settei/\n.. image:: https://coveralls.io/repos/paylogic/settei/badge.png?branch=master\n   :target: https://coveralls.io/r/paylogic/settei\n\n\nInstallation\n------------\n\n.. sourcecode::\n\n    pip install settei\n\n\nUsage\n-----\n\nFirst of all you need to create entry points and put them into group, group comprises from two parts first of them is prefix\n``settings_`` and second one is name of your application, e.g. ``settings_backoffice`` or ``settings_frontoffice``\nwhere ``backoffice`` or ``frontoffice`` is your application.\n\n.. code-block:: python\n\n    # in your setup.py\n    setup (\n        # ...\n        entry_points = {\n            'settings_frontoffice': [\n                'default = path.to.package.of.frontoffice.default_settings:generate_config',\n                'local= path.to.package.of.frontoffice.local_settings:generate_config',\n            ],\n            'settings_backoffice': [\n                'default = path.to.package.of.backoffice.default_settings:generate_config',\n                'local= path.to.package.of.backoffice.local_settings:generate_config',\n            ]\n        }\n        # ...\n    )\n\nThe ``generate_config`` function should return instance of ``settei.config.Config`` class.\n\n.. code-block:: python\n\n    # default_settings.py\n    from settei.config import Config\n\n\n    def generate_config():\n        config = Config()\n\n        # adding some settings\n        config['QUESTION'] = 'The Ultimate Question of Life, the Universe, and Everything'\n        config['ANSWER'] = 41\n\n        # or loading them from object\n        config.from_pyfile('full/path/to/file.py')\n\n        # or from object\n        config.from_object('path.to.object')\n\n        return config\n\nYou can also do inheriting one settings by others but only inside group of entry points, e.g if you want to inherit\ndefault settings by local settings you just should mention name of entry point which you want to inherit\n\n.. code-block:: python\n\n    # in your local_settings.py file\n    def generate_config(default):\n\n        # changing settings, the right answer is 42\n        default['ANSWER'] = 42\n\n        return default\n\nAnd if in your code you will get local settings and check them\n\n.. code-block:: python\n\n    \u003e\u003e from settei import get_config\n    \u003e\u003e config = get_config('frontoffice', 'local')\n    \u003e\u003e print config['QUESTION']\n    The Ultimate Question of Life, the Universe, and Everything\n    \u003e\u003e print config['ANSWER']\n    42\n\nThen you will need to install your package and after it with ``settei`` you will be able to get config settings for your\napplication.\n\n.. code-block:: python\n\n    from settei import get_config\n\n    # get config settings for frontoffice application and local environment\n    config = get_config('frontoffice', 'local')\n\n    # get config settings for backoffice application and local environment\n    config = get_config('backoffice', 'local')\n\n    # now you can use it as you want\n    DEBUG = config['DEBUG']\n\n.. code-block:: bash\n\n    # you can also get environment from CONFIG_ENVIRONMENT\n    # just run your script/application in this way\n    $ env CONFIG_ENVIRONMENT='dev' python my_incredible_script.py\n\n\n.. code-block:: python\n\n    # and in script you can use get_config like\n    from settei import get_config\n\n    # get config settings for frontoffice application and dev environment because we have already specified environment\n    config = get_config('frontoffice')\n\n\nContact\n-------\n\nIf you have questions, bug reports, suggestions, etc. please create an issue on\nthe `GitHub project page \u003chttp://github.com/paylogic/settei\u003e`_.\n\n\nLicense\n-------\n\nThis software is licensed under the `MIT license \u003chttp://en.wikipedia.org/wiki/MIT_License\u003e`_\n\nSee `\u003cLICENSE.txt\u003e`_\n\n© 2013 Paylogic International.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaylogic%2Fsettei","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaylogic%2Fsettei","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaylogic%2Fsettei/lists"}