Skip to content

shimwell/example_python_package_with_rust_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI CI

A minimal example of a 🐍 Python package with a 🦀 Rust backend

One of the great aspects of Rust is that calling Rust functions from Python is easy thanks to maturin

This repository also includes automated creation and uploading of wheels to PyPI for distribution to Windows 🪟 , Mac 🍏 and Linux 🐧 thanks to maturin-action and maturin for automatically generating the CI yaml.

The package itself is less import and just prints a few messages to the terminal.

Install the package with pip

pip install example_python_package_with_rust_backend

Usage

import example_python_package_with_rust_backend

returned_value = example_python_package_with_rust_backend.hello_world(
    int_arg=3,
    float_arg=2.01,
    str_arg='hi'
)
print(returned_value)

Testing

Testing in python with pytest, first install the package with testing dependencies

pip install example_python_package_with_rust_backend [tests]

Then test with pytest

pytest tests

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published