pyi4thrift
convert thrift to pyi
How to use
uv pip install pyi4thrift
pyi4thrift tests/example.thrift
pyi4thrift tests/src/example.thrift -p tests/src -o tests/dest
Release
This project uses GitHub Actions to build and publish releases via OIDC.
Tag release:
git tag v2.0.0
git push origin v2.0.0
Manual release:
Run the "Release" workflow in GitHub Actions.
See dir "tests" for details.
Example
namespace py example
include "a/a.thrift"
const string A = "1";
const i32 B = 1;
const list<i32> C = [];
const list<i32> D = [1,2];
const map<i32,string> E = {};
const double F = 1.1;
struct Example {
1: map<map<a.A,a.A>, a.A> A
2: optional i16 B
3: i32 C
4: i64 D
5: bool E = true
6: byte F
7: double G = 0.1
8: string H = "hello"
9: a.A I
10: map<a.A, map<a.A,a.A>> J
11: map<a.A, a.A> K
12: map<string, bool> L = {}
13: map<string, list<map<string, a.A>>> M
14: list<a.A> N
15: list<string> O
16: set<i16> P
17: list<map<string, a.A>> Q
18: binary R
}
enum ExampleEnum {
A = 0
B = 1
C = 2
}
enum ErrCode {
ERR_SUCCESS = 0
ERR_REQ_PARAM_INVALID = 4000
ERR_UNKNOWN = 5000
ERR_SYSTEM_INNER_EXCEPTION = 5001
ERR_LIMIT_EXCEEDED = 5002
}
union ExampleUnion {
1: i32 A = 1
}
exception ByteException {
1: i32 ErrorCode = 0,
}
service ExampleService {
Example Get(1: a.A rq, 2: i64 xx)
i16 Pull(1: string name = "", 2: map<string,string> xxx) throws (1: ByteException exc)
void Test()
}
generated by pyi4thrift
# coding:utf-8
from typing import List, Set, Dict
from .a import a_thrift as a
from thriftpy2.thrift import TException
from enum import Enum
A = '1'
B = 1
C = []
D = [1, 2]
E = {}
F = 1.1
# noinspection PyPep8Naming, PyShadowingNames
class ExampleEnum(Enum):
A = 0
B = 1
C = 2
# noinspection PyPep8Naming, PyShadowingNames
class ErrCode(Enum):
ERR_SUCCESS = 0
ERR_REQ_PARAM_INVALID = 4000
ERR_UNKNOWN = 5000
ERR_SYSTEM_INNER_EXCEPTION = 5001
ERR_LIMIT_EXCEEDED = 5002
# noinspection PyPep8Naming, PyShadowingNames
class Example(object):
A: Dict[Dict[a.A, a.A], a.A]
B: int
C: int
D: int
E: bool
F: int
G: float
H: str
I: a.A
J: Dict[a.A, Dict[a.A, a.A]]
K: Dict[a.A, a.A]
L: Dict[str, bool]
M: Dict[str, List[Dict[str, a.A]]]
N: List[a.A]
O: List[str]
P: Set[int]
Q: List[Dict[str, a.A]]
def __init__(self,
A: Dict[Dict[a.A, a.A], a.A] = None,
B: int = None,
C: int = None,
D: int = None,
E: bool = True,
F: int = None,
G: float = 0.1,
H: str = 'hello',
I: a.A = None,
J: Dict[a.A, Dict[a.A, a.A]] = None,
K: Dict[a.A, a.A] = None,
L: Dict[str, bool] = {},
M: Dict[str, List[Dict[str, a.A]]] = None,
N: List[a.A] = None,
O: List[str] = None,
P: Set[int] = None,
Q: List[Dict[str, a.A]] = None) -> None:
...
# noinspection PyPep8Naming, PyShadowingNames
class ByteException(TException):
ErrorCode: int
def __init__(self, ErrorCode: int = 0) -> None:
...
# noinspection PyPep8Naming, PyShadowingNames
class ExampleService(object):
def Get(self, rq: a.A = None, xx: int = None) -> Example:
...
def Pull(self, name: str = '', xxx: Dict[str, str] = None) -> int:
...
def Test(self, ) -> None:
...
Metadata
Release files for pyi4thrift 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyi4thrift-2.1.0.tar.gz | 61.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyi4thrift-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.5 kB
Release files / pyi4thrift-2.1.0.tar.gz
| Download URL | pyi4thrift-2.1.0.tar.gz |
|---|---|
| Size | 61.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a28ac8d6d9c3ab9f7791a18f7af48045c15c19a9a013953f23ea1999df199011
|
|
BLAKE2b-256 checksum How to use checksums |
74ac933ced5578e690a0e241b5a30e0e37bb59c67dc2cb5c475fe7f8ac14fd99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pyi4thrift-2.1.0-py3-none-any.whl
| Download URL | pyi4thrift-2.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
416d9e0d4a4ce1cce215d1c893aca47efb280e09668bbcc37f88e120a9a170a5
|
|
BLAKE2b-256 checksum How to use checksums |
127e7a07d55c77ef6517955f693c139aefa4e3b6ec8b217c5fc9380ec95fb6db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pyi4thrift 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.