Python bindings for the userauth library: the anonymous credentials implementation used in OONI
Project description
ooniauth-py
This is the bindings library used to call the anonymous credentials library from Python land
We use this in our backend implement the anonymous credentials protocol in our API
Installation
You can install this library by running:
pip install ooniauth-py
Development requirements
These tools are required to contribute to this library
- maturin: Is used to build the library itself, it's heavily used to develop this library
In order to use maturin, you need a virtual environment to manage the resulting Python package during development, see more details here
Testing installation
If you try to run the tests as you usually would with cargo test, you will get linking errors. This
happens because Maturin provides a build configuration with all the linking flags required to build
the library. However, it does not provide a maturing test command that could help you with this.
A possible solution is to manually specify the linking flags to the compiler, but in order to do this you will probably need to download the specific Python version (3.10). A good way to do this is using Pyenv:
- Install Pyenv
- Install Python 3.10.0 with pyenv:
pyenv install 3.10.0
With the Python version installed, you can create a .cargo/config.toml
with the linking flags. Create the file in userauth/.cargo/config.toml
and fill the following template:
[target.'cfg(all())']
rustflags = [
"-C", "link-arg=-Wl,-rpath,<YOUR PYENV PATH HERE>/.pyenv/versions/3.10.0/lib",
"-C", "link-arg=-L<YOUR PYENV PATH HERE>/.pyenv/versions/3.10.0/lib",
"-C", "link-arg=-lpython3.10",
]
Example result:
[target.'cfg(all())']
rustflags = [
"-C", "link-arg=-Wl,-rpath,/home/ooni/.pyenv/versions/3.10.0/lib",
"-C", "link-arg=-L/home/ooni/.pyenv/versions/3.10.0/lib",
"-C", "link-arg=-lpython3.10",
]
Note: Make sure to create this file in userauth/.cargo/config.toml and not in userauth/ooniauth-py/.cargo.toml
Usage
- Create a ready-to-use
.whlto import in python:make wheels
- Note: You will find the wheels file in:
/userauth/ooniauth-py/wheels
- Build the library and install it in a virtualenv for trying it in Python:
make dev
- Note: Requires an active virtual environment to install the library
- Run tests:
make test
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ooniauth_py-0.2.1-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: ooniauth_py-0.2.1-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 637.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ea60cce1b61e0ca0a10901b2b57f82d23886126a123b1b3426c536f0f23138c
|
|
| MD5 |
a5607e7fab51cd69374294dbaf0078d6
|
|
| BLAKE2b-256 |
2d3b7abdf8747cbdd40fb3e506719e69cf83b2b497286b1897f380a94dbc5737
|
File details
Details for the file ooniauth_py-0.2.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ooniauth_py-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 571.8 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de9626edbc0a3f5e5eebd166847567c5f7fbba42d8a47fc571921c79777fd4b4
|
|
| MD5 |
fb586684f8b0975f41d80f01dfe8452c
|
|
| BLAKE2b-256 |
919ab58d5d5044783229eaa1efbd5b89b2cac684f14dd8af203dad7f1c965034
|