Skip to main content

Python bindings to libxeddsa.

Project description

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) or manually from source by running pip install . (preferred) or python setup.py install in the cloned repository. The installation requires libsodium and the Python development headers to be installed. If a locally installed version of libxeddsa is available, python-xeddsa tries to use that. Otherwise it uses prebuilt binaries of the library, which are available for Linux, MacOS and Windows on the amd64 architecture, and potentially for MacOS arm64 too. Set the LIBXEDDSA_FORCE_LOCAL environment variable to forbid the usage of prebuilt binaries.

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/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

XEdDSA-1.0.1.tar.gz (344.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page