nodii-usage
Python port of @nodii/usage (S08-39, LIB-EVT-22): the STOP check, the meter and
the one usage-metered payload. A producer never holds a price and never names a
payer.
from nodii_usage import OtherUnit, UsageConfig, define_usage
usage = define_usage(
UsageConfig(
source_service="nodii-geo-service",
topic_prefix="geo",
outbox_table="geo_outbox",
pool=pool, # asyncpg.Pool
slice_keys=("geo.geocode_lookup.google",),
projection_ready=lambda: snapshot_drained,
)
)
decision = await usage.check_stop(tenant_id, "geo.geocode_lookup.google")
if decision.status != "allowed":
... # `unavailable` is a refusal too: retry later, or suppress a broadcast
async with conn.transaction():
await usage.meter(conn, OtherUnit(...))
check_stopfails closed: any failure returnsstatus="unavailable", it never raises.apply_usage_denialis the one write path. SetUsageControl, the event and the snapshot all go through it, and the highest source version wins.define_usage_denial_replicagives the replica spec; runget_usage_migration_sql()for the projection and marker tables.
keys_gen.py is generated; never edit it.
uv run pytest python/usage/tests/
Known limit: widening the slice
The projection stores only the denials inside the service's slice, and one version of a tenant's denials is applied once. A service that adds a key to its slice therefore reads that key as allowed, for a tenant already denied on it, until tenant-service emits that tenant's next version. A redelivery or a snapshot of the same version does not rewrite the row. The fix is an open question on STANDARDIZATIONS-AUDIT-19.
Metadata
Release files for nodii-usage 0.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 |
|---|---|---|---|---|
| nodii_usage-0.2.0.tar.gz | 19.6 kB | Without provenance | Details for nodii_usage-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nodii_usage-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for nodii_usage-0.2.0-py3-none-any.whl |
Total release size: 32.7 kB
Release files / nodii_usage-0.2.0.tar.gz
| Download URL | nodii_usage-0.2.0.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e75b2bd91b6777d15a84d3338a9b379349fcec1f15d883db556fd8b0d8a9c2d
|
|
BLAKE2b-256 checksum How to use checksums |
3b18daa52da7a649cb3234cb3737658794b99f2f71100135ebca06476fb8b290
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nodii_usage-0.2.0-py3-none-any.whl
| Download URL | nodii_usage-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd75a01d8f5b9823b26947e9cfc395ba2a79612d2b2a14a61c37391b68bce6ed
|
|
BLAKE2b-256 checksum How to use checksums |
16c2bd3a8a84c735ee8687f89a2046473551ab39be29d037f0ea9083706d4a68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for nodii-usage 0.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.