| 1 |
from setuptools import find_packages, setup |
| 2 |
|
| 3 |
from setuptools_rust import Binding, RustExtension |
| 4 |
|
| 5 |
setup( |
| 6 |
name="hello-world", |
| 7 |
version="1.0", |
| 8 |
packages=find_packages(where="python"), |
| 9 |
package_dir={"": "python"}, |
| 10 |
rust_extensions=[ |
| 11 |
RustExtension( |
| 12 |
"hello_world._lib", |
| 13 |
# ^-- The last part of the name (e.g. "_lib") has to match lib.name |
| 14 |
# in Cargo.toml and the function name in the `.rs` file, |
| 15 |
# but you can add a prefix to nest it inside of a Python package. |
| 16 |
path="Cargo.toml", # Default value, can be omitted |
| 17 |
binding=Binding.PyO3, # Default value, can be omitted |
| 18 |
) |
| 19 |
], |
| 20 |
# rust extensions are not zip safe, just like C-extensions. |
| 21 |
# But `zip_safe=False` is an obsolete config that does not affect how `pip` |
| 22 |
# or `importlib.{resources,metadata}` handle the package. |
| 23 |
) |
| 24 |
# See reference for RustExtension in https://setuptools-rust.readthedocs.io/en/latest/reference.html |