ATTP Software Development Kit
The robust Python SDK for building distributed services with the ATTP protocol.
📖 Introduction
attp-sdk is the official Python library for integrating with the Ascender ecosystem using the ATTP (Ascender Tool Transmission Protocol). It provides a powerful set of tools to build high-performance, scalable, and reactive microservices.
With attp-sdk, you can effortlessly create controllers, handle RPC calls, manage events, and orchestrate service lifecycles, all while leveraging the robustness of the Ascender Framework.
⚡ Features
- RPC Decoration: Simple
@AttpCalldecorators to expose methods as RPC endpoints. - Event Driven: Reactive
@AttpEventhandlers for asynchronous communication. - Lifecycle Management: Hooks for
@AttpLifecycleevents likeconnectanddisconnect. - Error Handling: Centralized
@AttpErrorHandlerfor graceful failure management. - Dependency Injection: Seamless integration with Ascender's DI system.
- Transmitter: Fluent API for sending requests and notifications.
📦 Installation
Install via Poetry:
poetry add attp-sdk
Or using Pip:
pip install attp-sdk
Or using UV:
uv add attp-sdk
⚙️ Configuration
attp-sdk uses a configuration file (usually attp.jsonc or attp.json) to define node identity, authentication, and peer services.
Example attp.jsonc
{
"node": {
"name": "my-service",
"bind": "0.0.0.0:6563"
},
"caps": ["schema/msgpack", "streaming"],
"client": {
"auth": {
"mode": "hmac",
"secret": { "env": "ATTP_SHARED_SECRET" },
"node_id": "my-service",
"ttl_seconds": 30
}
},
"services": {
"peers": [
{ "namespace": "core-service", "uri": "attp://core-api:6563" }
]
}
}
🚀 Usage
Creating a Controller
Define your service logic using a class-based controller.
from ascender.core import Controller
from attp.decorators import AttpCall, AttpEvent, AttpLifecycle
from attp.types.frame import AttpFrameDTO
class EchoRequest(AttpFrameDTO):
message: str
class EchoResponse(AttpFrameDTO):
message: str
@Controller(
standalone=True,
providers=[],
)
class MyController:
@AttpCall("echo", namespace="core-service")
async def echo(self, payload: EchoRequest) -> EchoResponse:
print(f"Received: {payload.message}")
return EchoResponse(message=payload.message)
@AttpEvent("user.created")
async def on_user_created(self, payload: dict):
print(f"New user: {payload.get('id')}")
@AttpLifecycle("connect")
async def on_connect(self, meta: dict):
print("Connected to ATTP network")
Sending Messages
Use the AttpTransmitter to send requests or emit events.
from attp.shared.transmitter import AttpTransmitter
# In your controller or service
async def trigger_action(self):
response = await self.transmitter.send(
"remote_procedure",
MyPayload(data="foo"),
namespace="target-service",
expected_response=MyResponse
)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for attp-sdk 0.1.2
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 | Actions |
|---|---|---|---|---|
| attp_sdk-0.1.2.tar.gz | 32.0 kB | Without provenance | Details for attp_sdk-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attp_sdk-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for attp_sdk-0.1.2-py3-none-any.whl |
Total release size: 82.5 kB
Release files / attp_sdk-0.1.2.tar.gz
| Download URL | attp_sdk-0.1.2.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5b1da4159ff66768feaf54070f3678c3f3b01f031a62f37a4c5aec3b38e861a
|
|
BLAKE2b-256 checksum How to use checksums |
ed26b5b1d5aec0e128b5e2f04e72a5d51731e9456d63a36899bbff6bf6bdc578
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.13 Linux/6.18.2-arch2-1
|
Release files / attp_sdk-0.1.2-py3-none-any.whl
| Download URL | attp_sdk-0.1.2-py3-none-any.whl |
|---|---|
| Size | 50.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a4af6bfa7e8a7a0b20383b0fe7eb9ec0ce560410fd9d2b09f67fe77a83b1fa6
|
|
BLAKE2b-256 checksum How to use checksums |
5277b917aafd8d2a1b1dd723dbeb4d3a8e86ebbe9fda9f965ef91677a6a7cf93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.13 Linux/6.18.2-arch2-1
|
Security for attp-sdk 0.1.2
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.