32 lines
1.0 KiB
Markdown
32 lines
1.0 KiB
Markdown
# 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`
|
|
* Python dependencies
|
|
* Python 3 Development headers `apt install python3-dev`
|
|
* pipenv `pip install --user pipenv`
|
|
|
|
## Running the Python example
|
|
|
|
1. Build the rust crate first: `cargo build`
|
|
1. Install dependencies and run in a virtualenv: `pipenv install && pipenv shell`
|
|
1. Create the Python package with: `maturin build`
|
|
1. Run the tests: `pytest test.py`
|
|
|
|
## Documentation
|
|
|
|
* [PyO3 Python - Rust bindings](https://pyo3.rs/master/get_started.html)
|
|
* Windchill calculations:
|
|
* [PDF from US Gov](https://www.weather.gov/media/epz/wxcalc/windChill.pdf)
|
|
* [Calculation in Celsius and kph](https://www.calcunation.com/calculator/wind-chill-celsius.php)
|
|
* [Windchill Calculator](https://www.weather.gov/epz/wxcalc_windchill)
|