{"library":"tortoise-orm","type":"library","category":null,"description":"Async ORM for Python inspired by Django ORM. Built on asyncio — requires async context. Current version: 1.1.7 (Mar 2026). v1.0 released 2024 — first stable release after years of 0.x. Breaking changes from 0.x: connections.close_all() removed, ConnectionHandler uses per-instance ContextVar storage. FastAPI integration changed from register_tortoise() to RegisterTortoise context manager. Does not work on serverless/Vercel without workarounds.","language":"python","status":"active","version":"1.1.7","tags":["tortoise-orm","orm","async","asyncio","fastapi","postgresql","python"],"last_verified":"Tue Jun 09","install":[{"cmd":"pip install tortoise-orm","imports":["from contextlib import asynccontextmanager\nfrom fastapi import FastAPI\nfrom tortoise.contrib.fastapi import RegisterTortoise\n\n@asynccontextmanager\nasync def lifespan(app: FastAPI):\n    async with RegisterTortoise(\n        app,\n        db_url='postgres://user:pass@localhost/mydb',\n        modules={'models': ['myapp.models']},\n        generate_schemas=True,\n    ):\n        yield\n\napp = FastAPI(lifespan=lifespan)","from tortoise import Tortoise\n\nasync def main():\n    await Tortoise.init(\n        db_url='sqlite://db.sqlite3',\n        modules={'models': ['myapp.models']}\n    )\n    await Tortoise.generate_schemas()\n\n    user = await User.create(name='Alice')\n    users = await User.filter(name='Alice').all()\n\n    await Tortoise.close_connections()\n\nimport asyncio\nasyncio.run(main())"]},{"cmd":"pip install 'tortoise-orm[accel]'","imports":[]},{"cmd":"pip install 'tortoise-orm[asyncpg]'","imports":[]}],"homepage":"https://tortoise-orm.readthedocs.io","github":"https://github.com/tortoise/tortoise-orm","docs":"https://tortoise.github.io","changelog":null,"pypi":"https://pypi.org/project/tortoise-orm/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.6,"avg_import_s":0,"wheel_type":"wheel"},"url":"https://checklist.day/v1/registry/tortoise-orm/compatibility"}}