You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://gitter.im/PyO3/Lobby)
8
8
9
9
[Rust](http://www.rust-lang.org/) bindings for [Python](https://www.python.org/). This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules.
10
10
11
-
* User Guide: [stable](https://pyo3.rs) | [master](https://pyo3.rs/master)
11
+
* User Guide: [stable](https://pyo3.rs) | [main](https://pyo3.rs/main)
12
12
13
-
* API Documentation: [stable](https://docs.rs/pyo3/) | [master](https://pyo3.rs/master/doc)
13
+
* API Documentation: [stable](https://docs.rs/pyo3/) | [main](https://pyo3.rs/main/doc)
A comparison with rust-cpython can be found [in the guide](https://pyo3.rs/master/rust_cpython.html).
17
+
A comparison with rust-cpython can be found [in the guide](https://pyo3.rs/main/rust_cpython.html).
18
18
19
19
## Usage
20
20
21
21
PyO3 supports Python 3.6 and up. The minimum required Rust version is 1.41.
22
22
23
23
Building with PyPy is also possible (via cpyext) for Python 3.6, targeted PyPy version is 7.3+.
24
-
Please refer to the [pypy section in the guide](https://pyo3.rs/master/building_and_distribution/pypy.html).
24
+
Please refer to the [pypy section in the guide](https://pyo3.rs/main/building_and_distribution/pypy.html).
25
25
26
26
You can either write a native Python module in Rust, or use Python from a Rust binary.
27
27
@@ -96,7 +96,7 @@ rustflags = [
96
96
97
97
While developing, you can symlink (or 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`.
98
98
99
-
To build, test and publish your crate as a Python module, you can use [maturin](https://github.com/PyO3/maturin) or [setuptools-rust](https://github.com/PyO3/setuptools-rust). You can find an example for setuptools-rust in [examples/word-count](https://github.com/PyO3/pyo3/tree/master/examples/word-count), while maturin should work on your crate without any configuration.
99
+
To build, test and publish your crate as a Python module, you can use [maturin](https://github.com/PyO3/maturin) or [setuptools-rust](https://github.com/PyO3/setuptools-rust). You can find an example for setuptools-rust in [examples/word-count](https://github.com/PyO3/pyo3/tree/main/examples/word-count), while maturin should work on your crate without any configuration.
Our guide has [a section](https://pyo3.rs/master/python_from_rust.html) with lots of examples
139
+
Our guide has [a section](https://pyo3.rs/main/python_from_rust.html) with lots of examples
140
140
about this topic.
141
141
142
142
## Tools and libraries
@@ -152,7 +152,7 @@ about this topic.
152
152
## Examples
153
153
154
154
*[hyperjson](https://github.com/mre/hyperjson)_A hyper-fast Python module for reading/writing JSON data using Rust's serde-json_
155
-
*[html-py-ever](https://github.com/PyO3/setuptools-rust/tree/master/examples/html-py-ever)_Using [html5ever](https://github.com/servo/html5ever) through [kuchiki](https://github.com/kuchiki-rs/kuchiki) to speed up html parsing and css-selecting._
155
+
*[html-py-ever](https://github.com/PyO3/setuptools-rust/tree/main/examples/html-py-ever)_Using [html5ever](https://github.com/servo/html5ever) through [kuchiki](https://github.com/kuchiki-rs/kuchiki) to speed up html parsing and css-selecting._
156
156
*[point-process](https://github.com/ManifoldFR/point-process-rust/tree/master/pylib)_High level API for pointprocesses as a Python library_
157
157
*[autopy](https://github.com/autopilot-rs/autopy)_A simple, cross-platform GUI automation library for Python and Rust._
158
158
* Contains an example of building wheels on TravisCI and appveyor using [cibuildwheel](https://github.com/joerick/cibuildwheel)
@@ -167,7 +167,7 @@ about this topic.
167
167
*[pyre](https://github.com/Project-Dream-Weaver/Pyre)_Fast Python HTTP server written in Rust_
Copy file name to clipboardExpand all lines: guide/src/parallelism.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
CPython has the infamous [Global Interpreter Lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock), which prevents several threads from executing Python bytecode in parallel. This makes threading in Python a bad fit for [CPU-bound](https://stackoverflow.com/questions/868568/) tasks and often forces developers to accept the overhead of multiprocessing.
4
4
5
-
In PyO3 parallelism can be easily achieved in Rust-only code. Let's take a look at our [word-count](https://github.com/PyO3/pyo3/blob/master/examples/word-count/src/lib.rs) example, where we have a `search` function that utilizes the [rayon](https://github.com/nikomatsakis/rayon) crate to count words in parallel.
5
+
In PyO3 parallelism can be easily achieved in Rust-only code. Let's take a look at our [word-count](https://github.com/PyO3/pyo3/blob/main/examples/word-count/src/lib.rs) example, where we have a `search` function that utilizes the [rayon](https://github.com/rayon-rs/rayon) crate to count words in parallel.
@@ -56,7 +56,7 @@ We are using `pytest-benchmark` to benchmark four word count functions:
56
56
3. Rust sequential version
57
57
4. Rust sequential version executed twice with two Python threads
58
58
59
-
The benchmark script can be found [here](https://github.com/PyO3/pyo3/blob/master/examples/word-count/tests/test_word_count.py), and we can run `tox` in the `word-count` folder to benchmark these functions.
59
+
The benchmark script can be found [here](https://github.com/PyO3/pyo3/blob/main/examples/word-count/tests/test_word_count.py), and we can run `tox` in the `word-count` folder to benchmark these functions.
60
60
61
61
While the results of the benchmark of course depend on your machine, the relative results should be similar to this (mid 2020):
0 commit comments