The Python language bindings for the bitcoindevkit.
See the package on PyPI.
This repository uses the bdk-ffi repository as a git submodule. Here are useful tips for working with the submodule:
- When initially cloning the repo, the
bdk-ffisubmodule will be empty locally. You can initiate/populate the directory by using thejust submodule-initcommand. - If you make local changes to the
bdk-ffidirectory while developing and want to hard delete all changes and return to the exact committed version hash of the bdk-ffi repo, use thejust submodule-resetcommand.
Before building bdkpython locally, ensure you have installed the following tools:
- Rust toolchain (
rustup): Required to compilebdk-ffi. Install from rustup.rs. uv: Fast Python package installer and resolver. Install from Astral uv Docs.just(optional): Command runner used for repo tasks. Install viacargo install justor your system package manager.
Windows Users
- Windows: Rust's
x86_64-pc-windows-msvctarget needs the MSVC toolchain and Windows SDK.rustup-initoffers to install these for you; otherwise install Visual Studio Build Tools with the Desktop development with C++ workload. The build scripts are bash, so run them from Git Bash.
- Run one of the build scripts (skip the submodule update if you are making local changes to the
bdk-ffisubmodule) - Sync dependencies with
uv - Create the wheel
- Install the library
- Run the tests
Run the build script corresponding to your operating system:
Linux:
bash scripts/generate-linux.sh
macOS (Apple Silicon / ARM64):
bash scripts/generate-macos-arm64.sh
macOS (Intel / x86_64):
bash scripts/generate-macos-x86_64.sh
Windows (Git Bash / MSYS2):
bash scripts/generate-windows.sh
Note: Pass --skip-submodule-update if you are making local changes to bdk-ffi and wish to preserve them instead of resetting to the committed submodule hash.
# Sync dependencies with uv uv sync # Create the wheel uv build --wheel -v # Install the library uv pip install ./dist/bdkpython-*.whl --force-reinstall # Run the tests uv run python -m unittest --verbose
- Generate docs
- Build HTML Documentation
uv run python ./docs/generate_docs.py uv run python -m sphinx -b html -W --keep-going -v docs/source docs/_build/html