Skip to main content

maping-client

Zero-config RED-metrics client for FastAPI/Starlette services, reporting to a mAPI-ng collector.

Open source. Start free on the hosted service (no card), or self-host the complete MIT stack.

Aggregates per-endpoint rate/errors/duration into a DDSketch client-side and ships batched summaries over the Connect unary protocol, matching the wire contract used by mAPI-ng's Go clients (maping/client). No MAPING_KEY set means the middleware is a no-op: safe to add to any app.

Hosted or self-hosted

This client behaves identically either way: only the env vars you set differ.

  • Hosted, forever free, no card. Sign up at mapi-ng.com, create a key, set MAPING_KEY. That is the whole setup: the client already defaults to the hosted ingest endpoint, so MAPING_ENDPOINT is not needed.
  • Self-hosted. Run the complete MIT stack yourself (make local for dev, make up for prod, see arhuman/maping). Set MAPING_KEY for your own instance and MAPING_ENDPOINT to point at it.

Nothing here is held back to push you toward the hosted plan: the wire contract, the server, and this client are all MIT. Start hosted and move to self-hosting later, or the reverse, at any time. Convenience, not lock-in.

Status

Early development. Wire contract is pinned from arhuman/maping's proto/maping/v1/maping.proto via scripts/sync-proto.sh; see that repo's docs/adr/ for the design rationale behind the wire format (DDSketch, ADR-0001; Connect protocol, ADR-0002).

Quickstart

Set your credentials (pick one; see "Hosted or self-hosted" above):

# Hosted (forever free, no card)
export MAPING_KEY="mk_live_..."

# Self-hosted
export MAPING_KEY="mk_live_..."
export MAPING_ENDPOINT="https://your-collector.internal"

Then the same code either way:

from contextlib import asynccontextmanager

from fastapi import FastAPI
from maping import Recorder
from maping.asgi import MapingMiddleware

recorder = Recorder()  # reads MAPING_KEY, and MAPING_ENDPOINT if self-hosting, from env


@asynccontextmanager
async def lifespan(_: FastAPI):
    await recorder.start()
    yield
    await recorder.shutdown()  # must run AFTER the server stops accepting requests


fastapi_app = FastAPI(lifespan=lifespan)

# Wrap the WHOLE app -- not app.add_middleware() -- so this sits outside
# Starlette's ServerErrorMiddleware and observes the real final status even
# after an unhandled exception. See src/maping/asgi.py for why.
app = MapingMiddleware(fastapi_app, recorder=recorder)

See examples/fastapi_app.py for a fuller quickstart, including labelled errors, aborted requests, and downstream-call timing.

Running tests

git clone https://github.com/arhuman/maping-python.git
cd maping-python
pip install -e ".[dev,zstd]"

ruff check src/ tests/ examples/
mypy src/
pytest tests/ -v

Same three commands the CI workflow runs on every push and PR (see .github/workflows/_test.yml, the reusable workflow both ci.yml and release.yml call).

Contributing

  • Open an issue or PR against arhuman/maping-python.
  • Keep changes scoped: one concern per PR, with tests. ruff check, mypy, and pytest all have to pass before review; CI enforces this on every PR.
  • The wire contract under src/maping/proto/v1/ is pinned from the core arhuman/maping repo via scripts/sync-proto.sh (see PINNED_REF for the exact pin). Don't hand-edit the generated maping_pb2.py/maping_pb2.pyi; change the pin and re-run the sync script instead.

Fidelity notes

  • RED metrics (rate, errors, duration, DDSketch percentiles) match the Go client's wire contract exactly.
  • InstanceWindow/USE gauges (CPU, memory, GC, goroutine-equivalents) are best-effort approximations of the Go runtime stats the field names were originally defined for; Python's GC/concurrency model has no exact equivalent to Go's runtime introspection. See src/maping/_sampler.py.

Metadata

Release files for maping-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maping-client 0.1.1
File Size Uploaded Provenance Actions
maping_client-0.1.1.tar.gz 58.2 kB With provenance Details for maping_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maping-client 0.1.1
File Interpreter ABI Platform Actions
maping_client-0.1.1-py3-none-any.whl Python 3 none any Details for maping_client-0.1.1-py3-none-any.whl

Total release size: 101.4 kB

Release files / maping_client-0.1.1.tar.gz

Download URL maping_client-0.1.1.tar.gz
Size 58.2 kB
Tags Source
SHA-256 checksum
How to use checksums
010f9c1226c474fe344b80310c6c5800a597b6d10d3a87b3629900dfda2aaa35
BLAKE2b-256 checksum
How to use checksums
be73337a0434bd275afabc9e2d45f119da3a9738eee7d5e9f5341429236e1fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / maping_client-0.1.1-py3-none-any.whl

Download URL maping_client-0.1.1-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be74bd98e3bb1d82e40eaab3abe801306d70c31878db7586e4638a55574bd832
BLAKE2b-256 checksum
How to use checksums
9b32fe8c77f0fbf84098900d6bad865625c62f3f97657c22dd158d810260b94d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Security for maping-client 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for maping_client-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page