Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

betterleaks-sdk

Native in-process Python SDK for Betterleaks, powered by Go (bindings/c).

pip install betterleaks-sdk installs only the C ABI shared library and Python bindings (import betterleaks_sdk) on macOS and glibc Linux — no CLI binary is bundled, and Windows is not supported.

For the full bundle (Python SDK + betterleaks CLI), install betterleaks. For the standalone CLI binary, install betterleaks-cli.


Installation

pip install betterleaks-sdk

Platform Support

Platform Architecture Python API (scan_string / scan_file)
macOS 12+ ARM64 & x86-64 Native C ABI (libbetterleaks_ffi.dylib)
Linux (glibc) x86-64 & ARM64 Native C ABI (libbetterleaks_ffi.so)
Windows — Not supported (install betterleaks or betterleaks-cli instead)

Building from Source

git clone https://github.com/betterleaks/betterleaks.git
cd betterleaks
pip install ./bindings/python/sdk

Quickstart & Typed Data Models

All scan results are returned as strongly typed Python dataclasses (Finding, Match, Location) with collections.abc.Mapping compatibility:

from typing import List
import betterleaks_sdk
from betterleaks_sdk import BetterleaksError, Finding

try:
    findings: List[Finding] = betterleaks_sdk.scan_string(
        "GITHUB_TOKEN=ghp_example..."
    )
    for finding in findings:
        print(finding.rule_id, finding.location.start_line)
except BetterleaksError as err:
    print(f"Scan failed: {err}")

Use scanner.scan_string_report(text) or scanner.scan_file_report(path) to obtain the full engine report, including engine_version, config_hash, and summary. The existing scan methods return typed findings.

License

MIT License. See LICENSE for details.

Metadata

Release files for betterleaks-sdk 2.0.0rc16

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

Source distribution (sdist)

Source distribution for betterleaks-sdk 2.0.0rc16
File Size Uploaded Provenance Actions
betterleaks_sdk-2.0.0rc16.tar.gz 1.9 MB With provenance Details for betterleaks_sdk-2.0.0rc16.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for betterleaks-sdk 2.0.0rc16
File Actions
betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details for betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_x86_64.whl
betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_arm64.whl

Total release size: 33.8 MB

Release files / betterleaks_sdk-2.0.0rc16.tar.gz

Download URL betterleaks_sdk-2.0.0rc16.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
21a01309a5d0fc0662ee2c411afd4de5dbb6424700626b4d95b083a9e2ccc7e0
BLAKE2b-256 checksum
How to use checksums
deeabbc2b247fff2585b5158d534e75a43c10099964db04e41a0b8c9e9566363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Nov 27, 2026.

Transparency log

Release files / betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 7.7 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f59105eb89b51bea4573d6154e04787f70df4ff66a617301750fd1091890e0cc
BLAKE2b-256 checksum
How to use checksums
3bfaa6158a52b910a04ed2eb07afa994718595fe8c0d8452488cf75f45874dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Nov 27, 2026.

Transparency log

Release files / betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL betterleaks_sdk-2.0.0rc16-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 8.5 MB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
32e3463ae5db712a6dac7e3b6947d0fefe3ce82a5f7e4b7348f5cea249579926
BLAKE2b-256 checksum
How to use checksums
900970b73524d8d6a5c2e231c0774ed86f422f3b5120033fa88440d9ecde8ff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Nov 27, 2026.

Transparency log

Release files / betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_x86_64.whl

Download URL betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_x86_64.whl
Size 8.2 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
18bb991834f1c714e5f5b57c57755498595c2576a1b8ede03dc88a8dcd05d6f9
BLAKE2b-256 checksum
How to use checksums
71249adfc00dc7bba82408cc5e48a07e288eb45b3cafa0f1ec42e3b8ac72f28a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Nov 27, 2026.

Transparency log

Release files / betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_arm64.whl

Download URL betterleaks_sdk-2.0.0rc16-py3-none-macosx_12_0_arm64.whl
Size 7.6 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
137c605fd871fde9cca0146d7fa039daf3ca1ad32cb68eccedd85e1660c87dae
BLAKE2b-256 checksum
How to use checksums
266f5d66f355cd545dfcba5fabcea5ac2d321c7fe62c86a9e591d9dec4963615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Nov 27, 2026.

Transparency log

Security for betterleaks-sdk 2.0.0rc16

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for betterleaks_sdk-2.0.0rc16.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 Nov 27, 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
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