muffin-peewee-aio


Namemuffin-peewee-aio JSON
Version 0.16.1 PyPI version JSON
download
home_pagehttps://github.com/klen/muffin-peewee
SummaryPeewee-AIO integration for Muffin framework
upload_time2023-07-27 06:19:37
maintainer
docs_urlNone
authorKirill Klenov
requires_python>=3.8,<4.0
licenseMIT
keywords peewee sql orm asyncio muffin
VCS
bugtrack_url
requirements aio-peewee muffin peewee peewee-migrate
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Muffin Peewee AIO
#################

.. _description:

**muffin-peewee-aio** -- Peewee_ ORM integration to Muffin_ framework.

.. _badges:

.. image:: https://github.com/klen/muffin-peewee-aio/workflows/tests/badge.svg
    :target: https://github.com/klen/muffin-peewee-aio/actions
    :alt: Tests Status

.. image:: https://img.shields.io/pypi/v/muffin-peewee-aio
    :target: https://pypi.org/project/muffin-peewee-aio/
    :alt: PYPI Version

.. image:: https://img.shields.io/pypi/pyversions/muffin-peewee-aio
    :target: https://pypi.org/project/muffin-peewee-aio/
    :alt: Python Versions

.. _contents:

.. contents::

.. _requirements:

Requirements
=============

- python >= 3.8

.. _installation:

Installation
=============

**Muffin Peewee** should be installed using pip: ::

    $ pip install muffin-peewee-aio

You can install optional database drivers with: ::

    $ pip install muffin-peewee-aio[aiosqlite]
    $ pip install muffin-peewee-aio[aiopg]
    $ pip install muffin-peewee-aio[asyncpg]
    $ pip install muffin-peewee-aio[aiomysql]


.. _usage:

Usage
=====

.. code-block:: python

    from muffin import Application
    from muffin_peewee import Plugin as Peewee

    # Create Muffin Application
    app = Application('example')

    # Initialize the plugin
    # As alternative: db = Peewee(app, **options)
    db = Peewee()
    db.setup(app, PEEWEE_CONNECTION='postgresql://postgres:postgres@localhost:5432/database')


Options
-------

=========================== ======================================= ===========================
Name                        Default value                           Desctiption
--------------------------- --------------------------------------- ---------------------------
**CONNECTION**              ``sqlite:///db.sqlite``                 Database URL
**CONNECTION_PARAMS**       ``{}``                                  Additional params for DB connection
**AUTO_CONNECTION**         ``True``                                Automatically get a connection from db for a request
**AUTO_TRANSACTION**        ``True``                                Automatically wrap a request into a transaction
**MIGRATIONS_ENABLED**      ``True``                                Enable migrations with
**MIGRATIONS_PATH**         ``"migrations"``                        Set path to the migrations folder
**PYTEST_SETUP_DB**         ``True``                                Manage DB schema and connection in pytest
=========================== ======================================= ===========================

You are able to provide the options when you are initiliazing the plugin:

.. code-block:: python

    db.setup(app, connection='DB_URL')


Or setup it inside ``Muffin.Application`` config using the ``PEEWEE_`` prefix:

.. code-block:: python

   PEEWEE_CONNECTION = 'DB_URL'

``Muffin.Application`` configuration options are case insensitive

Queries
-------

.. code-block:: python

    class Test(db.Model):
        data = peewee.CharField()


    @app.route('/')
    async def view(request):
        return [t.data async for t in Test.select()]

Manage connections
------------------

.. code-block:: python

    # Set configuration option `MANAGE_CONNECTIONS` to False

    # Use context manager
    @app.route('/')
    async def view(request):
        # Aquire a connection
        async with db.manager.connection():
            # Work with db
            # ...


Migrations
----------

Create migrations: ::

    $ muffin example:app peewee-create [NAME] [--auto]


Run migrations: ::

    $ muffin example:app peewee-migrate [NAME] [--fake]


Rollback migrations: ::

    $ muffin example:app peewee-rollback [NAME]


List migrations: ::

    $ muffin example:app peewee-list


Clear migrations from DB: ::

    $ muffin example:app peewee-clear


Merge migrations: ::

    $ muffin example:app peewee-merge


.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/muffin-peewee-aio/issues

.. _contributing:

Contributing
============

Development of Muffin Peewee happens at: https://github.com/klen/muffin-peewee-aio


Contributors
=============

* klen_ (Kirill Klenov)

.. _license:

License
========

Licensed under a `MIT license`_.

.. _links:

.. _MIT license: http://opensource.org/licenses/MIT
.. _Muffin: https://github.com/klen/muffin
.. _Peewee: http://docs.peewee-orm.com/en/latest/
.. _klen: https://github.com/klen

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/muffin-peewee",
    "name": "muffin-peewee-aio",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "peewee,sql,orm,asyncio,muffin",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3d/f8/598f855f01a17a9e7dd9ef3bd82d8d0c3ce49c1094c00aa88b296abd2508/muffin_peewee_aio-0.16.1.tar.gz",
    "platform": null,
    "description": "Muffin Peewee AIO\n#################\n\n.. _description:\n\n**muffin-peewee-aio** -- Peewee_ ORM integration to Muffin_ framework.\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin-peewee-aio/workflows/tests/badge.svg\n    :target: https://github.com/klen/muffin-peewee-aio/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-peewee-aio\n    :target: https://pypi.org/project/muffin-peewee-aio/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin-peewee-aio\n    :target: https://pypi.org/project/muffin-peewee-aio/\n    :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python >= 3.8\n\n.. _installation:\n\nInstallation\n=============\n\n**Muffin Peewee** should be installed using pip: ::\n\n    $ pip install muffin-peewee-aio\n\nYou can install optional database drivers with: ::\n\n    $ pip install muffin-peewee-aio[aiosqlite]\n    $ pip install muffin-peewee-aio[aiopg]\n    $ pip install muffin-peewee-aio[asyncpg]\n    $ pip install muffin-peewee-aio[aiomysql]\n\n\n.. _usage:\n\nUsage\n=====\n\n.. code-block:: python\n\n    from muffin import Application\n    from muffin_peewee import Plugin as Peewee\n\n    # Create Muffin Application\n    app = Application('example')\n\n    # Initialize the plugin\n    # As alternative: db = Peewee(app, **options)\n    db = Peewee()\n    db.setup(app, PEEWEE_CONNECTION='postgresql://postgres:postgres@localhost:5432/database')\n\n\nOptions\n-------\n\n=========================== ======================================= ===========================\nName                        Default value                           Desctiption\n--------------------------- --------------------------------------- ---------------------------\n**CONNECTION**              ``sqlite:///db.sqlite``                 Database URL\n**CONNECTION_PARAMS**       ``{}``                                  Additional params for DB connection\n**AUTO_CONNECTION**         ``True``                                Automatically get a connection from db for a request\n**AUTO_TRANSACTION**        ``True``                                Automatically wrap a request into a transaction\n**MIGRATIONS_ENABLED**      ``True``                                Enable migrations with\n**MIGRATIONS_PATH**         ``\"migrations\"``                        Set path to the migrations folder\n**PYTEST_SETUP_DB**         ``True``                                Manage DB schema and connection in pytest\n=========================== ======================================= ===========================\n\nYou are able to provide the options when you are initiliazing the plugin:\n\n.. code-block:: python\n\n    db.setup(app, connection='DB_URL')\n\n\nOr setup it inside ``Muffin.Application`` config using the ``PEEWEE_`` prefix:\n\n.. code-block:: python\n\n   PEEWEE_CONNECTION = 'DB_URL'\n\n``Muffin.Application`` configuration options are case insensitive\n\nQueries\n-------\n\n.. code-block:: python\n\n    class Test(db.Model):\n        data = peewee.CharField()\n\n\n    @app.route('/')\n    async def view(request):\n        return [t.data async for t in Test.select()]\n\nManage connections\n------------------\n\n.. code-block:: python\n\n    # Set configuration option `MANAGE_CONNECTIONS` to False\n\n    # Use context manager\n    @app.route('/')\n    async def view(request):\n        # Aquire a connection\n        async with db.manager.connection():\n            # Work with db\n            # ...\n\n\nMigrations\n----------\n\nCreate migrations: ::\n\n    $ muffin example:app peewee-create [NAME] [--auto]\n\n\nRun migrations: ::\n\n    $ muffin example:app peewee-migrate [NAME] [--fake]\n\n\nRollback migrations: ::\n\n    $ muffin example:app peewee-rollback [NAME]\n\n\nList migrations: ::\n\n    $ muffin example:app peewee-list\n\n\nClear migrations from DB: ::\n\n    $ muffin example:app peewee-clear\n\n\nMerge migrations: ::\n\n    $ muffin example:app peewee-merge\n\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/muffin-peewee-aio/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of Muffin Peewee happens at: https://github.com/klen/muffin-peewee-aio\n\n\nContributors\n=============\n\n* klen_ (Kirill Klenov)\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n.. _MIT license: http://opensource.org/licenses/MIT\n.. _Muffin: https://github.com/klen/muffin\n.. _Peewee: http://docs.peewee-orm.com/en/latest/\n.. _klen: https://github.com/klen\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Peewee-AIO integration for Muffin framework",
    "version": "0.16.1",
    "project_urls": {
        "Homepage": "https://github.com/klen/muffin-peewee",
        "Repository": "https://github.com/klen/muffin-peewee"
    },
    "split_keywords": [
        "peewee",
        "sql",
        "orm",
        "asyncio",
        "muffin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b31292428cc7d9cef3a6d701f527018d4a9630ca1785a42f3768aae42b142f14",
                "md5": "12586ceee038095b4529d1018242620f",
                "sha256": "bf57942a91fbd76e839260827a925b1ac211faa8b55ebac01b31ef7dd35b32d5"
            },
            "downloads": -1,
            "filename": "muffin_peewee_aio-0.16.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12586ceee038095b4529d1018242620f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 7723,
            "upload_time": "2023-07-27T06:19:35",
            "upload_time_iso_8601": "2023-07-27T06:19:35.968705Z",
            "url": "https://files.pythonhosted.org/packages/b3/12/92428cc7d9cef3a6d701f527018d4a9630ca1785a42f3768aae42b142f14/muffin_peewee_aio-0.16.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3df8598f855f01a17a9e7dd9ef3bd82d8d0c3ce49c1094c00aa88b296abd2508",
                "md5": "e9e8975e9f9d91dcb019e0e3df9e2fac",
                "sha256": "ebac6813f487ebcead6547378537c5dc8acfa9d32649775314621268fb7871bf"
            },
            "downloads": -1,
            "filename": "muffin_peewee_aio-0.16.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e9e8975e9f9d91dcb019e0e3df9e2fac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 8155,
            "upload_time": "2023-07-27T06:19:37",
            "upload_time_iso_8601": "2023-07-27T06:19:37.581951Z",
            "url": "https://files.pythonhosted.org/packages/3d/f8/598f855f01a17a9e7dd9ef3bd82d8d0c3ce49c1094c00aa88b296abd2508/muffin_peewee_aio-0.16.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-27 06:19:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "muffin-peewee",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aio-peewee",
            "specs": [
                [
                    ">=",
                    "0.4.0"
                ]
            ]
        },
        {
            "name": "muffin",
            "specs": [
                [
                    ">=",
                    "0.83"
                ]
            ]
        },
        {
            "name": "peewee",
            "specs": [
                [
                    ">=",
                    "3"
                ]
            ]
        },
        {
            "name": "peewee-migrate",
            "specs": [
                [
                    ">=",
                    "1.6.2"
                ]
            ]
        }
    ],
    "lcname": "muffin-peewee-aio"
}
        
Elapsed time: 0.11985s