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.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 abtestify 0.3.1
File Size Uploaded Provenance
abtestify-0.3.1.tar.gz 5.0 kB With provenance Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / abtestify-0.3.1.tar.gz

Download URL abtestify-0.3.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2051d233edbeeb6e0ba6be17f4db924b1b541ef0dc8b5d2a974b1f32e678bf3d
BLAKE2b-256 checksum
How to use checksums
914607700a13ba72422e6ba096cdd0314fcfecbc0873fcbf173618ce7a31ecfd
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.1-py3-none-any.whl

Download URL abtestify-0.3.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20f1786cffa6004efcb02199e3680046b202531df5107f5a6895013ed4f712c0
BLAKE2b-256 checksum
How to use checksums
7a5be19f6bd0bc0d999ec7bb290beb82ddb1b58851eb969bfb3f44a8e52e2f47
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.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

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

Select from 2 files

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