Skip to content

Commit a1f23c9

Browse files
committed
guide: rewrite "Building and Distribution" chapter
1 parent fab135c commit a1f23c9

File tree

7 files changed

+141
-133
lines changed

7 files changed

+141
-133
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
## Usage
1818

19-
PyO3 supports Python 3.6 and up. The minimum required Rust version is 1.41.
20-
21-
PyPy is also supported. Some minor features are unavailable on PyPy - please refer to the [pypy section in the guide](https://pyo3.rs/latest/building_and_distribution/pypy.html) for more information.
19+
PyO3 supports the following software versions:
20+
- Python 3.6 and up (CPython and PyPy)
21+
- Rust 1.41 and up
2222

2323
You can use PyO3 to write a native Python module in Rust, or to embed Python in a Rust binary. The following sections explain each of these in turn.
2424

guide/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
- [Advanced Topics](advanced.md)
2121
- [Building and Distribution](building_and_distribution.md)
2222
- [Supporting multiple Python versions](building_and_distribution/multiple_python_versions.md)
23-
- [PyPy support](building_and_distribution/pypy.md)
2423
- [Useful Crates](ecosystem.md)
2524
- [Logging](ecosystem/logging.md)
2625
- [Async / Await](ecosystem/async-await.md)

guide/src/building_and_distribution.md

Lines changed: 120 additions & 83 deletions
Large diffs are not rendered by default.

guide/src/building_and_distribution/pypy.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

guide/src/faq.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PyO3 provides a struct [`GILOnceCell`] which works equivalently to `OnceCell` bu
1717

1818
## I can't run `cargo test`: I'm having linker issues like "Symbol not found" or "Undefined reference to _PyExc_SystemError"!
1919

20-
Currently, [#341](https://github.com/PyO3/pyo3/issues/341) causes `cargo test` to fail with linking errors when the `extension-module` feature is activated. For now you can work around this by making the `extension-module` feature optional and running the tests with `cargo test --no-default-features`:
20+
Currently, [#340](https://github.com/PyO3/pyo3/issues/340) causes `cargo test` to fail with linking errors when the `extension-module` feature is activated. For now you can work around this by making the `extension-module` feature optional and running the tests with `cargo test --no-default-features`:
2121

2222
```toml
2323
[dependencies.pyo3]
@@ -138,5 +138,4 @@ print(f"a: {a}\nb: {b}")
138138
a: <builtins.Inner object at 0x0000020044FCC670>
139139
b: <builtins.Inner object at 0x0000020044FCC670>
140140
```
141-
The downside to this approach is that any Rust code working on the `Outer` struct now has to acquire the GIL to do anything with its field.
142-
141+
The downside to this approach is that any Rust code working on the `Outer` struct now has to acquire the GIL to do anything with its field.

src/gil.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,22 @@ pub(crate) fn gil_is_acquired() -> bool {
4040

4141
/// Prepares the use of Python in a free-threaded context.
4242
///
43-
/// If the Python interpreter is not already initialized, this function
44-
/// will initialize it with disabled signal handling
45-
/// (Python will not raise the `KeyboardInterrupt` exception).
46-
/// Python signal handling depends on the notion of a 'main thread', which must be
47-
/// the thread that initializes the Python interpreter.
43+
/// If the Python interpreter is not already initialized, this function will initialize it with
44+
/// signal handling disabled (Python will not raise the `KeyboardInterrupt` exception). Python
45+
/// signal handling depends on the notion of a 'main thread', which must be the thread that
46+
/// initializes the Python interpreter.
4847
///
49-
/// If both the Python interpreter and Python threading are already initialized,
50-
/// this function has no effect.
48+
/// If both the Python interpreter and Python threading are already initialized, this function has
49+
/// no effect.
50+
///
51+
/// This function is unavailable under PyPy because PyPy cannot be embedded in Rust (or any other
52+
/// software). Support for this is tracked on the
53+
/// [PyPy issue tracker](https://foss.heptapod.net/pypy/pypy/-/issues/3286).
5154
///
5255
/// # Panics
53-
/// - If the Python interpreter is initialized but Python threading is not,
54-
/// a panic occurs.
55-
/// It is not possible to safely access the Python runtime unless the main
56-
/// thread (the thread which originally initialized Python) also initializes
57-
/// threading.
56+
/// - If the Python interpreter is initialized but Python threading is not, a panic occurs.
57+
/// It is not possible to safely access the Python runtime unless the main thread (the thread
58+
/// which originally initialized Python) also initializes threading.
5859
///
5960
/// # Examples
6061
/// ```rust

src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,9 @@
118118
//!
119119
//! # Minimum supported Rust and Python versions
120120
//!
121-
//! PyO3 supports Python 3.6+ and Rust 1.41+.
122-
//!
123-
//! Building with PyPy is also possible (via cpyext) for Python 3.6,
124-
//! targeted PyPy version is 7.3+. Please refer to the
125-
//! [pypy section](https://pyo3.rs/latest/building_and_distribution/pypy.html)
126-
//! in the guide for more information.
121+
//! PyO3 supports the following software versions:
122+
//! - Python 3.6 and up (CPython and PyPy)
123+
//! - Rust 1.41 and up
127124
//!
128125
//! # Example: Building a native Python module
129126
//!
@@ -495,10 +492,6 @@ pub mod doc_test {
495492
"guide/src/building_and_distribution.md",
496493
guide_building_and_distribution_md
497494
);
498-
doctest!(
499-
"guide/src/building_and_distribution/pypy.md",
500-
guide_building_and_distribution_pypy_md
501-
);
502495
doctest!("guide/src/class.md", guide_class_md);
503496
doctest!("guide/src/class/protocols.md", guide_class_protocols_md);
504497
doctest!("guide/src/conversions.md", guide_conversions_md);

0 commit comments

Comments
 (0)