Basic POC mixing:
- Use
cargo workspace(Cargo.toml) - Create a rust library to access the Kraken public API (in
kraken) withreqwest+tokio+serde). - Add a rust test for the function (test module
kraken/src/tests/declared at the end ofkraken/src/kraken.rs) - Add a main example program using the function and compiled independently (
kraken/src/bin) - Develop Python bindings (in
pykraken) withpyo3andpyo3-asyncio. - Declare dependencies between workspace's members (
kraken->pykrakeninpykraken/Cargo.toml) - Use
maturinto build the python bindings project (pykraken/pyproject.toml). - Write a python test for the module (
pykraken/pykraken_tests.py) - Use
toxto automate all the tests because the python tests cannot be automated with cargo (tox.ini)
Normal build just do cargo build and equivalents.
Automatically run all the tests: tox
The python tests use maturin, so, a virtual environment may be needed to run the python manually.
cd pykraken
python -m venv .venv # .venv is recognized automatically by maturin
maturin develop
.venv/bin/python pykraken_tests.py