From 9806784503885318312c24ff4d022e6379f12ea0 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 27 Sep 2018 19:54:53 -0400 Subject: [PATCH 1/2] moudle --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fef6f704..fe2d991a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ fn sum_as_string(a: usize, b: usize) -> PyResult { Ok((a + b).to_string()) } -/// This module is a python moudle implemented in Rust. +/// This module is a python module implemented in Rust. #[pymodinit] fn string_sum(py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_function!(sum_as_string))?; From 78207916d028f64846f9553c2aa4253a7624b9b9 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Thu, 27 Sep 2018 19:55:25 -0400 Subject: [PATCH 2/2] macos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe2d991a..8fe193f8 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ fn string_sum(py: Python, m: &PyModule) -> PyResult<()> { } ``` -On windows and linux, you can build normally with `cargo build --release`. On Mac OS, you need to set additional linker arguments. One option is to compile with `cargo rustc --release -- -C link-arg=-undefined -C link-arg=dynamic_lookup`, the other is to create a `.cargo/config` with the following content: +On windows and linux, you can build normally with `cargo build --release`. On macOS, you need to set additional linker arguments. One option is to compile with `cargo rustc --release -- -C link-arg=-undefined -C link-arg=dynamic_lookup`, the other is to create a `.cargo/config` with the following content: ```toml [target.x86_64-apple-darwin] @@ -73,7 +73,7 @@ rustflags = [ ] ``` -For developing, you can copy and rename the shared library from the target folder: On mac os, rename `libstring_sum.dylib` to `string_sum.so`, on windows `libstring_sum.dll` to `string_sum.pyd` and on linux `libstring_sum.so` to `libstring_sum.so`. Then open a python shell in the same folder and you'll be able to `import string_sum`. +For developing, you can copy and rename the shared library from the target folder: On macOS, rename `libstring_sum.dylib` to `string_sum.so`, on windows `libstring_sum.dll` to `string_sum.pyd` and on linux `libstring_sum.so` to `libstring_sum.so`. Then open a python shell in the same folder and you'll be able to `import string_sum`. To build, test and publish your crate as python module, you can use [pyo3-pack](https://github.com/PyO3/pyo3-pack) or [setuptools-rust](https://github.com/PyO3/setuptools-rust). You can find an example for setuptools-rust in [examples/word-count](examples/word-count), while pyo3-pack should work on your crate without any configuration.