embedded-unit-converter/README.md

1.1 KiB

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
  2. Install dependencies and run in a virtualenv: pipenv install && pipenv shell
  3. Create the Python package with: maturin build
  4. Run the Python tests: pytest test.py batch_test.py
  5. Run the Rust test: cargo test --no-default-features

Documentation