Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f8e343d
fix: remove local version identifier from dev publish
vieiralucas Mar 21, 2026
8d65552
fix: include commit sha in dev build package description
vieiralucas Mar 21, 2026
f7a4ed9
feat: transparent leader hint reconnect on consume
vieiralucas Mar 22, 2026
1f5753e
fix: close old grpc channel before reconnecting
vieiralucas Mar 24, 2026
273746e
fix: resolve mypy no-any-return errors
vieiralucas Mar 24, 2026
fd28ba0
Merge pull request #2 from faiscadev/feat/leader-hint-reconnect
vieiralucas Mar 24, 2026
872b592
chore: bump version to 0.2.0
vieiralucas Mar 24, 2026
c9a83fc
feat: add batch enqueue, smart batching, and delivery batching (#3)
vieiralucas Mar 24, 2026
39a2e2e
feat: unified api surface for story 30.2
vieiralucas Mar 25, 2026
3451bb6
Merge pull request #4 from faiscadev/feat/30.2-unified-api
vieiralucas Mar 25, 2026
fb9c873
fix: resolve lint failures and cubic review findings
vieiralucas Mar 25, 2026
75d7246
feat: migrate python sdk from grpc to fibp binary protocol
vieiralucas Apr 4, 2026
635f0d3
fix: align admin/auth codec with actual fibp wire format
vieiralucas Apr 4, 2026
cafc46a
fix: handle consume without consume_ok, fix mypy type errors
vieiralucas Apr 4, 2026
c86be41
fix: add delivery decode diagnostics, fix mypy dict type annotations
vieiralucas Apr 4, 2026
9492cc8
fix: correct hot-path opcode assignments to match server implementation
vieiralucas Apr 4, 2026
2ca5c4b
fix: address cubic review findings
vieiralucas Apr 4, 2026
b65b872
fix: address cubic review findings
vieiralucas Apr 4, 2026
17a36b0
fix: broaden auth rejection test to accept any fila error
vieiralucas Apr 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/dev-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
run: |
COMMIT_COUNT=$(git rev-list --count HEAD)
SHORT_SHA=$(git rev-parse --short HEAD)
DEV_VERSION="0.1.dev${COMMIT_COUNT}+g${SHORT_SHA}"
DEV_VERSION="0.1.dev${COMMIT_COUNT}"
sed -i "s/^version = .*/version = \"${DEV_VERSION}\"/" pyproject.toml
echo "Publishing version: ${DEV_VERSION}"
sed -i "s/^description = .*/description = \"Python client SDK for the Fila message broker (dev build from ${SHORT_SHA})\"/" pyproject.toml
echo "Publishing version: ${DEV_VERSION} (${SHORT_SHA})"
- run: pip install build
- run: python -m build
- uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Python client SDK for the [Fila](https://github.com/faiscadev/fila) message broker.

Communicates with the Fila server over the FIBP (Fila Binary Protocol) on port 5555.

## Installation

```bash
Expand Down Expand Up @@ -102,7 +104,7 @@ client = Client(
)
```

The API key is sent as `authorization: Bearer <key>` metadata on every RPC.
The API key is sent during the FIBP handshake.

## API

Expand All @@ -114,6 +116,10 @@ Connect to a Fila broker. Both support context manager protocol.

Enqueue a message. Returns the broker-assigned message ID.

### `client.enqueue_many(messages) -> list[EnqueueResult]`

Enqueue multiple messages in a single request. Returns per-message results.

### `client.consume(queue) -> Iterator[ConsumeMessage]`

Open a streaming consumer. Returns an iterator (sync) or async iterator (async) that yields messages as they become available.
Expand All @@ -126,12 +132,31 @@ Acknowledge a successfully processed message. The message is permanently removed

Negatively acknowledge a failed message. The message is requeued or routed to the dead-letter queue based on the queue's configuration.

### Admin Methods

- `client.create_queue(name, config=None)` -- Create a queue
- `client.delete_queue(name)` -- Delete a queue
- `client.get_stats(queue) -> StatsResult` -- Get queue statistics
- `client.list_queues() -> list[str]` -- List all queues
- `client.set_config(queue, config)` -- Set queue configuration
- `client.get_config(queue) -> dict` -- Get queue configuration
- `client.list_config(queue) -> dict` -- List queue configuration
- `client.redrive(source, dest, count)` -- Redrive messages between queues

### Auth Methods

- `client.create_api_key(name) -> CreateApiKeyResult` -- Create an API key
- `client.revoke_api_key(key_id)` -- Revoke an API key
- `client.list_api_keys() -> list[ApiKeyInfo]` -- List API keys
- `client.set_acl(key_id, patterns, superadmin=False)` -- Set ACL
- `client.get_acl(key_id) -> AclEntry` -- Get ACL

## Error Handling

Per-operation exception classes:

```python
from fila import QueueNotFoundError, MessageNotFoundError
from fila import QueueNotFoundError, MessageNotFoundError, UnauthorizedError

try:
client.enqueue("missing-queue", None, b"test")
Expand Down
56 changes: 54 additions & 2 deletions fila/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,73 @@
"""Fila Python client SDK for the Fila message broker."""
"""Fila -- Python client SDK for the Fila message broker."""

from fila.async_client import AsyncClient
from fila.client import Client
from fila.errors import (
AclNotFoundError,
ApiKeyNotFoundError,
ChannelFullError,
EnqueueError,
FilaError,
ForbiddenError,
InvalidArgumentError,
LuaError,
MessageNotFoundError,
NotLeaderError,
PermissionDeniedError,
ProtocolError,
QueueAlreadyExistsError,
QueueNotFoundError,
ResourceExhaustedError,
RPCError,
UnauthorizedError,
UnavailableError,
)
from fila.types import (
AccumulatorMode,
AclEntry,
AclPermission,
ApiKeyInfo,
ConsumeMessage,
CreateApiKeyResult,
EnqueueResult,
FairnessKeyStat,
Linger,
QueueInfo,
StatsResult,
ThrottleKeyStat,
)
from fila.types import ConsumeMessage

__all__ = [
"AccumulatorMode",
"AclEntry",
"AclNotFoundError",
"AclPermission",
"ApiKeyInfo",
"ApiKeyNotFoundError",
"AsyncClient",
"ChannelFullError",
"Client",
"ConsumeMessage",
"CreateApiKeyResult",
"EnqueueError",
"EnqueueResult",
"FairnessKeyStat",
"FilaError",
"ForbiddenError",
"InvalidArgumentError",
"Linger",
"LuaError",
"MessageNotFoundError",
"NotLeaderError",
"PermissionDeniedError",
"ProtocolError",
"QueueAlreadyExistsError",
"QueueInfo",
"QueueNotFoundError",
"RPCError",
"ResourceExhaustedError",
"StatsResult",
"ThrottleKeyStat",
"UnauthorizedError",
"UnavailableError",
]
Loading
Loading