Skip to main content

abtestify

Deterministic A/B test bucketing for Python. Give it an experiment name and a user ID and it returns the same variant for that user every time, with no storage, no network calls and no dependencies.

Assignments are byte-for-byte identical to the abtestify npm package and its Go, Rust, Java/Kotlin and Swift ports, so a user lands in the same variant on every platform. Shared test vectors in the repository enforce it.

pip install abtestify
from abtestify import get_ab_experiment_bucket

assignment = get_ab_experiment_bucket(
    "checkout-cta",
    "user123",
    treatment_split=50,  # optional, default 50
    exposure=100,  # optional, default 100
)
if assignment.resolved_variant == "treatment":
    ...  # show the new checkout button

Keyword-only options: treatment_split, exposure, treatment_variant_name, control_variant_name, ignore_variant_name and legacy_hashing. The result is a frozen dataclass with experiment_name, unique_id and resolved_variant.

Invalid input raises TypeError (a non-numeric percentage or a non-string ID) or ValueError (a percentage that is not a finite number from 0 to 100, or an empty ID).

The bucket is the first 8 bytes of SHA-256 of experiment_name:unique_id, mapped to one of 10,000 buckets. Exposure takes the lowest buckets, and the split uses the bucket's last two digits, so raising exposure only adds users and raising treatment_split only moves users from control to treatment.

Requires Python 3.9 or later. Licensed under MIT.

Metadata

Release files for abtestify 0.3.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 abtestify 0.3.0
File Size Uploaded Provenance
abtestify-0.3.0.tar.gz 5.0 kB With provenance Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / abtestify-0.3.0.tar.gz

Download URL abtestify-0.3.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5ffbe0e24f1c82b6286754274f1e1b888075a3e6d4b52a1109e7cc76eef67821
BLAKE2b-256 checksum
How to use checksums
41845d15d630aea5650bf7d31fa606bc2d9525f4400b478aecb895bc0d18ff07
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 Oct 17, 2026.

Transparency log

Release files / abtestify-0.3.0-py3-none-any.whl

Download URL abtestify-0.3.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b10c874b2b56372de7e50a7b70fbeaad53b33a0de3c331e1bc28f1e5c4bc53b
BLAKE2b-256 checksum
How to use checksums
1b919c51cf3045ca1aa87d7bd5e19de85ad079c295212df36bc30de50631e836
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 Oct 17, 2026.

Transparency log

Security for abtestify 0.3.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for abtestify-0.3.0.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 Oct 17, 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.

Release history Release notifications | RSS feed

This release

0.3.0 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