--- id: thriftpy2 version: "0.7.0" license: The MIT License (MIT) Copyright (c) <2014> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) license_treatment: permissive maintenance: active --- # thriftpy2 — Pure python implementation of Apache Thrift. License: permissive · Maintenance: active · Downloads: 1.7M/mo ## What it is and what it does ThriftPy2 is a pure Python Thrift implementation that eliminates the need to compile or install the official Thrift package. You define your service interface in a .thrift file, then load it dynamically at runtime using thriftpy2.load(), which generates Python classes on the fly. This approach works with both synchronous and asynchronous code paths, supporting multiple protocols (binary, compact, JSON, Apache JSON) and transports (buffered, framed, HTTP). The package is designed for developers building microservices or distributed systems who want the flexibility of Thrift's language-agnostic RPC without the compilation step. It includes helpers like make_server, make_client, make_aio_server, and make_aio_client to simplify server and client setup. Runtime dependencies are minimal: ply for parsing, ijson for JSON handling, and typing_extensions for type hints. Use it for: - Build RPC microservices that communicate with Thrift-based servers written in other languages - Dynamically load and parse Thrift service definitions at application startup without code generation - Create async/await-based Thrift servers and clients for high-concurrency applications - Migrate from the deprecated ThriftPy package by changing imports to thriftpy2 - Implement HTTP-based Thrift transports for services behind load balancers or proxies ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. ThriftPy2 is a pure Python implementation of Apache Thrift that lets you load Thrift IDL files dynamically and build RPC clients and servers without code generation or compilation. Yes. ThriftPy2 is actively maintained, has no known vulnerabilities, supports current Python versions (3.7+), and is widely used (top 5000 PyPI packages). Install it if you need Thrift RPC without compilation overhead. Medium install friction is acceptable given the broad platform coverage and stability. ## Install pip install thriftpy2 uv add thriftpy2 poetry add thriftpy2 ## Installing thriftpy2 Before you install: Medium install friction due to compiled wheels for multiple Python versions and platforms. The package is actively maintained with a recent release and no known vulnerabilities, making it a stable choice for production use. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects, with only attribution and license inclusion required. Quickstart: pip install thriftpy2 import thriftpy2 from thriftpy2.rpc import make_server pingpong_thrift = thriftpy2.load("pingpong.thrift", module_name="pingpong_thrift") class Dispatcher: def ping(self): return "pong" server = make_server(pingpong_thrift.PingPong, Dispatcher(), '127.0.0.1', 6000) server.serve() Requires a .thrift file defining your service interface; Python 3.7 or later Verify before relying: - Performance characteristics compared to official Apache Thrift implementation - Completeness of Cython optimization coverage across all protocols and transports ## Package facts - License: The MIT License (MIT) Copyright (c) <2014> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 1.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags thrift rpc client server, apache thrift python, thrift idl loader, rpc protocol implementation, thrift without code generation, async thrift server, thrift binary protocol, rpc-framework, thrift-protocol, async-support [View on SkillFed](https://skillfed.io/packages/thriftpy2) · [View on PyPI](https://pypi.org/project/thriftpy2/)