brussle (Python)
Brussle answers questions about your records that depend on other records. For example, Will this account cancel? depends on the account's tickets and invoices, not on the account alone. A judgment is a typed question that Brussle answers for each document. A judgment on accounts can read each account together with its tickets and invoices. When a new ticket arrives, Brussle judges its account again and keeps the answer current. You do not write code to find the account, judge it again or control the cost.
This package is the Python client for the Brussle API.
import os
from brussle import Client
db = Client(api_key=os.environ["BRUSSLE_API_KEY"])
ns = db.namespace("acme/prod/tenant_123")
# A judgment on accounts that reads each account's tickets and invoices.
ns.judgments.create(
from_starter="churn_risk.at_risk",
paths={
"kind": "attributes.kind",
"account_kind": "account",
"ticket_kind": "ticket",
"invoice_kind": "invoice",
"account_ref": "attributes.account_id",
"name": "state.name",
"ticket_subject": "state.subject",
"ticket_status": "state.status",
"invoice_status": "state.status",
},
engine={"name": "jev", "version": "current"},
freshness={"policy": "on_change"},
confirm=True,
)
# An account, and a ticket that points at it with `account_id`.
ns.write(upsert=[
{"id": "acct_1", "attributes": {"kind": "account"}, "state": {"name": "Northwind"}},
{"id": "t_1", "attributes": {"kind": "ticket", "account_id": "acct_1"}, "state": {"subject": "Third outage this week. We are looking at other vendors.", "status": "open"}},
])
# Each new ticket or invoice judges its account again. Query the accounts at risk.
page = ns.query(
filters=("answers.churn_risk.thresholds.at_risk", "Eq", True),
rank_by=("answers.churn_risk.p", "desc"),
)
The quickstart runs this example step by step. Relations lists what else a judgment can read.
To load many documents, import_documents takes any iterable and writes it in batches, 4 at a time on a thread pool, with retries:
summary = ns.import_documents(records(), concurrency=4)
print(summary.documents, summary.failures)
How the client works:
- Methods mirror the API's routes.
- Every route that changes something takes
idempotency_key=. A call that would not be safe to repeat without one, such as a create, gets a key the SDK generates when you pass none, the same on each retry of that call. - Calls are retried after network errors, timeouts,
502,503and504, and after a429or503withRetry-After, 2 times by default (max_retries). A500is retried only for reads, writes and the other calls that are safe to repeat without a key. - Requests and responses are plain JSON, typed in
brussle.types. One exception:ns.outcomes.appendtakes the list of outcomes, not the whole request body. - Filters and
rank_byare tuples. - Errors raise
ApiErrorwith the API'scodeanddetails. Thecodeisunknownfor an error response that is not the API's JSON for example a proxy's error page, and for a success whose body is not JSON. - A call that your organization's plan does not include raises
plan_required(402).details["required_plan"]names the plan that includes it.
See the SDK reference.
Metadata
Release files for brussle 1.2.0
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 |
|---|---|---|---|---|
| brussle-1.2.0.tar.gz | 127.3 kB | Without provenance | Details for brussle-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brussle-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for brussle-1.2.0-py3-none-any.whl |
Total release size: 204.8 kB
Release files / brussle-1.2.0.tar.gz
| Download URL | brussle-1.2.0.tar.gz |
|---|---|
| Size | 127.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bc6ca264cc1f7c6cfa4c2864404f2f16900b39f770b02f0bfe0ad2a3b96667e
|
|
BLAKE2b-256 checksum How to use checksums |
d4c4900ac0ad8a54f24d0d65164f06e378870baa98300cfa9032d18956a6ce29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}
|
Release files / brussle-1.2.0-py3-none-any.whl
| Download URL | brussle-1.2.0-py3-none-any.whl |
|---|---|
| Size | 77.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b0aa0a71c5ca935a4422ffd7424ee5228e5d2b34f529d4b9353e209592b03e7
|
|
BLAKE2b-256 checksum How to use checksums |
abd72b45509a77aba2c554dc11f1cc002310bd38f4bc85aebd7976fd59085516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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 brussle 1.2.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.