Embed a small bit of code that converts between units. An example of a Rust library that can be embedded in Python and Web Assembly.
Go to file
Dorian 85bd911959 Update the tests. 2019-11-06 20:16:25 -05:00
src Add a test for the temperature check. 2019-11-06 19:40:51 -05:00
.gitignore Create a quick calculation and test to make sure it works. 2019-02-04 09:05:11 -05:00
Cargo.toml Update example for PyCon Canada talk. 2019-10-29 10:25:27 -04:00
LICENSE.md Add a basic readme and desire of the project. 2019-02-01 08:41:54 -05:00
Pipfile Add in benchmarks. 2019-10-30 10:37:01 -04:00
Pipfile.lock Add in benchmarks. 2019-10-30 10:37:01 -04:00
README.md Add a class and windchill example. 2019-11-06 17:42:41 -05:00
batch_test.py Update API. 2019-11-06 17:38:19 -05:00
rust-toolchain Update example for PyCon Canada talk. 2019-10-29 10:25:27 -04:00
test.py Update the tests. 2019-11-06 20:16:25 -05:00

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
  • 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 tests: pytest test.py

Documentation