amgi-nats
amgi-nats is an AMGI compatible server project, supporting running AMGI applications against NATS using either push or pull subscriptions.
- Push subscriptions use core NATS messaging. See amgi_nats.push.
- Pull subscriptions use JetStream consumers. See amgi_nats.pull.
Installation
pip install amgi-nats==0.51.0
Push Example
This example uses AsyncFast:
from dataclasses import dataclass
from amgi_nats.push import run
from asyncfast import AsyncFast
app = AsyncFast()
@dataclass
class Order:
item_ids: list[str]
@app.channel("order.subject")
async def order_subject(order: Order) -> None:
# Makes an order
...
if __name__ == "__main__":
run(app, "order.subject")
Or the application could be run via the commandline:
asyncfast run amgi-nats-push main:app order.subject
Pull Example
The pull server is run the same way, but consumes from a JetStream pull consumer. The stream and consumer are created if they do not exist:
from dataclasses import dataclass
from amgi_nats.pull import run
from asyncfast import AsyncFast
app = AsyncFast()
@dataclass
class Order:
item_ids: list[str]
@app.channel("order.subject")
async def order_subject(order: Order) -> None:
# Makes an order
...
if __name__ == "__main__":
run(app, "order.subject")
Or the application could be run via the commandline:
asyncfast run amgi-nats-pull main:app order.subject
Messages sent by the application are published through JetStream and wait for the stream acknowledgement, so a send
that no stream accepts raises nats.js.errors.NoStreamResponseError. The nats reply binding is not supported for
these sends, as the reply subject carries the acknowledgement. Push server sends use core NATS publishing, which is
fire and forget.
Contact
For questions or suggestions, please contact jack.burridge@mail.com.
License
Copyright 2025 AMGI
Metadata
Release files for amgi-nats 0.51.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amgi_nats-0.51.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / amgi_nats-0.51.0-py3-none-any.whl
| Download URL | amgi_nats-0.51.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfba64331d3094f3ba87524e1b280d06597f95289dc542b53455b8e6f224f2e3
|
|
BLAKE2b-256 checksum How to use checksums |
15f555990321037337d99a70379c6fab657a8767c2cb9e0c364dc480879c9ad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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 amgi-nats 0.51.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.