From da8fb5ca3c1574b01dd9686932d5c88063231855 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Sun, 4 Jun 2023 10:29:24 +0200 Subject: [PATCH] Bump MSRV to 1.56 and minimum Python version to 3.8 --- .github/workflows/build.yml | 4 ---- .github/workflows/ci.yml | 6 ++---- Cargo.toml | 1 + README.md | 6 +++--- examples/plugin/plugin_api/pyproject.toml | 2 +- guide/src/getting_started.md | 6 +++--- guide/src/migration.md | 6 ++++++ newsfragments/3204.changed.md | 1 + noxfile.py | 4 ++-- pyo3-ffi/README.md | 5 ++--- pyo3-ffi/src/lib.rs | 4 ++-- pyo3-macros-backend/src/pyfunction/signature.rs | 9 +++++---- src/lib.rs | 4 ++-- xtask/src/cli.rs | 2 +- 14 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 newsfragments/3204.changed.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2155b82683c..6c30c43425c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -201,7 +201,3 @@ jobs: # TODO: this is a hack to workaround compile_error! warnings about auto-initialize on PyPy # Once cargo's `resolver = "2"` is stable (~ MSRV Rust 1.52), remove this. PYO3_CI: 1 - # This is a hack to make CARGO_PRIMARY_PACKAGE always set even for the - # msrv job. MSRV is currently 1.48, but CARGO_PRIMARY_PACKAGE only came in - # 1.49. - CARGO_PRIMARY_PACKAGE: 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 122d2007a12..bdbe03332eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: }, ] include: - - rust: 1.48.0 + - rust: 1.56.0 python-version: "3.11" platform: { @@ -178,12 +178,10 @@ jobs: extra-features: ["multiple-pymethods"] # Because MSRV doesn't support this rust: [stable] python-version: [ - "3.7", "3.8", "3.9", "3.10", "3.11", - "pypy-3.7", "pypy-3.8", "pypy-3.9" ] @@ -207,7 +205,7 @@ jobs: ] include: # Test minimal supported Rust version - - rust: 1.48.0 + - rust: 1.56.0 python-version: "3.11" platform: { diff --git a/Cargo.toml b/Cargo.toml index b0d84aae0d2..a441805abe2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ categories = ["api-bindings", "development-tools::ffi"] license = "Apache-2.0" exclude = ["/.gitignore", ".cargo/config", "/codecov.yml", "/Makefile", "/pyproject.toml", "/noxfile.py", "/.github", "/tests/test_compile_error.rs", "/tests/ui"] edition = "2018" +rust-version = "1.56" [dependencies] cfg-if = "1.0" diff --git a/README.md b/README.md index cbfe3306e25..5558e3cc13a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![benchmark](https://github.com/PyO3/pyo3/actions/workflows/bench.yml/badge.svg)](https://pyo3.rs/dev/bench/) [![codecov](https://codecov.io/gh/PyO3/pyo3/branch/main/graph/badge.svg)](https://codecov.io/gh/PyO3/pyo3) [![crates.io](https://img.shields.io/crates/v/pyo3)](https://crates.io/crates/pyo3) -[![minimum rustc 1.48](https://img.shields.io/badge/rustc-1.48+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) +[![minimum rustc 1.56](https://img.shields.io/badge/rustc-1.56+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) [![dev chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/PyO3/Lobby) [![contributing notes](https://img.shields.io/badge/contribute-on%20github-Green)](https://github.com/PyO3/pyo3/blob/main/Contributing.md) @@ -17,8 +17,8 @@ ## Usage PyO3 supports the following software versions: - - Python 3.7 and up (CPython and PyPy) - - Rust 1.48 and up + - Python 3.8 and up (CPython and PyPy) + - Rust 1.56 and up 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. diff --git a/examples/plugin/plugin_api/pyproject.toml b/examples/plugin/plugin_api/pyproject.toml index 114687eddef..25b09a9a76d 100644 --- a/examples/plugin/plugin_api/pyproject.toml +++ b/examples/plugin/plugin_api/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "plugin_api" -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", diff --git a/guide/src/getting_started.md b/guide/src/getting_started.md index 2dd45a43ce7..f52d3ace8ab 100644 --- a/guide/src/getting_started.md +++ b/guide/src/getting_started.md @@ -4,13 +4,13 @@ To get started using PyO3 you will need three things: a Rust toolchain, a Python ## Rust -First, make sure you have Rust installed on your system. If you haven't already done so, try following the instructions [here](https://www.rust-lang.org/tools/install). PyO3 runs on both the `stable` and `nightly` versions so you can choose whichever one fits you best. The minimum required Rust version is 1.48. +First, make sure you have Rust installed on your system. If you haven't already done so, try following the instructions [here](https://www.rust-lang.org/tools/install). PyO3 runs on both the `stable` and `nightly` versions so you can choose whichever one fits you best. The minimum required Rust version is 1.56. If you can run `rustc --version` and the version is new enough you're good to go! ## Python -To use PyO3, you need at least Python 3.7. While you can simply use the default Python interpreter on your system, it is recommended to use a virtual environment. +To use PyO3, you need at least Python 3.8. While you can simply use the default Python interpreter on your system, it is recommended to use a virtual environment. ## Virtualenvs @@ -128,7 +128,7 @@ build-backend = "maturin" [project] name = "pyo3_example" -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", diff --git a/guide/src/migration.md b/guide/src/migration.md index ac78b02d620..b55c002786a 100644 --- a/guide/src/migration.md +++ b/guide/src/migration.md @@ -3,6 +3,12 @@ This guide can help you upgrade code through breaking changes from one PyO3 version to the next. For a detailed list of all changes, see the [CHANGELOG](changelog.md). +## from 0.19.* to 0.20 + +### Drop support for older technologies + +PyO3 0.20 has increased minimum Rust version to 1.56 and minimum Python version to 3.8. This enables use of newer language features and simplifies maintenance of the project. + ## from 0.18.* to 0.19 ### Access to `Python` inside `__traverse__` implementations are now forbidden diff --git a/newsfragments/3204.changed.md b/newsfragments/3204.changed.md new file mode 100644 index 00000000000..d3ebeba4316 --- /dev/null +++ b/newsfragments/3204.changed.md @@ -0,0 +1 @@ +Update MSRV to Rust 1.56 and the minimum Python version to 3.8. diff --git a/noxfile.py b/noxfile.py index d264cdc0467..b8d04b14fd6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -16,8 +16,8 @@ PYO3_DIR = Path(__file__).parent -PY_VERSIONS = ("3.7", "3.8", "3.9", "3.10", "3.11") -PYPY_VERSIONS = ("3.7", "3.8", "3.9") +PY_VERSIONS = ("3.8", "3.9", "3.10", "3.11") +PYPY_VERSIONS = ("3.8", "3.9") @nox.session(venv_backend="none") diff --git a/pyo3-ffi/README.md b/pyo3-ffi/README.md index e1b98557d46..3e72fee0a3c 100644 --- a/pyo3-ffi/README.md +++ b/pyo3-ffi/README.md @@ -2,7 +2,6 @@ This crate provides [Rust](https://www.rust-lang.org/) FFI declarations for Python 3. It supports both the stable and the unstable component of the ABI through the use of cfg flags. -Python Versions 3.7+ are supported. It is meant for advanced users only - regular PyO3 users shouldn't need to interact with this crate at all. @@ -13,8 +12,8 @@ Manual][capi] for up-to-date documentation. # Minimum supported Rust and Python versions PyO3 supports the following software versions: - - Python 3.7 and up (CPython and PyPy) - - Rust 1.48 and up + - Python 3.8 and up (CPython and PyPy) + - Rust 1.56 and up # Example: Building Python Native modules diff --git a/pyo3-ffi/src/lib.rs b/pyo3-ffi/src/lib.rs index 73ec459b90a..66099b3005e 100644 --- a/pyo3-ffi/src/lib.rs +++ b/pyo3-ffi/src/lib.rs @@ -50,8 +50,8 @@ //! # Minimum supported Rust and Python versions //! //! PyO3 supports the following software versions: -//! - Python 3.7 and up (CPython and PyPy) -//! - Rust 1.48 and up +//! - Python 3.8 and up (CPython and PyPy) +//! - Rust 1.56 and up //! //! # Example: Building Python Native modules //! diff --git a/pyo3-macros-backend/src/pyfunction/signature.rs b/pyo3-macros-backend/src/pyfunction/signature.rs index b7c9965e0da..c83dc4e4013 100644 --- a/pyo3-macros-backend/src/pyfunction/signature.rs +++ b/pyo3-macros-backend/src/pyfunction/signature.rs @@ -27,10 +27,11 @@ pub struct Signature { impl Parse for Signature { fn parse(input: ParseStream<'_>) -> syn::Result { let content; - Ok(Signature { - paren_token: syn::parenthesized!(content in input), - items: content.parse_terminated(SignatureItem::parse)?, - }) + let paren_token = syn::parenthesized!(content in input); + + let items = content.parse_terminated(SignatureItem::parse)?; + + Ok(Signature { paren_token, items }) } } diff --git a/src/lib.rs b/src/lib.rs index ded43370148..8ad929d87d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -121,8 +121,8 @@ //! # Minimum supported Rust and Python versions //! //! PyO3 supports the following software versions: -//! - Python 3.7 and up (CPython and PyPy) -//! - Rust 1.48 and up +//! - Python 3.8 and up (CPython and PyPy) +//! - Rust 1.56 and up //! //! # Example: Building a native Python module //! diff --git a/xtask/src/cli.rs b/xtask/src/cli.rs index f873816a017..fa8d1636c3a 100644 --- a/xtask/src/cli.rs +++ b/xtask/src/cli.rs @@ -5,7 +5,7 @@ use std::process::{Command, Output}; use std::time::Instant; use structopt::StructOpt; -pub const MSRV: &str = "1.48"; +pub const MSRV: &str = "1.56"; #[derive(StructOpt)] pub enum Subcommand {