{"id":50443970,"url":"https://github.com/nicebots-xyz/tortoise-extensions","last_synced_at":"2026-05-31T20:03:17.276Z","repository":{"id":359785793,"uuid":"1247391159","full_name":"nicebots-xyz/tortoise-extensions","owner":"nicebots-xyz","description":"Optional extension field types for Tortoise ORM.","archived":false,"fork":false,"pushed_at":"2026-05-23T12:11:27.000Z","size":34,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-23T14:09:54.118Z","etag":null,"topics":["extension","pydantic","python","tortoise","tortoise-orm","uuid"],"latest_commit_sha":null,"homepage":"http://docs.nicebots.xyz/tortoise-extensions/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicebots-xyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","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":"2026-05-23T08:48:52.000Z","updated_at":"2026-05-23T12:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nicebots-xyz/tortoise-extensions","commit_stats":null,"previous_names":["nicebots-xyz/tortoise-extensions"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nicebots-xyz/tortoise-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicebots-xyz%2Ftortoise-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicebots-xyz%2Ftortoise-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicebots-xyz%2Ftortoise-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicebots-xyz%2Ftortoise-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicebots-xyz","download_url":"https://codeload.github.com/nicebots-xyz/tortoise-extensions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicebots-xyz%2Ftortoise-extensions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33746528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["extension","pydantic","python","tortoise","tortoise-orm","uuid"],"created_at":"2026-05-31T20:03:16.426Z","updated_at":"2026-05-31T20:03:17.263Z","avatar_url":"https://github.com/nicebots-xyz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-License-Identifier: ISC\nCopyright: 2026 NiceBots.xyz\n--\u003e\n# tortoise-extensions\n\nOptional extension field types for [Tortoise ORM](https://tortoise.github.io/). This package targets **Tortoise ORM 0.25.4 and later, but before 1.0** — Tortoise 1.x is not supported yet.\n\n## Install\n\nBase package (requires Tortoise ORM in the supported range):\n\n```bash\npip install tortoise-extensions\n```\n\nOptional extras:\n\n```bash\npip install tortoise-extensions[pydantic]\npip install tortoise-extensions[uuid6]\npip install tortoise-extensions[pydantic,uuid6]\n```\n\n## Usage\n\n### Pydantic JSON (`pydantic` extra)\n\n```python\nfrom pydantic import BaseModel\nfrom tortoise.models import Model\n\nfrom tortoise_extensions.pydantic import PydanticJSONField\n\n\nclass Settings(BaseModel):\n    theme: str = \"dark\"\n\n\nclass AppConfig(Model):\n    settings: PydanticJSONField[Settings] = PydanticJSONField(\n        Settings, default=Settings\n    )\n\n    class Meta:\n        table = \"app_configs\"\n```\n\n`PydanticJSONField` round-trips through your Pydantic model: it accepts dicts from PostgreSQL JSONB, JSON strings from SQLite, and serializes models with `model_dump(mode=\"json\")` on save.\n\n### UUID v6+ (`uuid6` extra)\n\n```python\nfrom tortoise.models import Model\n\nfrom tortoise_extensions.uuid6 import FutureUUIDField\n\n\nclass Item(Model):\n    id: FutureUUIDField = FutureUUIDField(primary_key=True)\n\n    class Meta:\n        table = \"items\"\n```\n\nPrimary keys without an explicit `default` receive a UUID7 from the [`uuid6`](https://pypi.org/project/uuid6/) package. PostgreSQL uses the native `UUID` column type; other backends store `CHAR(36)`.\n\n## Contributing a new extension\n\n1. **Open an issue first** — describe the field behavior, SQL types per backend, which Tortoise versions you need, and the proposed optional-extra name (e.g. `pip install tortoise-extensions[myextra]`).\n2. After maintainers agree on the design, open a PR that includes:\n   - Implementation in `src/tortoise_extensions/\u003cmodule\u003e.py`\n   - Tests under `tests/`\n   - An entry in `[project.optional-dependencies]` if the field needs third-party packages\n   - README and docs updates for the new field\n   - ISC SPDX headers on new files (`licensor-config.yaml` applies)\n3. Run `pdm run quality` locally before pushing.\n\n## Documentation\n\nPublished at [docs.nicebots.xyz/tortoise-extensions](https://docs.nicebots.xyz/tortoise-extensions/).\n\n```bash\npdm install -G docs\npdm run docs:build\npdm run docs:preview\npdm run docs:dev\n```\n\n## Development\n\n```bash\npdm install -G dev -G test -G docs\npdm run quality\n```\n\nPublic APIs use [Google-style docstrings](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings); `ruff` enforces this via `convention = \"google\"`.\n\n## License\n\nISC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicebots-xyz%2Ftortoise-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicebots-xyz%2Ftortoise-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicebots-xyz%2Ftortoise-extensions/lists"}