From 7421eaf3a9812034843c318a0fb054f84adf3271 Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Wed, 17 Apr 2024 00:31:15 +0800 Subject: [PATCH 1/5] Remove support for rust-cpython Remove support for rust-cpython --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 - Cargo.toml | 2 +- ci/build_deb.sh | 2 +- maturin/import_hook.py | 2 +- setup.py | 2 +- src/build_context.rs | 2 +- src/build_options.rs | 4 +--- src/develop.rs | 2 +- src/main.rs | 4 ++-- tests/cmd/build.stdout | 2 +- tests/cmd/develop.stdout | 2 +- tests/cmd/maturin.stdout | 3 +-- tests/cmd/publish.stdout | 2 +- 13 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 6c3ba00ca..28ca21b81 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -42,7 +42,6 @@ body: label: What bindings you're using options: - "pyo3" - - "rust-cpython" - "cffi" - "uniffi" - "bin" diff --git a/Cargo.toml b/Cargo.toml index 8c0124131..54e654bef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["konstin ", "messense "] name = "maturin" version = "1.5.1" -description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages" +description = "Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages" exclude = [ "test-crates/**/*", "sysconfig/*", diff --git a/ci/build_deb.sh b/ci/build_deb.sh index 4e1d529cc..282c9a0d8 100755 --- a/ci/build_deb.sh +++ b/ci/build_deb.sh @@ -45,7 +45,7 @@ Maintainer: konstin Architecture: $architecture Provides: $BINARY_NAME Conflicts: $conflictname -Description: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages +Description: Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages EOF fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb" diff --git a/maturin/import_hook.py b/maturin/import_hook.py index affe3eb9c..592e4c4ba 100644 --- a/maturin/import_hook.py +++ b/maturin/import_hook.py @@ -149,7 +149,7 @@ def install(bindings: str | None = None, release: bool = False) -> Importer | No Install the import hook. :param bindings: Which kind of bindings to use. - Possible values are pyo3, rust-cpython and cffi + Possible values are pyo3 and cffi :param release: Build in release mode, otherwise debug mode by default """ diff --git a/setup.py b/setup.py index 50d15be8c..29b5f4916 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def finalize_options(self): author="konstin", author_email="konstin@mailbox.org", url="https://github.com/pyo3/maturin", - description="Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as " + description="Build and publish crates with pyo3 and cffi bindings as well as rust binaries as " "python packages", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/build_context.rs b/src/build_context.rs index 9e84a3604..ec8909d71 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -39,7 +39,7 @@ pub enum BridgeModel { /// The String is the name of the bindings /// providing crate, e.g. pyo3, the number is the minimum minor python version Bin(Option<(String, usize)>), - /// A native module with pyo3 or rust-cpython bindings. The String is the name of the bindings + /// A native module with pyo3 bindings. The String is the name of the bindings /// providing crate, e.g. pyo3, the number is the minimum minor python version Bindings(String, usize), /// `Bindings`, but specifically for pyo3 with feature flags that allow building a single wheel diff --git a/src/build_options.rs b/src/build_options.rs index c8aa6db6e..ca7528000 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -176,7 +176,7 @@ pub struct BuildOptions { pub find_interpreter: bool, /// Which kind of bindings to use. - #[arg(short, long, value_parser = ["pyo3", "pyo3-ffi", "rust-cpython", "cffi", "uniffi", "bin"])] + #[arg(short, long, value_parser = ["pyo3", "pyo3-ffi", "cffi", "uniffi", "bin"])] pub bindings: Option, /// The directory to store the built wheels in. Defaults to a new "wheels" @@ -920,8 +920,6 @@ fn find_bindings( let minor = pyo3_ffi_minimum_python_minor_version(ver.major, ver.minor) .unwrap_or(MINIMUM_PYTHON_MINOR); Some(("pyo3-ffi".to_string(), minor)) - } else if deps.contains_key("cpython") { - Some(("rust-cpython".to_string(), MINIMUM_PYTHON_MINOR)) } else if deps.contains_key("uniffi") { Some(("uniffi".to_string(), MINIMUM_PYTHON_MINOR)) } else { diff --git a/src/develop.rs b/src/develop.rs index 3ec51026d..b404755cd 100644 --- a/src/develop.rs +++ b/src/develop.rs @@ -98,7 +98,7 @@ pub struct DevelopOptions { short = 'b', long = "bindings", alias = "binding-crate", - value_parser = ["pyo3", "pyo3-ffi", "rust-cpython", "cffi", "uniffi", "bin"] + value_parser = ["pyo3", "pyo3-ffi", "cffi", "uniffi", "bin"] )] pub bindings: Option, /// Pass --release to cargo diff --git a/src/main.rs b/src/main.rs index a5aae5df2..582ca423b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -//! Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries +//! Build and publish crates with pyo3 and cffi bindings as well as rust binaries //! as python packages. This file contains the CLI and keyring integration. //! //! Run with --help for usage information @@ -34,7 +34,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; styles = cargo_options::styles(), )] #[cfg_attr(clippy, allow(clippy::large_enum_variant))] -/// Build and publish crates with pyo3, rust-cpython and cffi bindings as well +/// Build and publish crates with pyo3 and cffi bindings as well /// as rust binaries as python packages enum Opt { #[command(name = "build", alias = "b")] diff --git a/tests/cmd/build.stdout b/tests/cmd/build.stdout index 0e2b600f3..9651fe736 100644 --- a/tests/cmd/build.stdout +++ b/tests/cmd/build.stdout @@ -37,7 +37,7 @@ Options: -b, --bindings Which kind of bindings to use - [possible values: pyo3, pyo3-ffi, rust-cpython, cffi, uniffi, bin] + [possible values: pyo3, pyo3-ffi, cffi, uniffi, bin] -o, --out The directory to store the built wheels in. Defaults to a new "wheels" directory in the diff --git a/tests/cmd/develop.stdout b/tests/cmd/develop.stdout index cb8ada219..0521154be 100644 --- a/tests/cmd/develop.stdout +++ b/tests/cmd/develop.stdout @@ -10,7 +10,7 @@ Options: -b, --bindings Which kind of bindings to use - [possible values: pyo3, pyo3-ffi, rust-cpython, cffi, uniffi, bin] + [possible values: pyo3, pyo3-ffi, cffi, uniffi, bin] --strip Strip the library for minimum file size diff --git a/tests/cmd/maturin.stdout b/tests/cmd/maturin.stdout index 25c7ec597..6e193b892 100644 --- a/tests/cmd/maturin.stdout +++ b/tests/cmd/maturin.stdout @@ -1,5 +1,4 @@ -Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as -python packages +Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages Usage: maturin[EXE] diff --git a/tests/cmd/publish.stdout b/tests/cmd/publish.stdout index 8009f5f0d..c6c9dba83 100644 --- a/tests/cmd/publish.stdout +++ b/tests/cmd/publish.stdout @@ -83,7 +83,7 @@ Options: -b, --bindings Which kind of bindings to use - [possible values: pyo3, pyo3-ffi, rust-cpython, cffi, uniffi, bin] + [possible values: pyo3, pyo3-ffi, cffi, uniffi, bin] -o, --out The directory to store the built wheels in. Defaults to a new "wheels" directory in the From ca39d88032548557e8cfd069b657536f132581bf Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Wed, 17 Apr 2024 00:34:38 +0800 Subject: [PATCH 2/5] Remove irrelevant comments for rust-cpython --- src/build_options.rs | 7 +------ src/compile.rs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/build_options.rs b/src/build_options.rs index ca7528000..a9a30b667 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -245,7 +245,7 @@ impl BuildOptions { eprintln!("🐍 Using host {host_python} for cross-compiling preparation"); // pyo3 env::set_var("PYO3_PYTHON", &host_python.executable); - // rust-cpython, and legacy pyo3 versions + // legacy pyo3 versions env::set_var("PYTHON_SYS_EXECUTABLE", &host_python.executable); let sysconfig_path = find_sysconfigdata(cross_lib_dir.as_ref(), target)?; @@ -1363,8 +1363,6 @@ mod test { find_bridge(&pyo3_mixed, Some("pyo3")), Ok(BridgeModel::Bindings(..)) )); - - assert!(find_bridge(&pyo3_mixed, Some("rust-cpython")).is_err()); } #[test] @@ -1382,7 +1380,6 @@ mod test { find_bridge(&pyo3_pure, Some("pyo3")), Ok(BridgeModel::BindingsAbi3(3, 7)) )); - assert!(find_bridge(&pyo3_pure, Some("rust-cpython")).is_err()); } #[test] @@ -1419,7 +1416,6 @@ mod test { ); assert_eq!(find_bridge(&cffi_pure, None).unwrap(), BridgeModel::Cffi); - assert!(find_bridge(&cffi_pure, Some("rust-cpython")).is_err()); assert!(find_bridge(&cffi_pure, Some("pyo3")).is_err()); } @@ -1439,7 +1435,6 @@ mod test { BridgeModel::Bin(None) ); - assert!(find_bridge(&hello_world, Some("rust-cpython")).is_err()); assert!(find_bridge(&hello_world, Some("pyo3")).is_err()); let pyo3_bin = MetadataCommand::new() diff --git a/src/compile.rs b/src/compile.rs index 62582ec8e..d37e0cd0f 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -398,7 +398,7 @@ fn cargo_build_command( ); } - // rust-cpython, and legacy pyo3 versions + // legacy pyo3 versions build_command.env("PYTHON_SYS_EXECUTABLE", &interpreter.executable); } else if (bridge_model.is_bindings("pyo3") || bridge_model.is_bindings("pyo3-ffi") From 9a24cb39089ae5d3525fe1ee93fe14e15adfc646 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:35:47 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 29b5f4916..b94edbb5b 100644 --- a/setup.py +++ b/setup.py @@ -55,8 +55,7 @@ def finalize_options(self): author="konstin", author_email="konstin@mailbox.org", url="https://github.com/pyo3/maturin", - description="Build and publish crates with pyo3 and cffi bindings as well as rust binaries as " - "python packages", + description="Build and publish crates with pyo3 and cffi bindings as well as rust binaries as " "python packages", long_description=long_description, long_description_content_type="text/markdown", version=version, From a5fc1d9bbe656465587391724c8b9a7c1185bcce Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Wed, 17 Apr 2024 12:07:27 +0800 Subject: [PATCH 4/5] revert changes on comments / doc and only include code change --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + Cargo.toml | 2 +- ci/build_deb.sh | 2 +- maturin/import_hook.py | 2 +- setup.py | 2 +- src/build_context.rs | 2 +- src/build_options.rs | 2 +- src/compile.rs | 2 +- src/main.rs | 4 ++-- tests/cmd/maturin.stdout | 3 ++- 10 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 28ca21b81..6c3ba00ca 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -42,6 +42,7 @@ body: label: What bindings you're using options: - "pyo3" + - "rust-cpython" - "cffi" - "uniffi" - "bin" diff --git a/Cargo.toml b/Cargo.toml index 54e654bef..8c0124131 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["konstin ", "messense "] name = "maturin" version = "1.5.1" -description = "Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages" +description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages" exclude = [ "test-crates/**/*", "sysconfig/*", diff --git a/ci/build_deb.sh b/ci/build_deb.sh index 282c9a0d8..4e1d529cc 100755 --- a/ci/build_deb.sh +++ b/ci/build_deb.sh @@ -45,7 +45,7 @@ Maintainer: konstin Architecture: $architecture Provides: $BINARY_NAME Conflicts: $conflictname -Description: Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages +Description: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages EOF fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb" diff --git a/maturin/import_hook.py b/maturin/import_hook.py index 592e4c4ba..affe3eb9c 100644 --- a/maturin/import_hook.py +++ b/maturin/import_hook.py @@ -149,7 +149,7 @@ def install(bindings: str | None = None, release: bool = False) -> Importer | No Install the import hook. :param bindings: Which kind of bindings to use. - Possible values are pyo3 and cffi + Possible values are pyo3, rust-cpython and cffi :param release: Build in release mode, otherwise debug mode by default """ diff --git a/setup.py b/setup.py index 29b5f4916..50d15be8c 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def finalize_options(self): author="konstin", author_email="konstin@mailbox.org", url="https://github.com/pyo3/maturin", - description="Build and publish crates with pyo3 and cffi bindings as well as rust binaries as " + description="Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as " "python packages", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/build_context.rs b/src/build_context.rs index ec8909d71..9e84a3604 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -39,7 +39,7 @@ pub enum BridgeModel { /// The String is the name of the bindings /// providing crate, e.g. pyo3, the number is the minimum minor python version Bin(Option<(String, usize)>), - /// A native module with pyo3 bindings. The String is the name of the bindings + /// A native module with pyo3 or rust-cpython bindings. The String is the name of the bindings /// providing crate, e.g. pyo3, the number is the minimum minor python version Bindings(String, usize), /// `Bindings`, but specifically for pyo3 with feature flags that allow building a single wheel diff --git a/src/build_options.rs b/src/build_options.rs index a9a30b667..65b06a55b 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -245,7 +245,7 @@ impl BuildOptions { eprintln!("🐍 Using host {host_python} for cross-compiling preparation"); // pyo3 env::set_var("PYO3_PYTHON", &host_python.executable); - // legacy pyo3 versions + // rust-cpython, and legacy pyo3 versions env::set_var("PYTHON_SYS_EXECUTABLE", &host_python.executable); let sysconfig_path = find_sysconfigdata(cross_lib_dir.as_ref(), target)?; diff --git a/src/compile.rs b/src/compile.rs index d37e0cd0f..62582ec8e 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -398,7 +398,7 @@ fn cargo_build_command( ); } - // legacy pyo3 versions + // rust-cpython, and legacy pyo3 versions build_command.env("PYTHON_SYS_EXECUTABLE", &interpreter.executable); } else if (bridge_model.is_bindings("pyo3") || bridge_model.is_bindings("pyo3-ffi") diff --git a/src/main.rs b/src/main.rs index 582ca423b..a5aae5df2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -//! Build and publish crates with pyo3 and cffi bindings as well as rust binaries +//! Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries //! as python packages. This file contains the CLI and keyring integration. //! //! Run with --help for usage information @@ -34,7 +34,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; styles = cargo_options::styles(), )] #[cfg_attr(clippy, allow(clippy::large_enum_variant))] -/// Build and publish crates with pyo3 and cffi bindings as well +/// Build and publish crates with pyo3, rust-cpython and cffi bindings as well /// as rust binaries as python packages enum Opt { #[command(name = "build", alias = "b")] diff --git a/tests/cmd/maturin.stdout b/tests/cmd/maturin.stdout index 6e193b892..25c7ec597 100644 --- a/tests/cmd/maturin.stdout +++ b/tests/cmd/maturin.stdout @@ -1,4 +1,5 @@ -Build and publish crates with pyo3 and cffi bindings as well as rust binaries as python packages +Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as +python packages Usage: maturin[EXE] From fdbd6acf21745a2be58200c407828bd83e540de0 Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Wed, 17 Apr 2024 12:10:19 +0800 Subject: [PATCH 5/5] revert setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b94edbb5b..50d15be8c 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,8 @@ def finalize_options(self): author="konstin", author_email="konstin@mailbox.org", url="https://github.com/pyo3/maturin", - description="Build and publish crates with pyo3 and cffi bindings as well as rust binaries as " "python packages", + description="Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as " + "python packages", long_description=long_description, long_description_content_type="text/markdown", version=version,