muffin-peewee-aio


Namemuffin-peewee-aio JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/klen/muffin-peewee
SummaryPeewee-AIO integration for Muffin framework
upload_time2024-11-05 11:18:06
maintainerNone
docs_urlNone
authorKirill Klenov
requires_python<4.0,>=3.9
licenseMIT
keywords peewee sql orm asyncio muffin
VCS
bugtrack_url
requirements No requirements were recorded.
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.9

.. _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": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "peewee, sql, orm, asyncio, muffin",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0f/ff/21e83f8abc3d19bb993a0a4204109b52623e4260ec7bd66554fce737b5dd/muffin_peewee_aio-1.1.0.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.9\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": "1.1.0",
    "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": "fdf67a472eecd6fc63a591895a631a3886e8a41b566420dd12f6876971946dcf",
                "md5": "a397304aa7130c4bd78068bbf29922fe",
                "sha256": "22a26f652c99c26bdb49265075b21c9e3a25b12f2cfc8fd65d7ef888c621b83c"
            },
            "downloads": -1,
            "filename": "muffin_peewee_aio-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a397304aa7130c4bd78068bbf29922fe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 7156,
            "upload_time": "2024-11-05T11:18:05",
            "upload_time_iso_8601": "2024-11-05T11:18:05.047301Z",
            "url": "https://files.pythonhosted.org/packages/fd/f6/7a472eecd6fc63a591895a631a3886e8a41b566420dd12f6876971946dcf/muffin_peewee_aio-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fff21e83f8abc3d19bb993a0a4204109b52623e4260ec7bd66554fce737b5dd",
                "md5": "556d73fdc1e5c91943e106ae8b5c728e",
                "sha256": "2250a7ccb6fea31925a057890891ad8059fef77a65a540975eae732825b58b19"
            },
            "downloads": -1,
            "filename": "muffin_peewee_aio-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "556d73fdc1e5c91943e106ae8b5c728e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 6665,
            "upload_time": "2024-11-05T11:18:06",
            "upload_time_iso_8601": "2024-11-05T11:18:06.743096Z",
            "url": "https://files.pythonhosted.org/packages/0f/ff/21e83f8abc3d19bb993a0a4204109b52623e4260ec7bd66554fce737b5dd/muffin_peewee_aio-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 11:18:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klen",
    "github_project": "muffin-peewee",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "muffin-peewee-aio"
}
        
Elapsed time: 2.17252s