Python bindings to libxeddsa.


License
MIT
Install
pip install XEdDSA==1.0.2

Documentation

PyPI PyPI - Python Version Build Status Documentation Status

python-xeddsa

Python bindings to libxeddsa.

Installation

python-xeddsa depends on two system libraries, libxeddsa>=2,<3 and libsodium.

Install the latest release using pip (pip install XEdDSA), from the wheels available in the artifacts of the Test & Publish workflow, or manually from source by running pip install . in the cloned repository. The installation from source requires libxeddsa, libsodium and the Python development headers to be installed.

Testing, Type Checks and Linting

python-xeddsa uses pytest as its testing framework, mypy for static type checks and both pylint and Flake8 for linting. All tests/checks can be run locally with the following commands:

$ pip install --upgrade pytest pytest-cov mypy pylint flake8
$ export MYPYPATH=stubs/
$ mypy --strict xeddsa/ setup.py libxeddsa/ tests/
$ pylint xeddsa/ setup.py libxeddsa/ tests/
$ flake8 xeddsa/ setup.py libxeddsa/ tests/
$ pytest --cov=xeddsa --cov-report term-missing:skip-covered

Usage with Brython

python-xeddsa can be used in the browser with Brython, thanks to the Emscripten build of libxeddsa. Refer to tests/test_brython.html for the setup routine required to load the Emscripten build for usage with Brython. In summary, Brython's initialization is deferred until after the libxeddsa WebAssembly module and wrapper have been loaded. Other than that, python-xeddsa can be used as usual and handled with Brython like a pure Python package.

The tests can be run with Brython by running the following commands from the root of this repository:

$ # You need brython-cli in the version fitting your local Python installation
$ pip install brython==$YOUR_PYTHON_VERSION
$ cd xeddsa/
$ # Older versions of brython-cli use `--make_package` instead of just `make_package`
$ brython-cli --make_package xeddsa
$ cd ../
$ python3 -m http.server 8080
$ xdg-open http://localhost:8080/tests/test_brython.html

You'll find the output in the browser's dev console.

Documentation

View the documentation on readthedocs.io or build it locally, which requires the Python packages listed in docs/requirements.txt. With all dependencies installed, run make html in the docs/ directory. You can find the generated documentation in docs/_build/html/.