|
|
||
|---|---|---|
| src | ||
| .gitignore | ||
| Cargo.toml | ||
| LICENSE.md | ||
| Pipfile | ||
| Pipfile.lock | ||
| README.md | ||
| batch_test.py | ||
| rust-toolchain | ||
| test.py | ||
README.md
Embedded Unit Converter
Embed a small bit of code that converts between units of measure, e.g. Fahrenheit to Celsius.
An example of a Rust library that is embeddable in Python.
Getting setup
Insure the following dependencies are in place:
- Rust v1.34+ (nightly)
- Install using
rustup toolchain install nightly
- Install using
- Python dependencies
- Python 3 Development headers
apt install python3-dev - pipenv
pip install --user pipenv
- Python 3 Development headers
Running the Python example
- Build the rust crate first:
cargo build - Install dependencies and run in a virtualenv:
pipenv install && pipenv shell - Create the Python package with:
maturin build - Run the tests:
pytest test.py
Documentation
- PyO3 Python - Rust bindings
- Windchill calculations: