Antorc
Antorc is a lightweight communication bridge between a frontend application and a backend application.
It is not a web framework. It does not replace Flask, Django, or FastAPI. It does one small thing well: it lets a frontend send structured data to a backend, and lets a backend respond, without either side dealing with raw HTTP requests, sockets, or JSON serialization by hand.
- ✅ Zero third-party dependencies (pure Python standard library)
- ✅ Simple, Flask-like API
- ✅ Full type hints
- ✅ Clear, catchable exceptions
- ✅ Small enough to read in one sitting
Install
pip install antorc
(For local development, see Development below.)
Quick start
1. Write a backend
# backend.py
from antorc import AntorcServer
server = AntorcServer()
@server.route("/user")
def user(data: dict) -> dict:
name = data.get("name", "stranger")
return {"status": "ok", "message": f"Hello, {name}!"}
server.run() # starts listening on http://127.0.0.1:8000
2. Write a frontend / client
# frontend.py
from antorc import AntorcClient
client = AntorcClient("http://127.0.0.1:8000")
response = client.send(endpoint="user", data={"name": "John"})
print(response) # {'status': 'ok', 'message': 'Hello, John!'}
That's it. Run backend.py, then run frontend.py in another terminal.
Core concepts
Antorc has exactly four things to learn:
AntorcClient
The frontend-side object. It sends a dict of data to a named endpoint and returns the backend's dict response.
client = AntorcClient("http://127.0.0.1:8000", timeout=10.0)
response = client.send(endpoint="user", data={"name": "John"})
AntorcServer
The backend-side object. Register a function per endpoint with @server.route(...). Every handler receives a dict and must return a dict (or None).
server = AntorcServer()
@server.route("/user")
def user(data: dict) -> dict:
return {"status": "ok"}
server.run(host="127.0.0.1", port=8000)
AntorcMessage
An optional helper for structuring and serializing {endpoint, data} pairs yourself, if you need to store or log messages instead of sending them immediately.
from antorc import AntorcMessage
message = AntorcMessage(endpoint="user", data={"name": "John"})
raw = message.to_json()
restored = AntorcMessage.from_json(raw)
Exceptions
Every error Antorc raises inherits from AntorcError, so you can catch broadly or specifically:
from antorc import AntorcClient, AntorcError, AntorcTimeoutError
client = AntorcClient("http://127.0.0.1:8000")
try:
client.send("user", {"name": "John"})
except AntorcTimeoutError:
print("The backend took too long to respond.")
except AntorcError as exc:
print(f"Something went wrong: {exc}")
| Exception | Raised when |
|---|---|
AntorcConnectionError |
The backend could not be reached at all |
AntorcTimeoutError |
The request took longer than the configured timeout |
AntorcServerError |
The backend responded with an error status |
AntorcValidationError |
Data isn't a JSON-serializable dict, or JSON couldn't be parsed |
AntorcRouteNotFoundError |
No handler is registered for the requested endpoint |
What Antorc is not
To keep it simple and focused, Antorc intentionally does not include:
- A database or ORM
- An authentication/session system
- HTML templating
- Frontend build tooling
- WebSockets or streaming (may be considered in a future major version)
If you need any of the above, pair Antorc with a real framework — that's exactly what it's designed to sit alongside.
Development
git clone https://github.com/yourname/antorc.git
cd antorc
pip install -e ".[dev]"
pytest
License
MIT
Release files for antorc 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| antorc-0.0.1.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| antorc-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:18.8 kB
Release files / antorc-0.0.1.tar.gz
| Download URL | antorc-0.0.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e43e2ea5c8842e4a35787c97c0c3f46609b1d3a641981cb78f9e67d337d2e25
|
|
BLAKE2b-256 checksum How to use checksums |
71c7cd2c26ec39f9b1397ae7c0affc73d11edf1d54ebbe732d48d5336ea66d75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / antorc-0.0.1-py3-none-any.whl
| Download URL | antorc-0.0.1-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b898febb58ffd6bc4774e9a76f35fc2bce7e3b326b07d08f737784363604afb
|
|
BLAKE2b-256 checksum How to use checksums |
ae40704ef64dcf6f925e1aa73a80c27a3bb0dbc674d3c45f95ead9b2a7843628
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|