{"id":28764929,"url":"https://github.com/klen/muffin-peewee","last_synced_at":"2025-10-19T03:53:22.672Z","repository":{"id":29602889,"uuid":"33143015","full_name":"klen/muffin-peewee","owner":"klen","description":"Peewee integration to Muffin framework","archived":false,"fork":false,"pushed_at":"2022-11-02T08:54:08.000Z","size":193,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-09T12:07:18.001Z","etag":null,"topics":["asyncio","muffin","peewee-orm","trio"],"latest_commit_sha":null,"homepage":"","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/klen.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/codeowners","security":".github/security.md","support":null}},"created_at":"2015-03-30T19:22:09.000Z","updated_at":"2022-11-01T05:45:16.000Z","dependencies_parsed_at":"2023-01-14T15:17:19.295Z","dependency_job_id":null,"html_url":"https://github.com/klen/muffin-peewee","commit_stats":null,"previous_names":[],"tags_count":113,"template":false,"template_full_name":null,"purl":"pkg:github/klen/muffin-peewee","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fmuffin-peewee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fmuffin-peewee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fmuffin-peewee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fmuffin-peewee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klen","download_url":"https://codeload.github.com/klen/muffin-peewee/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fmuffin-peewee/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259760530,"owners_count":22907197,"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":["asyncio","muffin","peewee-orm","trio"],"created_at":"2025-06-17T10:12:59.984Z","updated_at":"2025-10-19T03:53:22.666Z","avatar_url":"https://github.com/klen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Muffin Peewee\n#############\n\n.. _description:\n\n**muffin-peewee** -- Peewee_ ORM integration to Muffin_ framework.\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin-peewee/workflows/tests/badge.svg\n    :target: https://github.com/klen/muffin-peewee/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-peewee\n    :target: https://pypi.org/project/muffin-peewee/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin-peewee\n    :target: https://pypi.org/project/muffin-peewee/\n    :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python \u003e= 3.7\n\n.. _installation:\n\nInstallation\n=============\n\n**Muffin Peewee** should be installed using pip: ::\n\n    pip install muffin-peewee\n\nOptionally you are able to install it with postgresql drivers: ::\n\n    pip install muffin-peewee[postgres]\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: jinja2 = Jinja2(app, **options)\n    db = Peewee()\n    db.setup(app, PEEWEE_CONNECTION='postgres+pool+async://postgres:postgres@localhost:5432/database')\n\n\nOptions\n-------\n\n=========================== ======================================= =========================== \nName                        Default value                           Desctiption\n--------------------------- --------------------------------------- ---------------------------\n**CONNECTION**              ``sqlite+async:///db.sqlite``           Database URL\n**CONNECTION_PARAMS**       ``{}``                                  Additional params for DB connection\n**MANAGE_CONNECTIONS**      ``True``                                Install a middleware to aquire db connections automatically\n**MIGRATIONS_ENABLED**      ``True``                                Enable migrations with\n**MIGRATIONS_PATH**         ``\"migrations\"``                        Set path to the migrations folder\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::\n\n    @db.register\n    class Test(peewee.Model):\n        data = peewee.CharField()\n\n\n    @app.route('/')\n    async def view(request):\n        return [t.data for t in Test.select()]\n\nManage connections\n------------------\n::\n\n    # Set configuration option `MANAGE_CONNECTIONS` to False\n\n    # Use context manager\n    @app.route('/')\n    async def view(request):\n        async with db:\n            # Work with db\n            # ...\n\n\nMigrations\n----------\n\nCreate migrations: ::\n\n    $ muffin example:app pw_create [NAME] [--auto]\n\n\nRun migrations: ::\n\n    $ muffin example:app pw_migrate [NAME] [--fake]\n\n\nRollback migrations: ::\n\n    $ muffin example:app pw_rollback [NAME]\n\n\nList migrations: ::\n\n    $ muffin example:app pw_list\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/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of Muffin Peewee happens at: https://github.com/klen/muffin-peewee\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fmuffin-peewee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklen%2Fmuffin-peewee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fmuffin-peewee/lists"}