{"id":15442011,"url":"https://github.com/jhnnsrs/turms","last_synced_at":"2025-04-04T11:08:59.541Z","repository":{"id":40243367,"uuid":"450062152","full_name":"jhnnsrs/turms","owner":"jhnnsrs","description":"Turms is a pure python implementation of the awesome graphql-codegen library, following a simliar extensible design.","archived":false,"fork":false,"pushed_at":"2025-02-27T09:14:28.000Z","size":2076,"stargazers_count":65,"open_issues_count":24,"forks_count":17,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T10:08:44.987Z","etag":null,"topics":["graphql","pydantic","python"],"latest_commit_sha":null,"homepage":"https://jhnnsrs.github.io/turms/","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/jhnnsrs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","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},"funding":{"github":["jhnnsrs"]}},"created_at":"2022-01-20T11:04:02.000Z","updated_at":"2025-03-11T17:50:56.000Z","dependencies_parsed_at":"2024-06-19T02:50:28.049Z","dependency_job_id":"8508704f-2648-43c3-8e74-acabb310ee19","html_url":"https://github.com/jhnnsrs/turms","commit_stats":{"total_commits":216,"total_committers":10,"mean_commits":21.6,"dds":0.08796296296296291,"last_synced_commit":"4c0a141fa1925e281ef03be6d1008cc02dae2b0f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhnnsrs%2Fturms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhnnsrs%2Fturms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhnnsrs%2Fturms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhnnsrs%2Fturms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhnnsrs","download_url":"https://codeload.github.com/jhnnsrs/turms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166167,"owners_count":20894654,"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":["graphql","pydantic","python"],"created_at":"2024-10-01T19:24:44.759Z","updated_at":"2025-04-04T11:08:59.520Z","avatar_url":"https://github.com/jhnnsrs.png","language":"Python","funding_links":["https://github.com/sponsors/jhnnsrs"],"categories":["Implementations","Web"],"sub_categories":["Python"],"readme":"# turms\n\n[![codecov](https://codecov.io/gh/jhnnsrs/turms/branch/master/graph/badge.svg?token=UGXEA2THBV)](https://codecov.io/gh/jhnnsrs/turms)\n[![PyPI version](https://badge.fury.io/py/turms.svg)](https://pypi.org/project/turms/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://pypi.org/project/turms/)\n![Maintainer](https://img.shields.io/badge/maintainer-jhnnsrs-blue)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/turms.svg)](https://pypi.python.org/pypi/turms/)\n[![PyPI status](https://img.shields.io/pypi/status/turms.svg)](https://pypi.python.org/pypi/turms/)\n[![PyPI download month](https://img.shields.io/pypi/dm/turms.svg)](https://pypi.python.org/pypi/turms/)\n\n## Goal\n\nTurms is a `graphql-codegen` inspired code generator for python that generates typed and serializable python code from your graphql schema and documents. Just define your query in standard graphql syntax and let turms create fully typed queries/mutation and subscriptions, that you can use in your favourite IDE.\n\nTurms allows you to easily generate both server-side and client-side code for your GraphQL API.\n\n### Schema (Server) Generation:\n\nCan generate the following types from your graphql SDL schema:\n\n- Enums\n- Inputs\n- Objects\n- Scalars\n- Directives\n\nSepcific generation supported for:\n\n- [x] Strawberry\n- [ ] Graphene\n\n### Documents (Client) Generation\n\nCan generate the following pydantic models from your graphql documents:\n\n- Enums\n- Inputs\n- Scalars\n- Fragments\n- Operations\n\n## Features\n\n- Fully typed, fully documented code generation\n- Schema and Document based code generation\n- Compatible with popular graphql libraries (strawberry, gql, rath, etc.)\n- Support for custom scalars, custom directives, ...\n- Powerful plugin system (e.g. custom Linting, custom formatting, etc.)\n- Operation functions like query, mutation, subscription (e.g. `data= get_capsules()`)\n- Compliant with graphl-config\n- Code migration support (trying to merge updates into existing code)\n\n## Installation\n\n```bash\npip install turms\n```\n\nturms is a pure development library and will not introduce any dependency on itself into your\ncode, so we recommend installing turms as a development dependency.\n\n```bash\npoetry add -D turms\n\n```\n\nAs of now turms only supports python 3.9 and higher (as we rely on ast unparsing)\n\n## Configuration\n\nTurms relies on and complies with [graphql-config](https://www.graphql-config.com/docs/user/user-introduction) and searches your current working dir for the graphql-config file.\n\n### Document based generation\n\nBased on pydantic models\n\n```yaml\nprojects:\n  default:\n    schema: http://api.spacex.land/graphql/\n    documents: graphql/**.graphql\n    extensions:\n      turms: # path for configuration for turms\n        out_dir: examples/api\n        plugins: # path for plugin configuration\n          - type: turms.plugins.enums.EnumsPlugin\n          - type: turms.plugins.inputs.InputsPlugin\n          - type: turms.plugins.fragments.FragmentsPlugin\n          - type: turms.plugins.operation.OperationsPlugin\n          - type: turms.plugins.funcs.FuncsPlugin\n        processors:\n          - type: turms.processor.black.BlackProcessor\n          - type: turms.processor.isort.IsortProcessor\n        scalar_definitions:\n          uuid: str\n          timestamptz: str\n          Date: str\n```\n\n### Schema based generation\n\nBased on strawberry models\n\n```yaml\nprojects:\n  default:\n    schema: beasts.graphql\n    extensions:\n      turms:\n        skip_forwards: true\n        out_dir: api\n        stylers:\n          - type: turms.stylers.capitalize.CapitalizeStyler\n          - type: turms.stylers.snake_case.SnakeCaseStyler\n        plugins:\n          - type: turms.plugins.strawberry.StrawberryPlugin # generates a strawberry schema\n        processors:\n          - type: turms.processors.disclaimer.DisclaimerProcessor\n          - type: turms.processors.black.BlackProcessor\n          - type: turms.processors.isort.IsortProcessor\n          - type: turms.processors.merge.MergeProcessor # merges the formated schema with already defined functions\n        scalar_definitions:\n          uuid: str\n          _Any: typing.Any\n```\n\n### Usage\n\nOnce you have configured turms you can generate your code by running\n\n```bash\nturms gen\n```\n\n### Why Turms\n\nIn Etruscan religion, Turms (usually written as 𐌕𐌖𐌓𐌌𐌑 Turmś in the Etruscan alphabet) was the equivalent of Roman Mercury and Greek Hermes, both gods of trade and the **messenger** god between people and gods.\n\n## Transport Layer\n\nTurms does _not_ come with a default transport layer but if you are searching for an Apollo-like GraphQL Client you can check out [rath](https://github.com/jhnnsrs/rath), that works especially well with turms.\n\n## Examples\n\nThis github repository also contains some examples on how to use turms with popular libraries in the graphql ecosystem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhnnsrs%2Fturms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhnnsrs%2Fturms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhnnsrs%2Fturms/lists"}