{"id":22695658,"url":"https://github.com/tina4stack/tina4-python","last_synced_at":"2026-04-02T14:50:47.458Z","repository":{"id":75424758,"uuid":"367719165","full_name":"tina4stack/tina4-python","owner":"tina4stack","description":"Tina4 Python","archived":false,"fork":false,"pushed_at":"2026-03-31T14:21:20.000Z","size":4126,"stargazers_count":15,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"v3","last_synced_at":"2026-03-31T14:40:38.893Z","etag":null,"topics":["framework","jinja2","migrations","orm-framework","python","sockets","swagger","twig","wsdl"],"latest_commit_sha":null,"homepage":"https://tina4.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tina4stack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-05-15T19:58:07.000Z","updated_at":"2026-03-31T14:22:31.000Z","dependencies_parsed_at":"2024-04-29T14:28:11.549Z","dependency_job_id":"3ec07cb8-c496-43d3-bad6-29e8b4ee94dc","html_url":"https://github.com/tina4stack/tina4-python","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/tina4stack/tina4-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tina4stack","download_url":"https://codeload.github.com/tina4stack/tina4-python/tar.gz/refs/heads/v3","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31308446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["framework","jinja2","migrations","orm-framework","python","sockets","swagger","twig","wsdl"],"created_at":"2024-12-10T04:11:24.931Z","updated_at":"2026-04-02T14:50:47.451Z","avatar_url":"https://github.com/tina4stack.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://tina4.com/logo.svg\" alt=\"Tina4\" width=\"200\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eTina4 Python\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  54 built-in features. Zero dependencies. One import, everything works.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/tina4-python/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/tina4-python?color=7b1fa2\u0026label=PyPI\" alt=\"PyPI\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/tests-2%2C068%20passing-brightgreen\" alt=\"Tests\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/features-54-blue\" alt=\"Features\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/dependencies-0-brightgreen\" alt=\"Zero Deps\"\u003e\n  \u003ca href=\"https://tina4.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-tina4.com-7b1fa2\" alt=\"Docs\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://tina4.com\"\u003eDocumentation\u003c/a\u003e \u0026bull;\n  \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e \u0026bull;\n  \u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e \u0026bull;\n  \u003ca href=\"#cli-reference\"\u003eCLI Reference\u003c/a\u003e \u0026bull;\n  \u003ca href=\"#cross-framework-parity\"\u003eParity\u003c/a\u003e \u0026bull;\n  \u003ca href=\"https://tina4.com\"\u003etina4.com\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Quick Start\n\n```bash\n# Install the Tina4 CLI\ncargo install tina4  # or download binary from https://github.com/tina4stack/tina4/releases\n\n# Create a project\ntina4 init python ./my-app\n\n# Run it\ncd my-app \u0026\u0026 tina4 serve\n```\n\nOpen http://localhost:7145 — your app is running.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWithout the Tina4 CLI\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\n# 1. Create project\nmkdir my-app \u0026\u0026 cd my-app\nuv init \u0026\u0026 uv add tina4-python\n\n# 2. Create entry point\necho 'from tina4_python.core import run; run()' \u003e app.py\n\n# 3. Create .env\necho 'TINA4_DEBUG=true' \u003e .env\necho 'TINA4_LOG_LEVEL=ALL' \u003e\u003e .env\n\n# 4. Create route directory\nmkdir -p src/routes\n\n# 5. Run\nuv run python app.py\n```\n\nOpen http://localhost:7145\n\n\u003c/details\u003e\n\n---\n\n## What's Built In (54 Features)\n\nEvery feature is built from scratch -- no pip install, no node_modules, no third-party runtime dependencies in core.\n\n| Category | Features |\n|----------|----------|\n| **Core HTTP** (7) | Router with path params (`{id:int}`, `{p:path}`), Server, Request/Response, Middleware pipeline, Static file serving, CORS |\n| **Database** (6) | SQLite, PostgreSQL, MySQL, MSSQL, Firebird — unified adapter, connection pooling, query cache, transactions, race-safe ID generation, SQL dialect translation |\n| **ORM** (7) | Active Record with typed fields, relationships (`has_one`/`has_many`/`belongs_to`), soft delete, QueryBuilder + MongoDB support, Auto-CRUD generator, migrations with rollback |\n| **Auth \u0026 Security** (5) | JWT (HS256/RS256), password hashing (PBKDF2-SHA256), API key validation, rate limiting, CSRF form tokens |\n| **Templating** (3) | Frond engine (Twig/Jinja2-compatible, pre-compiled 2.8x faster), SCSS auto-compilation, built-in CSS (~24 KB) |\n| **API \u0026 Integration** (5) | HTTP client (zero-dep), GraphQL with ORM auto-schema + GraphiQL IDE, WSDL/SOAP with auto WSDL, WebSocket (RFC 6455) + Redis backplane, MCP server (24 dev tools) |\n| **Background** (3) | Job queue (File/RabbitMQ/Kafka/MongoDB) with priority, delay, retry, dead letters — service runner — event system (on/emit/once/off) |\n| **Data \u0026 Storage** (4) | Session (File/Redis/Valkey/MongoDB/DB), response cache (LRU, TTL), seeder + 50+ fake data generators, messenger (SMTP/IMAP) |\n| **Developer Tools** (7) | Dev dashboard (11 tabs), dev toolbar, error overlay (Catppuccin Mocha), dev mailbox, hot reload + CSS hot-reload, code metrics (complexity, coupling, maintainability), AI context installer (7 tools) |\n| **Utilities** (7) | DI container (transient + singleton), HtmlElement builder, inline testing (`@tests` decorator), i18n (6 languages), Swagger/OpenAPI auto-generation, CLI scaffolding (`generate model/route/migration/middleware`), structured logging |\n\n**2,066 tests. Zero dependencies. Full parity across Python, PHP, Ruby, and Node.js.**\n\nFor full documentation visit **[tina4.com](https://tina4.com)**.\n\n---\n\n## Install\n\n```bash\npip install tina4-python\n```\n\nOr with [uv](https://docs.astral.sh/uv/) (recommended):\n\n```bash\nuv add tina4-python\n```\n\n### Optional database drivers\n\nInstall only what you need:\n\n```bash\npip install tina4-python[postgres]    # PostgreSQL (psycopg2-binary)\npip install tina4-python[mysql]       # MySQL / MariaDB (mysql-connector-python)\npip install tina4-python[mssql]       # Microsoft SQL Server (pymssql)\npip install tina4-python[firebird]    # Firebird (firebird-driver)\npip install tina4-python[mongo]       # MongoDB (pymongo)\npip install tina4-python[odbc]        # ODBC (pyodbc)\npip install tina4-python[all-db]      # All of the above\npip install tina4-python[dev-reload]  # Hot-patching via jurigged\n```\n\n---\n\n## Getting Started\n\n### 1. Create a project\n\n```bash\ntina4python init my-app\ncd my-app\n```\n\nThis creates:\n\n```\nmy-app/\n├── app.py              # Entry point\n├── .env                # Configuration\n├── src/\n│   ├── routes/         # API + page routes (auto-discovered)\n│   ├── orm/            # Database models\n│   ├── app/            # Service classes and shared helpers\n│   ├── templates/      # Frond/Twig templates\n│   ├── seeds/          # Database seeders\n│   ├── scss/           # SCSS (auto-compiled to public/css/)\n│   └── public/         # Static assets served at /\n├── migrations/         # SQL migration files\n└── tests/              # pytest tests\n```\n\n### 2. Create a route\n\nCreate `src/routes/hello.py`:\n\n```python\nfrom tina4_python.core.router import get, post\n\n@get(\"/api/hello\")\nasync def hello(request, response):\n    return response({\"message\": \"Hello from Tina4!\"})\n\n@get(\"/api/hello/{name}\")\nasync def hello_name(request, response):\n    name = request.param(\"name\")\n    return response({\"message\": f\"Hello, {name}!\"})\n```\n\nVisit `http://localhost:7145/api/hello` -- routes are auto-discovered, no imports needed.\n\n### 3. Add a database\n\nEdit `.env`:\n\n```bash\nDATABASE_URL=sqlite:///data/app.db\n```\n\nCreate and run a migration:\n\n```bash\ntina4python migrate:create \"create users table\"\n```\n\nEdit the generated SQL:\n\n```sql\nCREATE TABLE IF NOT EXISTS users (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    name TEXT NOT NULL,\n    email TEXT NOT NULL,\n    created_at TEXT DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n```bash\ntina4python migrate\n```\n\n### 4. Create an ORM model\n\nCreate `src/orm/User.py`:\n\n```python\nfrom tina4_python.orm import ORM, IntegerField, StringField, DateTimeField\n\nclass User(ORM):\n    table_name = \"users\"\n    id = IntegerField(primary_key=True, auto_increment=True)\n    name = StringField(required=True, min_length=1, max_length=100)\n    email = StringField(regex=r'^[^@]+@[^@]+\\.[^@]+$')\n    created_at = DateTimeField()\n```\n\n### 5. Build a REST API\n\nCreate `src/routes/users.py`:\n\n```python\nfrom tina4_python.core.router import get, post, noauth\n\n@get(\"/api/users\")\nasync def list_users(request, response):\n    from src.orm.User import User\n    return response(User().select(limit=100).to_array())\n\n@get(\"/api/users/{id:int}\")\nasync def get_user(id, request, response):\n    from src.orm.User import User\n    user = User()\n    if user.load(\"id = ?\", [id]):\n        return response(user.to_dict())\n    return response({\"error\": \"Not found\"}, 404)\n\n@noauth()\n@post(\"/api/users\")\nasync def create_user(request, response):\n    from src.orm.User import User\n    user = User(request.body)\n    user.save()\n    return response(user.to_dict(), 201)\n```\n\n### 6. Add a template\n\nCreate `src/templates/base.twig`:\n\n```twig\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003e{% block title %}My App{% endblock %}\u003c/title\u003e\n    \u003clink rel=\"stylesheet\" href=\"/css/tina4.min.css\"\u003e\n    {% block stylesheets %}{% endblock %}\n\u003c/head\u003e\n\u003cbody\u003e\n    {% block content %}{% endblock %}\n    \u003cscript src=\"/js/frond.js\"\u003e\u003c/script\u003e\n    {% block javascripts %}{% endblock %}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nCreate `src/templates/pages/home.twig`:\n\n```twig\n{% extends \"base.twig\" %}\n{% block content %}\n\u003cdiv class=\"container mt-4\"\u003e\n    \u003ch1\u003e{{ title }}\u003c/h1\u003e\n    \u003cul\u003e\n    {% for user in users %}\n        \u003cli\u003e{{ user.name }} -- {{ user.email }}\u003c/li\u003e\n    {% endfor %}\n    \u003c/ul\u003e\n\u003c/div\u003e\n{% endblock %}\n```\n\nRender it from a route:\n\n```python\n@get(\"/\")\nasync def home(request, response):\n    from src.orm.User import User\n    users = User().select(limit=20).to_array()\n    return response.render(\"pages/home.twig\", {\"title\": \"Users\", \"users\": users})\n```\n\n### 7. Seed, test, deploy\n\n```bash\ntina4python seed                          # Run seeders from src/seeds/\ntina4python test                          # Run test suite\ntina4python build                         # Build distributable\n```\n\nFor the complete step-by-step guide, visit **[tina4.com](https://tina4.com)**.\n\n---\n\n## Features\n\n### Routing\n\n```python\nfrom tina4_python.core.router import get, post, put, delete, noauth, secured, middleware\n\n@get(\"/api/items\")               # Public by default\nasync def list_items(request, response):\n    return response({\"items\": []})\n\n@noauth()                         # Make a write route public\n@post(\"/api/webhook\")\nasync def webhook(request, response):\n    return response({\"ok\": True})\n\n@secured()                        # Protect a GET route\n@get(\"/api/admin/stats\")\nasync def admin_stats(request, response):\n    return response({\"secret\": True})\n```\n\nPath parameter types: `{id}` (string), `{id:int}`, `{price:float}`, `{path:path}` (greedy).\n\n### ORM\n\nActive Record with typed fields, validation, soft delete, relationships, scopes, and multi-database support.\n\n```python\nfrom tina4_python.orm import ORM, IntegerField, StringField, Field, orm_bind\n\nclass User(ORM):\n    table_name = \"users\"\n    id = IntegerField(primary_key=True, auto_increment=True)\n    name = StringField(required=True, min_length=1, max_length=100)\n    email = StringField(regex=r'^[^@]+@[^@]+\\.[^@]+$')\n    role = StringField(choices=[\"admin\", \"user\", \"guest\"], default=\"user\")\n    age = Field(int, min_value=0, max_value=150)\n\n# CRUD\nuser = User({\"name\": \"Alice\", \"email\": \"alice@example.com\"})\nuser.save()\nuser.load(\"email = ?\", [\"alice@example.com\"])\nuser.delete()\n\n# Relationships\norders = user.has_many(\"Order\", \"user_id\")\nprofile = user.has_one(\"Profile\", \"user_id\")\n\n# Soft delete, scopes, caching\nuser.soft_delete()\nactive_admins = User.scope(\"active\").scope(\"admin\").select()\nusers = User.cached(\"SELECT * FROM users\", ttl=300)\n\n# Multi-database\norm_bind(main_db)                     # Default\norm_bind(audit_db, name=\"audit\")      # Named\n\nclass AuditLog(ORM):\n    _db = \"audit\"                     # Uses named connection\n```\n\n### Database\n\nUnified interface across 7 engines:\n\n```python\nfrom tina4_python.database.connection import Database\n\ndb = Database(\"sqlite:///data/app.db\")\ndb = Database(\"postgresql://user:pass@localhost:5432/mydb\")\ndb = Database(\"mysql://user:pass@localhost:3306/mydb\")\ndb = Database(\"mssql://sa:pass@localhost:1433/mydb\")\ndb = Database(\"firebird://SYSDBA:masterkey@localhost:3050//path/to/db\")\ndb = Database(\"mongodb://localhost:27017/mydb\")\ndb = Database(\"odbc://DSN=mydsn\")\n\nresult = db.fetch(\"SELECT * FROM users WHERE age \u003e ?\", [18], limit=20, offset=0)\nrow = db.fetch_one(\"SELECT * FROM users WHERE id = ?\", [1])\ndb.insert(\"users\", {\"name\": \"Alice\", \"email\": \"alice@test.com\"})\ndb.commit()\n```\n\n### Middleware\n\n```python\nclass AuthCheck:\n    @staticmethod\n    def before_auth(request, response):\n        if \"authorization\" not in request.headers:\n            return request, response(\"Unauthorized\", 401)\n        return request, response\n\n@middleware(AuthCheck)\n@get(\"/protected\")\nasync def protected(request, response):\n    return response({\"secret\": True})\n```\n\n### JWT Authentication\n\n```python\nfrom tina4_python.auth import Auth\n\nauth = Auth(secret=\"your-secret\")\ntoken = auth.get_token({\"user_id\": 42})\npayload = auth.valid_token(token)\n```\n\nPOST/PUT/PATCH/DELETE routes require `Authorization: Bearer \u003ctoken\u003e` by default. Use `@noauth()` to make public, `@secured()` to protect GET routes.\n\n### Sessions\n\n```python\nrequest.session.set(\"user_id\", 42)\nuser_id = request.session.get(\"user_id\")\n```\n\nBackends: file (default), Redis, Valkey, MongoDB, database. Set via `TINA4_SESSION_HANDLER` in `.env`.\n\n### Queues\n\n```python\nfrom tina4_python.queue import Queue, Producer, Consumer\n\nProducer(Queue(topic=\"emails\")).push({\"to\": \"alice@example.com\"})\n\nfor job in Consumer(Queue(topic=\"emails\")).poll():\n    send_email(job.data)\n    job.complete()\n```\n\n### GraphQL\n\n```python\nfrom tina4_python.graphql import GraphQL\n\ngql = GraphQL()\ngql.schema.from_orm(User)\ngql.register_route(\"/graphql\")   # GET = GraphiQL IDE, POST = queries\n```\n\n### WebSocket\n\n```python\nfrom tina4_python.websocket import WebSocketManager\n\nws = WebSocketManager()\n\n@ws.route(\"/ws/chat\")\nasync def chat(connection, message):\n    await ws.broadcast(\"/ws/chat\", f\"User said: {message}\")\n```\n\n### Swagger / OpenAPI\n\nAuto-generated at `/swagger`:\n\n```python\n@description(\"Get all users\")\n@tags([\"users\"])\n@get(\"/api/users\")\nasync def users(request, response):\n    return response(User().select().to_array())\n```\n\n### Event System\n\n```python\nfrom tina4_python.core.events import on, emit, once\n\n@on(\"user.created\", priority=10)\ndef notify_admin(user):\n    send_notification(f\"New user: {user['name']}\")\n\nemit(\"user.created\", {\"name\": \"Alice\"})\n```\n\n### Template Engine (Frond)\n\nTwig-compatible, 35+ filters, macros, inheritance, fragment caching, sandboxing:\n\n```twig\n{% extends \"base.twig\" %}\n{% block content %}\n\u003ch1\u003e{{ title | upper }}\u003c/h1\u003e\n{% for item in items %}\n    \u003cp\u003e{{ item.name }} -- {{ item.price | number_format(2) }}\u003c/p\u003e\n{% endfor %}\n\n{% cache \"sidebar\" 300 %}\n    {% include \"partials/sidebar.twig\" %}\n{% endcache %}\n{% endblock %}\n```\n\n### CRUD Scaffolding\n\n```python\n@get(\"/admin/users\")\nasync def admin_users(request, response):\n    return response(CRUD.to_crud(request, {\n        \"sql\": \"SELECT id, name, email FROM users\",\n        \"title\": \"User Management\",\n        \"primary_key\": \"id\",\n    }))\n```\n\n### WSDL / SOAP\n\n```python\nfrom tina4_python.wsdl import WSDL, wsdl_operation\n\nclass Calculator(WSDL):\n    @wsdl_operation({\"Result\": int})\n    def Add(self, a: int, b: int):\n        return {\"Result\": a + b}\n```\n\n### REST Client\n\n```python\nfrom tina4_python.api import Api\n\napi = Api(\"https://api.example.com\", auth_header=\"Bearer xyz\")\nresult = api.send_request(\"/users/42\")\n```\n\n### Data Seeder\n\n```python\nfrom tina4_python.seeder import FakeData, seed_orm\n\nfake = FakeData()\nfake.name()      # \"Alice Johnson\"\nfake.email()     # \"alice.johnson@example.com\"\n\nseed_orm(User, count=50)\n```\n\n### Email / Messenger\n\n```python\nfrom tina4_python.messenger import create_messenger\n\nmail = create_messenger()\nmail.send(to=\"user@test.com\", subject=\"Welcome\", body=\"\u003ch1\u003eHi!\u003c/h1\u003e\", html=True)\n```\n\n### In-Memory Cache\n\n```python\nfrom tina4_python.core.cache import Cache\n\ncache = Cache()\ncache.set(\"key\", \"value\", ttl=300)\ncache.tag(\"users\").flush()\n```\n\n### SCSS, Localization, Inline Testing\n\n- **SCSS**: Drop `.scss` in `src/scss/` -- auto-compiled to CSS. Variables, nesting, mixins, `@import`, `@extend`.\n- **i18n**: JSON translation files, 6 languages (en, fr, af, zh, ja, es), placeholder interpolation.\n- **Inline tests**: `@tests(assert_equal((5, 3), 8))` decorator on any function.\n\n---\n\n## Dev Mode\n\nSet `TINA4_DEBUG=true` in `.env` to enable:\n\n- **Live reload** -- browser auto-refreshes on code changes\n- **CSS hot-reload** -- SCSS changes apply without page refresh\n- **Error overlay** -- rich error display in the browser\n- **Dev admin** at `/__dev/` with 11 tabs: Routes, Queue, Mailbox, Messages, Database, Requests, Errors, WebSocket, System, Tools, Tina4\n\n---\n\n## CLI Reference\n\n```bash\ntina4python init [dir]             # Scaffold a new project\ntina4python serve [port]           # Start dev server (default: 7145)\ntina4python serve --production     # Auto-install and use best production server (uvicorn)\ntina4python migrate                # Run pending migrations\ntina4python migrate:create \u003cdesc\u003e  # Create a migration file\ntina4python migrate:rollback       # Rollback last batch\ntina4python generate model \u003cname\u003e  # Generate ORM model scaffold\ntina4python generate route \u003cname\u003e  # Generate route scaffold\ntina4python generate migration \u003cd\u003e # Generate migration file\ntina4python generate middleware \u003cn\u003e# Generate middleware scaffold\ntina4python seed                   # Run seeders from src/seeds/\ntina4python routes                 # List all registered routes\ntina4python test                   # Run test suite\ntina4python build                  # Build distributable package\ntina4python ai [--all]             # Detect AI tools and install context\n```\n\n### Production Server Auto-Detection\n\n`tina4 serve` automatically detects and uses the best available production server:\n\n- **Python**: uvicorn (if installed), otherwise built-in asyncio\n- Use `tina4python serve --production` to auto-install the production server\n\n### Scaffolding with `tina4 generate`\n\nQuickly scaffold new components:\n\n```bash\ntina4python generate model User          # Creates src/orm/User.py with field stubs\ntina4python generate route users         # Creates src/routes/users.py with CRUD stubs\ntina4python generate migration \"add age\" # Creates migration SQL file\ntina4python generate middleware AuthLog   # Creates middleware class\n```\n\n### ORM Relationships \u0026 Eager Loading\n\n```python\n# Define relationships\norders = user.has_many(\"Order\", \"user_id\")\nprofile = user.has_one(\"Profile\", \"user_id\")\ncustomer = order.belongs_to(\"Customer\", \"customer_id\")\n\n# Eager loading with include=\nusers = User().select(include=[\"orders\", \"profile\"])\n```\n\n### DB Query Caching\n\nEnable query caching for up to 4x speedup on read-heavy workloads:\n\n```bash\n# .env\nTINA4_DB_CACHE=true\n```\n\n```python\n# Check cache stats\nfrom tina4_python.orm import cache_stats, cache_clear\nstats = cache_stats()   # {\"hits\": 42, \"misses\": 7, \"size\": 15}\ncache_clear()           # Flush all cached queries\n```\n\n### Frond Pre-Compilation\n\nTemplates are pre-compiled for 2.8x faster rendering. Clear the cache when needed:\n\n```python\nfrom tina4_python.frond import Frond\nFrond.clear_cache()\n```\n\n### Gallery\n\n7 interactive examples with **Try It** deploy — visit the dev admin at `/__dev/` to explore.\n\n## Environment\n\n```bash\nSECRET=your-jwt-secret\nDATABASE_URL=sqlite:///data/app.db\nTINA4_DEBUG=true                     # Enable dev toolbar, error overlay\nTINA4_LOG_LEVEL=ALL                  # ALL, DEBUG, INFO, WARNING, ERROR\nTINA4_LOCALE=en                      # en, fr, af, zh, ja, es\nTINA4_SESSION_HANDLER=SessionFileHandler\nSWAGGER_TITLE=My API\n```\n\n## AI Tool Integration\n\n```bash\ntina4python ai              # Detect and install context\ntina4python ai --all        # Install for ALL supported tools\n```\n\nSupported: Claude Code, Cursor, GitHub Copilot, Windsurf, Aider, Cline, OpenAI Codex CLI. Generates framework-aware context so AI assistants understand Tina4's conventions.\n\n## Performance\n\nBenchmarked with `wrk` — 5,000 requests, 50 concurrent, median of 3 runs:\n\n| Framework | JSON req/s | Deps | Features |\n|-----------|-----------|------|----------|\n| **Tina4 Python** | **6,508** | 0 | 54 |\n| FastAPI | 12,652 | 12+ | ~8 |\n| Flask | 4,928 | 6+ | ~7 |\n| Bottle | 4,355 | 0 | ~5 |\n| Django | 4,050 | 20+ | ~22 |\n\nTina4 Python delivers competitive throughput with **zero dependencies and 54 features** — frameworks with higher req/s have a fraction of the functionality and require dozens of third-party packages.\n\n**Across all 4 Tina4 implementations:**\n\n| | Python | PHP | Ruby | Node.js |\n|---|--------|-----|------|---------|\n| **JSON req/s** | 6,508 | 29,293 | 10,243 | 84,771 |\n| **Dependencies** | 0 | 0 | 0 | 0 |\n| **Features** | 54 | 54 | 54 | 54 |\n\nRun benchmarks locally: `python benchmarks/benchmark.py --python`\n\n---\n\n## Cross-Framework Parity\n\nTina4 ships identical features across four languages — same architecture, same conventions, same 54 features:\n\n| | Python | PHP | Ruby | Node.js |\n|---|--------|-----|------|---------|\n| **Package** | `tina4-python` | `tina4stack/tina4php` | `tina4ruby` | `tina4-nodejs` |\n| **Tests** | 2,066 | 1,427 | 1,793 | 1,950 |\n| **Default port** | 7145 | 7146 | 7147 | 7148 |\n\n**7,236 tests** across all 4 frameworks. See [tina4.com](https://tina4.com).\n\n---\n\n## Documentation\n\nFull guides, API reference, and examples at **[tina4.com](https://tina4.com)**.\n\n## License\n\nMIT (c) 2007-2026 Tina4 Stack\nhttps://opensource.org/licenses/MIT\n\n---\n\n\u003cp align=\"center\"\u003e\u003cb\u003eTina4\u003c/b\u003e -- The framework that keeps out of the way of your coding.\u003c/p\u003e\n\n---\n\n## Our Sponsors\n\n**Sponsored with 🩵 by Code Infinity**\n\n[\u003cimg src=\"https://codeinfinity.co.za/wp-content/uploads/2025/09/c8e-logo-github.png\" alt=\"Code Infinity\" width=\"100\"\u003e](https://codeinfinity.co.za/about-open-source-policy?utm_source=github\u0026utm_medium=website\u0026utm_campaign=opensource_campaign\u0026utm_id=opensource)\n\n*Supporting open source communities \u003cspan style=\"color: #1DC7DE;\"\u003e•\u003c/span\u003e Innovate \u003cspan style=\"color: #1DC7DE;\"\u003e•\u003c/span\u003e Code \u003cspan style=\"color: #1DC7DE;\"\u003e•\u003c/span\u003e Empower*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftina4stack%2Ftina4-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-python/lists"}