Skip to main content

doltlite (Python)

A Python loader for doltlite — Dolt's version control through SQLite's drop-in API.

import doltlite          # one-time bootstrap
import sqlite3

conn = sqlite3.connect("repo.db")
conn.execute("CREATE TABLE t(x INT)")
conn.execute("INSERT INTO t VALUES (1)")
conn.execute("SELECT dolt_commit('-A', '-m', 'init')")

import doltlite makes libdoltlite the active SQLite engine for the current interpreter, so anything that uses the standard sqlite3 module — including SQLAlchemy with sqlite:///... URLs — transparently gains dolt_commit, dolt_branch, dolt_merge, dolt_log, dolt_diff_<table>, and the other Dolt SQL functions and virtual tables.

Install

pip install doltlite

Wheels bundle a precompiled libdoltlite for macOS (arm64) and Linux (x86_64, aarch64). No system-level setup required.

Intel Mac wheels aren't shipped in v0.11.x — GitHub's free-tier macos-13 runners queue for hours and block releases. Intel Mac users should build libdoltlite locally and use the DOLTLITE_LIB path below.

For development against a local checkout of doltlite, point DOLTLITE_LIB at your built library instead:

DOLTLITE_LIB=/path/to/libdoltlite.dylib python3 your_script.py

Requirements

The package piggybacks on Python's stdlib sqlite3, which must load SQLite as a shared extension at runtime. The following Pythons work:

  • Distro / system Python (Linux)
  • Homebrew Python (macOS, Linux)
  • pyenv-built Python
  • Conda Python

These do not work because their _sqlite3 is statically linked into the interpreter:

  • python-build-standalone interpreters — the default for uv python install, mise, and Rye

If you use uv, target one of the supported Pythons explicitly:

uv venv --python /opt/homebrew/bin/python3   # or /usr/bin/python3

How the bootstrap works

Doltlite is a SQLite drop-in: it implements the same sqlite3_* C API and adds Dolt-specific functions and virtual tables on top. To use it from Python, libdoltlite has to be loaded ahead of the system libsqlite3 so its symbols win during the dynamic-link symbol-resolution pass that Python's _sqlite3 module triggers when it's first imported.

The mechanics differ by platform:

Linux

ELF flat-namespace symbol resolution: if libdoltlite is loaded into the process with RTLD_GLOBAL before _sqlite3 is loaded, its sqlite3_* symbols enter the global namespace and the later libsqlite3.so lookup finds them first.

import doltlite does ctypes.CDLL(libdoltlite_path, mode=ctypes.RTLD_GLOBAL) in this case — no re-exec required.

If sqlite3 was already imported before doltlite, that boat has sailed: we fall back to re-execing the interpreter with LD_PRELOAD set, so libdoltlite is loaded at process start.

macOS

macOS uses a two-level namespace: _sqlite3.so has an LC_LOAD_DYLIB command bound to a specific libsqlite3.dylib path (e.g. /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib). Plain dlopen / ctypes.CDLL does not redirect that resolution, and DYLD_INSERT_LIBRARIES alone doesn't either — the inserted library has to have an install_name (LC_ID_DYLIB) that matches the path _sqlite3.so was linked against.

import doltlite does:

  1. Detect that path via otool -L $(python3 -c 'import _sqlite3; print(_sqlite3.__file__)').
  2. Copy libdoltlite to $TMPDIR/.../libsqlite3.dylib (cached per (lib, mtime, install_name)).
  3. Rewrite the shim's install_name with install_name_tool -id <path>.
  4. Re-exec the interpreter with DYLD_INSERT_LIBRARIES=<shim>.

The two-level lookup then accepts the shim because the install_name matches.

This requires otool and install_name_tool — install Xcode Command Line Tools (xcode-select --install) if missing.

Re-exec caveats

When a re-exec is required (macOS, or Linux-after-sqlite3-loaded), the bootstrap calls os.execvpe with sys.argv. That means the invocation must name a script file we can replay:

  • ✅ python3 my_script.py
  • ✅ python3 -m my_package
  • ❌ python3 -c "import doltlite; ..." — code string isn't in argv
  • ❌ Interactive REPL / Jupyter — there's no script to re-exec

In the unsupported cases the bootstrap raises DoltliteLoadError with a clear workaround: set DYLD_INSERT_LIBRARIES (macOS) or LD_PRELOAD (Linux) yourself before starting Python.

API

import doltlite

# Side-effect import does the bootstrap automatically. Subsequent
# imports are no-ops thanks to a process-env marker.

# If you want to bootstrap explicitly (e.g. inside a function):
doltlite.bootstrap()

# Find where the loaded libdoltlite came from:
doltlite.libdoltlite_path()  # absolute path

See also

License

Apache License 2.0. See LICENSE.

Metadata

Release files for doltlite 0.51.15

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

Source distribution (sdist)

Source distribution for doltlite 0.51.15
File Size Uploaded Provenance Actions
doltlite-0.51.15.tar.gz 15.6 kB With provenance Details for doltlite-0.51.15.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for doltlite 0.51.15
File Interpreter ABI Platform Actions
doltlite-0.51.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for doltlite-0.51.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
doltlite-0.51.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for doltlite-0.51.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
doltlite-0.51.15-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for doltlite-0.51.15-py3-none-macosx_11_0_arm64.whl

Total release size: 22.2 MB

Release files / doltlite-0.51.15.tar.gz

Download URL doltlite-0.51.15.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d820c81671737c1e28df469202e10ed15a92a89f033c8fab124272d84bcb2fa0
BLAKE2b-256 checksum
How to use checksums
65ae658cad3728934d58b99ac0dcdcf76bb888119df2044ae5d4c97fd8ba1f86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Release files / doltlite-0.51.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL doltlite-0.51.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 10.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a8058f16aecc0831c82d51bc6a2990dca46e6cc0d0fdd91c598c603e0b71a293
BLAKE2b-256 checksum
How to use checksums
4a25181475dd32e0d532864d4242dd04b6a6e876f229add01b0364f2fd0b55d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Release files / doltlite-0.51.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL doltlite-0.51.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 9.7 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1506c7a560a01cdce9537a772ea7df1078415f65a5c121e291fa2f840070cd6b
BLAKE2b-256 checksum
How to use checksums
07b3d4e4e3b2c7d3240b6fd3e5b7128b0c85add1158ecb730edca9b5570da2cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Release files / doltlite-0.51.15-py3-none-macosx_11_0_arm64.whl

Download URL doltlite-0.51.15-py3-none-macosx_11_0_arm64.whl
Size 2.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1ae8ff5dd279d13ce042504305b0e04898df637b79af63ed843679ea61a0fe2d
BLAKE2b-256 checksum
How to use checksums
5dfdb6a4bdb26f5c635dccfe0198f38a1e361bfc509282aa16e53f8873147827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 21, 2026.

Transparency log

Security for doltlite 0.51.15

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

Select from 4 files

Attestation for doltlite-0.51.15.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 21, 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.51.15 This release

4 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