uwsgiconf


Nameuwsgiconf JSON
Version 0.14.1 PyPI version JSON
download
home_pagehttps://github.com/idlesign/uwsgiconf
SummaryConfigure uWSGI from your Python code
upload_time2018-04-05 13:13:56
maintainer
docs_urlNone
authorIgor `idle sign` Starikov
requires_python
licenseBSD 3-Clause License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            uwsgiconf
=========
https://github.com/idlesign/uwsgiconf

|release| |lic| |ci| |coverage|

.. |release| image:: https://img.shields.io/pypi/v/uwsgiconf.svg
    :target: https://pypi.python.org/pypi/uwsgiconf

.. |lic| image:: https://img.shields.io/pypi/l/uwsgiconf.svg
    :target: https://pypi.python.org/pypi/uwsgiconf

.. |ci| image:: https://img.shields.io/travis/idlesign/uwsgiconf/master.svg
    :target: https://travis-ci.org/idlesign/uwsgiconf

.. |coverage| image:: https://img.shields.io/coveralls/idlesign/uwsgiconf/master.svg
    :target: https://coveralls.io/r/idlesign/uwsgiconf


**Work in progress. Stay tuned.**


Description
-----------

*Configure uWSGI from your Python code*

If you think you know uWSGI you're probably wrong. It is always more than you think it is.
There are so many subsystems and options_ (800+) it is difficult to even try to wrap your mind around.

.. _options: http://uwsgi-docs.readthedocs.io/en/latest/Options.html

**uwsgiconf** allowing to define uWSGI configurations in Python tries to improve things the following ways:

* It structures options for various subsystems using classes and methods;
* It uses docstrings and sane naming to facilitate navigation;
* It ships some useful presets to reduce boilerplate code;
* It encourages configuration reuse;
* It comes with CLI to facilitate configuration;
* It features easy to use and documented **uwsgi stub** Python module;
* It offers **runtime** package, similar to **uwsgidecorators**, but with more abstractions.


*Consider using IDE with autocompletion and docstings support to be more productive with uwsgiconf.*

By that time you already know that **uwsgiconf** is just another configuration method. Why_?

.. _Why: http://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#why-do-you-support-multiple-methods-of-configuration


Overview
--------

Static configuration
~~~~~~~~~~~~~~~~~~~~

Let's make ``uwsgicfg.py``. There we configure uWSGI using nice ``PythonSection`` preset to run our web app.

.. code-block:: python

    from uwsgiconf.config import configure_uwsgi
    from uwsgiconf.presets.nice import PythonSection


    def get_configurations():
        """This should return one or more Section or Configuration objects.
        In such a way you can configure more than one uWSGI instance in the same place.

        Here we'll define just one configuration section, which
        will instruct uWSGI to serve WSGI application (from wsgi.py module)
        on http://127.0.0.1:8000

        """
        section = PythonSection(
            wsgi_module='/home/idle/myapp/wsgi.py',

        ).networking.register_socket(
            PythonSection.networking.sockets.http('127.0.0.1:8000'))

        return section


    # Almost done. One more thing:
    configure_uwsgi(get_configurations)



1. Now if you want to generate ``myconf.ini`` file and use it for uWSGI manually you can do it with:

    .. code-block:: bash

        $ uwsgiconf compile > myconf.ini
        $ uwsgi myconf.ini

2. Or use ``uwsgiconf`` to automatically spawn uWSGI processes for configurations defined in your module:

    .. code-block:: bash

        $ uwsgiconf run


**Note:** ``uwsgiconf`` CLI requires ``click`` package available.


Runtime configuration
~~~~~~~~~~~~~~~~~~~~~

**uwsgiconf** comes with ``runtime`` package which is similar to **uwsgidecorators** but offers different abstractions.

These abstractions will also use a stub ``uwsgi`` module when the real one is not available.

A couple of examples:

.. code-block:: python

    from uwsgiconf.runtime.locking import lock
    from uwsgiconf.runtime.scheduling import register_timer_rb

    @register_timer_rb(10, repeat=2)
    def repeat_twice():
        """This function will be called twice with 10 seconds interval
        (by default in first available mule) using red-black tree based timer.

        """
        with lock():
            # Code under this context manager will be locked
            # using default (0) uWSGI lock.
            do_something()



Documentation
-------------

http://uwsgiconf.readthedocs.org/

            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "", 
    "upload_time": "2018-04-05 13:13:56", 
    "author": "Igor `idle sign` Starikov", 
    "home_page": "https://github.com/idlesign/uwsgiconf", 
    "github_user": "idlesign", 
    "download_url": "https://pypi.python.org/packages/86/ce/49d2f6dc4f06a216c5915728820d15798619d0d721bbc610e296c9ba70b8/uwsgiconf-0.14.1.tar.gz", 
    "platform": "", 
    "version": "0.14.1", 
    "cheesecake_documentation_id": null, 
    "description": "uwsgiconf\n=========\nhttps://github.com/idlesign/uwsgiconf\n\n|release| |lic| |ci| |coverage|\n\n.. |release| image:: https://img.shields.io/pypi/v/uwsgiconf.svg\n    :target: https://pypi.python.org/pypi/uwsgiconf\n\n.. |lic| image:: https://img.shields.io/pypi/l/uwsgiconf.svg\n    :target: https://pypi.python.org/pypi/uwsgiconf\n\n.. |ci| image:: https://img.shields.io/travis/idlesign/uwsgiconf/master.svg\n    :target: https://travis-ci.org/idlesign/uwsgiconf\n\n.. |coverage| image:: https://img.shields.io/coveralls/idlesign/uwsgiconf/master.svg\n    :target: https://coveralls.io/r/idlesign/uwsgiconf\n\n\n**Work in progress. Stay tuned.**\n\n\nDescription\n-----------\n\n*Configure uWSGI from your Python code*\n\nIf you think you know uWSGI you're probably wrong. It is always more than you think it is.\nThere are so many subsystems and options_ (800+) it is difficult to even try to wrap your mind around.\n\n.. _options: http://uwsgi-docs.readthedocs.io/en/latest/Options.html\n\n**uwsgiconf** allowing to define uWSGI configurations in Python tries to improve things the following ways:\n\n* It structures options for various subsystems using classes and methods;\n* It uses docstrings and sane naming to facilitate navigation;\n* It ships some useful presets to reduce boilerplate code;\n* It encourages configuration reuse;\n* It comes with CLI to facilitate configuration;\n* It features easy to use and documented **uwsgi stub** Python module;\n* It offers **runtime** package, similar to **uwsgidecorators**, but with more abstractions.\n\n\n*Consider using IDE with autocompletion and docstings support to be more productive with uwsgiconf.*\n\nBy that time you already know that **uwsgiconf** is just another configuration method. Why_?\n\n.. _Why: http://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#why-do-you-support-multiple-methods-of-configuration\n\n\nOverview\n--------\n\nStatic configuration\n~~~~~~~~~~~~~~~~~~~~\n\nLet's make ``uwsgicfg.py``. There we configure uWSGI using nice ``PythonSection`` preset to run our web app.\n\n.. code-block:: python\n\n    from uwsgiconf.config import configure_uwsgi\n    from uwsgiconf.presets.nice import PythonSection\n\n\n    def get_configurations():\n        \"\"\"This should return one or more Section or Configuration objects.\n        In such a way you can configure more than one uWSGI instance in the same place.\n\n        Here we'll define just one configuration section, which\n        will instruct uWSGI to serve WSGI application (from wsgi.py module)\n        on http://127.0.0.1:8000\n\n        \"\"\"\n        section = PythonSection(\n            wsgi_module='/home/idle/myapp/wsgi.py',\n\n        ).networking.register_socket(\n            PythonSection.networking.sockets.http('127.0.0.1:8000'))\n\n        return section\n\n\n    # Almost done. One more thing:\n    configure_uwsgi(get_configurations)\n\n\n\n1. Now if you want to generate ``myconf.ini`` file and use it for uWSGI manually you can do it with:\n\n    .. code-block:: bash\n\n        $ uwsgiconf compile > myconf.ini\n        $ uwsgi myconf.ini\n\n2. Or use ``uwsgiconf`` to automatically spawn uWSGI processes for configurations defined in your module:\n\n    .. code-block:: bash\n\n        $ uwsgiconf run\n\n\n**Note:** ``uwsgiconf`` CLI requires ``click`` package available.\n\n\nRuntime configuration\n~~~~~~~~~~~~~~~~~~~~~\n\n**uwsgiconf** comes with ``runtime`` package which is similar to **uwsgidecorators** but offers different abstractions.\n\nThese abstractions will also use a stub ``uwsgi`` module when the real one is not available.\n\nA couple of examples:\n\n.. code-block:: python\n\n    from uwsgiconf.runtime.locking import lock\n    from uwsgiconf.runtime.scheduling import register_timer_rb\n\n    @register_timer_rb(10, repeat=2)\n    def repeat_twice():\n        \"\"\"This function will be called twice with 10 seconds interval\n        (by default in first available mule) using red-black tree based timer.\n\n        \"\"\"\n        with lock():\n            # Code under this context manager will be locked\n            # using default (0) uWSGI lock.\n            do_something()\n\n\n\nDocumentation\n-------------\n\nhttp://uwsgiconf.readthedocs.org/\n", 
    "tox": true, 
    "lcname": "uwsgiconf", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": true, 
    "name": "uwsgiconf", 
    "license": "BSD 3-Clause License", 
    "travis_ci": true, 
    "github_project": "uwsgiconf", 
    "summary": "Configure uWSGI from your Python code", 
    "split_keywords": [], 
    "author_email": "idlesign@yandex.ru", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2018-04-05T13:13:59", 
            "comment_text": "", 
            "python_version": "2.7", 
            "url": "https://pypi.python.org/packages/b9/86/763b876992c4990abe527b2b49e3ec7381bd628bd69967560b004c242e1b/uwsgiconf-0.14.1-py2.py3-none-any.whl", 
            "md5_digest": "fd8244766b6e9aff03a1bd053367c113", 
            "downloads": 0, 
            "filename": "uwsgiconf-0.14.1-py2.py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "b9/86/763b876992c4990abe527b2b49e3ec7381bd628bd69967560b004c242e1b/uwsgiconf-0.14.1-py2.py3-none-any.whl", 
            "digests": {
                "sha256": "24d9b9c4b9dde73eef7b62e32f0b343874deb124d696adba81164b159d511748", 
                "md5": "fd8244766b6e9aff03a1bd053367c113"
            }, 
            "sha256_digest": "24d9b9c4b9dde73eef7b62e32f0b343874deb124d696adba81164b159d511748", 
            "size": 146348
        }, 
        {
            "has_sig": false, 
            "upload_time": "2018-04-05T13:13:56", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/86/ce/49d2f6dc4f06a216c5915728820d15798619d0d721bbc610e296c9ba70b8/uwsgiconf-0.14.1.tar.gz", 
            "md5_digest": "49b19eee5ef9e0693cf142fe27c695a3", 
            "downloads": 0, 
            "filename": "uwsgiconf-0.14.1.tar.gz", 
            "packagetype": "sdist", 
            "path": "86/ce/49d2f6dc4f06a216c5915728820d15798619d0d721bbc610e296c9ba70b8/uwsgiconf-0.14.1.tar.gz", 
            "digests": {
                "sha256": "7d2551d200aa3effcb13a65d92e5ef92de92735272ddecf375fb06e80160e8ed", 
                "md5": "49b19eee5ef9e0693cf142fe27c695a3"
            }, 
            "sha256_digest": "7d2551d200aa3effcb13a65d92e5ef92de92735272ddecf375fb06e80160e8ed", 
            "size": 123393
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}