Name | twirpy JSON |
Version |
0.2.0.dev1
JSON |
| download |
home_page | None |
Summary | Twirp runtime library for Python |
upload_time | 2024-09-09 00:08:18 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
protobuf
rpc
twirp
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Twirpy
> Twirp is a framework for service-to-service communication emphasizing simplicity and minimalism.
> It generates routing and serialization from API definition files and lets you focus on your application's logic
> instead of thinking about folderol like HTTP methods and paths and JSON.
>
> -- <cite>[Twirp's README](https://github.com/twitchtv/twirp/blob/main/README.md)</cite>
Twirpy is a Python implementation of the Twirp framework.
It currently supports [Twirp Wire Protocol v7](https://twitchtv.github.io/twirp/docs/spec_v7.html).
This repository contains:
* a protoc (aka the Protocol Compiler) plugin that generates sever and client code;
* a Python package with common implementation details.
## Installation
### Runtime Library
The runtime library package contains common types like `TwirpServer` and `TwirpClient` that are used by the generated code.
Add the Twirp package to your Python project with:
```
pip install twirpy
```
### Code Generator
You need to install `protoc`, the Protocol Buffers compiler, and the `protoc-gen-twirpy` protoc plugin to generate code.
First, install the [Protocol Buffers](https://developers.google.com/protocol-buffers) compiler.
For installation instructions, see [Protocol Buffer Compiler Installation documentation](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation).
You can also use your package manager (e.g. `brew install protobuf` on macOS).
Go the [releases page](https://github.com/Cryptact/twirpy/releases/latest), and download the `protoc-gen-twirpy` binary for your platform.
Unzip the archive and move the binary to a directory in your PATH.
On macOS, you can use the following commands:
```sh
curl -L -o- \
https://github.com/Cryptact/twirpy/releases/latest/download/protoc-gen-twirpy_Darwin_arm64.tar.gz \
| tar xz -C ~/.local/bin protoc-gen-twirpy
````
## Generate and run
Use the protoc plugin to generate twirp server and client code.
```sh
protoc --python_out=. --pyi_out=. --twirpy_out=. example/rpc/haberdasher/service.proto
```
For more information on how to generate code, see the [example](example/README.md).
## Development
We use [`hatch`](https://hatch.pypa.io/latest/) to manage the development process.
To open a shell with the development environment, run: `hatch shell`.
To run the linter, run: `hatch fmt --check` or `hatch fmt` to fix the issues.
## Standing on the shoulders of giants
- The initial version of twirpy was made from an internal copy of https://github.com/daroot/protoc-gen-twirp_python_srv
- The work done by [Verloop](https://verloop.io/) on [the initial versions of Twirpy](https://github.com/verloop/twirpy).
- The `run_in_threadpool` method comes from https://github.com/encode/starlette
Raw data
{
"_id": null,
"home_page": null,
"name": "twirpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "protobuf, rpc, twirp",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/02/e8/0d913415d6d9e73065d84654bec611a7b68ae0436872fc017162fbec563f/twirpy-0.2.0.dev1.tar.gz",
"platform": null,
"description": "# Twirpy\n\n> Twirp is a framework for service-to-service communication emphasizing simplicity and minimalism.\n> It generates routing and serialization from API definition files and lets you focus on your application's logic\n> instead of thinking about folderol like HTTP methods and paths and JSON.\n>\n> -- <cite>[Twirp's README](https://github.com/twitchtv/twirp/blob/main/README.md)</cite>\n\nTwirpy is a Python implementation of the Twirp framework.\nIt currently supports [Twirp Wire Protocol v7](https://twitchtv.github.io/twirp/docs/spec_v7.html).\n\nThis repository contains:\n* a protoc (aka the Protocol Compiler) plugin that generates sever and client code;\n* a Python package with common implementation details.\n\n## Installation\n\n### Runtime Library\n\nThe runtime library package contains common types like `TwirpServer` and `TwirpClient` that are used by the generated code.\n\nAdd the Twirp package to your Python project with:\n```\npip install twirpy\n```\n\n### Code Generator\n\nYou need to install `protoc`, the Protocol Buffers compiler, and the `protoc-gen-twirpy` protoc plugin to generate code.\n\nFirst, install the [Protocol Buffers](https://developers.google.com/protocol-buffers) compiler.\nFor installation instructions, see [Protocol Buffer Compiler Installation documentation](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation).\nYou can also use your package manager (e.g. `brew install protobuf` on macOS).\n\nGo the [releases page](https://github.com/Cryptact/twirpy/releases/latest), and download the `protoc-gen-twirpy` binary for your platform.\nUnzip the archive and move the binary to a directory in your PATH.\n\nOn macOS, you can use the following commands:\n```sh\ncurl -L -o- \\\n https://github.com/Cryptact/twirpy/releases/latest/download/protoc-gen-twirpy_Darwin_arm64.tar.gz \\\n | tar xz -C ~/.local/bin protoc-gen-twirpy\n````\n\n## Generate and run\n\nUse the protoc plugin to generate twirp server and client code.\n```sh\nprotoc --python_out=. --pyi_out=. --twirpy_out=. example/rpc/haberdasher/service.proto\n```\n\nFor more information on how to generate code, see the [example](example/README.md).\n\n## Development\n\nWe use [`hatch`](https://hatch.pypa.io/latest/) to manage the development process.\n\nTo open a shell with the development environment, run: `hatch shell`.\nTo run the linter, run: `hatch fmt --check` or `hatch fmt` to fix the issues.\n\n## Standing on the shoulders of giants\n\n- The initial version of twirpy was made from an internal copy of https://github.com/daroot/protoc-gen-twirp_python_srv\n- The work done by [Verloop](https://verloop.io/) on [the initial versions of Twirpy](https://github.com/verloop/twirpy).\n- The `run_in_threadpool` method comes from https://github.com/encode/starlette\n",
"bugtrack_url": null,
"license": null,
"summary": "Twirp runtime library for Python",
"version": "0.2.0.dev1",
"project_urls": {
"repository": "https://github.com/cryptact/twirpy"
},
"split_keywords": [
"protobuf",
" rpc",
" twirp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aee6d35408ba8bb6a6b353123a2439133b8e06b1b5c36c82c59c7e66396b0690",
"md5": "7d9d2ef1b529ae1ff0404a609717e8d2",
"sha256": "f0ee8e44db89dd0832ac99f7293e57410d1d1cbff702fc44075303c6320780aa"
},
"downloads": -1,
"filename": "twirpy-0.2.0.dev1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d9d2ef1b529ae1ff0404a609717e8d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 13006,
"upload_time": "2024-09-09T00:08:17",
"upload_time_iso_8601": "2024-09-09T00:08:17.117802Z",
"url": "https://files.pythonhosted.org/packages/ae/e6/d35408ba8bb6a6b353123a2439133b8e06b1b5c36c82c59c7e66396b0690/twirpy-0.2.0.dev1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02e80d913415d6d9e73065d84654bec611a7b68ae0436872fc017162fbec563f",
"md5": "978a6ca9f678409cef618db3cd67198f",
"sha256": "f12400b594ac615c466bf28dd19f2413769142ed4777b37cd1e49a300b3daf73"
},
"downloads": -1,
"filename": "twirpy-0.2.0.dev1.tar.gz",
"has_sig": false,
"md5_digest": "978a6ca9f678409cef618db3cd67198f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9335,
"upload_time": "2024-09-09T00:08:18",
"upload_time_iso_8601": "2024-09-09T00:08:18.040335Z",
"url": "https://files.pythonhosted.org/packages/02/e8/0d913415d6d9e73065d84654bec611a7b68ae0436872fc017162fbec563f/twirpy-0.2.0.dev1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 00:08:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cryptact",
"github_project": "twirpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "twirpy"
}