Skip to main content

ABMeter Python SDK

ABMeter is a feature-flag and A/B-testing platform. You define parameters, experiments, and feature flags in the ABMeter Lab; this package reads the value assigned to each user in your Python app and reports events back.

Supported Python versions

abmeter supports Python 3.11 and newer (tested against 3.11, 3.12, 3.13).

Installation

pip install abmeter

Getting an API key

Sign up at abmeter.ai, then in the Lab open API Keys and create one. Pass it to configure (e.g. from an environment variable).

Usage

Configure the client once at startup:

import abmeter

abmeter.configure(api_key="your-api-key")

The example below assumes a parameter welcome_text (in a space, with a variant, controlled by a running experiment or feature flag) and an event type user_purchases_plan already exist — create them through the ABMeter API or, more easily, your AI assistant over MCP. Until they do, resolve_parameter just returns the parameter's default and track_event rejects unknown event types.

# In request handling: read the value assigned to this user. `user_id` is the
# only required field; an optional `email=` is available for predicate-based
# (email-pattern) audience targeting.
user = abmeter.User(user_id=current_user.id)
text = abmeter.resolve_parameter(user, "welcome_text")

# In business logic: record an action that feeds a metric.
abmeter.track_event(
    "user_purchases_plan",
    current_user.id,
    {"plan": purchased_plan.name, "price": purchased_plan.price},
)

The two calls are one loop: the experiment varies welcome_text, and the event feeds a metric whose effect the experiment measures across variants. Note that resolve_parameter is not a pure read — it fetches the assignment config, resolves the variant client-side (no per-call round-trip), and records an exposure in the background; use get_exposure for the same resolution without submitting (useful for debugging). Full guides live at abmeter.ai.

What this SDK is

A thin client: it fetches the assignment config, resolves parameters locally, and submits exposures/events. It deliberately does not contain the platform-side concerns of the Ruby gem (config serialization, allocation range-building, type-validation registry). Those live in the ABMeter API.

Development

The package uses uv. It is a pure client library, so the unit suite needs no database or any other running service.

uv sync --extra dev   # install dependencies
uv run pytest         # tests
uv run ruff check .   # lint
uv run mypy           # type check

License

Available as open source under the terms of the MIT License.

Metadata

Release files for abmeter 0.2.0

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

Source distribution (sdist)

Source distribution for abmeter 0.2.0
File Size Uploaded Provenance
abmeter-0.2.0.tar.gz 33.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for abmeter 0.2.0
File Interpreter ABI Platform
abmeter-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / abmeter-0.2.0.tar.gz

Download URL abmeter-0.2.0.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
901194a80ffe4c9a399ec781c72cb1fe600a93d695cd7459568587a374103008
BLAKE2b-256 checksum
How to use checksums
17b652e369e5ec2a07680b35714e1d14197cd2faefb58b3ebce83e7a49317161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / abmeter-0.2.0-py3-none-any.whl

Download URL abmeter-0.2.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
670477d1db2a714195de03e90a54c7390ff4fd48f6c77941ab8f7f49a7d18dd0
BLAKE2b-256 checksum
How to use checksums
cd9700faee5ea2f0e906f1d89a6e4caa4ff28e7be8370d87bf02d89c3a442a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for abmeter 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.

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