Skip to content

btclib-org/btclib_libsecp256k1

Repository files navigation

btclib_libsecp256k1

python pypi downloads status license imports: isort code style: black lint: flake8 lint: pylint type-check: mypy type-check: pyright security: bandit pre-commit.ci status build test

Follow on Twitter


Browse GitHub Code Repository


Simple python bindings to libsecp256k1 (v0.2.0). It is intended to be used with the btclib library.

To install (and/or upgrade):

python -m pip install --upgrade btclib_libsecp256k1

Build, test, develop, and contribute

Disclaimer: building and testing on Windows is not currently supported; Windows support is achieved with cross compilation

The btclib_libsecp256k1 project includes libsecp256k1 as submodule in the secp256k1 folder. By default, when cloning a project you get the directories that contain submodules, but none of the files within them. You must run git submodule init to initialize your local configuration file, and git submodule update to fetch the submodule data and check out the appropriate commit.

$ git submodule init
Submodule 'secp256k1' ([email protected]:bitcoin-core/secp256k1.git) registered for path 'secp256k1'
$ git submodule update
Cloning into 'secp256k1'...

The project uses hatch as a project manager.

Some additional tools are required to develop and test btclib_libsecp256k1; they can be installed with:

python -m pip install -U nox cibuildwheel pre-commit

To build:

hatch build -t sdist
hatch build -t wheel

Developers might also consider installing btclib_libsecp256k1 in editable way::

python -m pip install --upgrade -e ./

To test:

hatch -e test run pytest

To measure the code coverage provided by tests:

hatch -e test run pytest --cov-report term-missing:skip-covered --cov=btclib_libsecp256k1

It is however recommended to use nox to better isolate tests

nox -s tests

To format the code

hatch -e dev run format

To run re-commit hooks

hatch -e dev run pre_commit

Please run nox to check everything before a PR

nox