Merge pull request #429 from scOwez/patch-1

Added capitalization & wording changes to README.md
This commit is contained in:
Yuji Kanagawa 2019-04-09 19:16:44 +09:00 committed by GitHub
commit 4458c09fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* `type_object::PyTypeObject` has been marked unsafe because breaking the contract `type_object::PyTypeObject::init_type` can lead to UB.
* Fixed automatic derive of `PySequenceProtocol` implementation in [#423](https://github.com/PyO3/pyo3/pull/423).
* Capitalization & better wording to README.md.
## [0.6.0] - 2018-03-28

View File

@ -16,19 +16,17 @@ A comparison with rust-cpython can be found [in the guide](https://pyo3.rs/maste
## Usage
PyO3 supports python 3.5 and up. The minimum required rust version is 1.34.0-nightly 2019-02-06.
PyO3 supports Python 3.5 and up. The minimum required rust version is 1.34.0-nightly 2019-02-06.
You can either write a native python module in rust or use python from a rust binary.
You can either write a native Python module in rust or use Python from a Rust binary.
On some OSs, you need some additional packages.
E.g. if you are on Ubuntu18.04, please run
However, on some OSs, you need some additional packages. E.g. if you are on *Ubuntu 18.04*, please run
```bash
sudo apt install python3-dev python-dev
```
## Using rust from python
## Using Rust from Python
PyO3 can be used to generate a native python module.
@ -73,7 +71,7 @@ fn string_sum(py: Python, m: &PyModule) -> PyResult<()> {
}
```
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:
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]
@ -83,9 +81,9 @@ rustflags = [
]
```
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 `string_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 `string_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.
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.
## Using python from rust