Skip to content

Commit

Permalink
Merge pull request #1492 from messense/0.14-backport
Browse files Browse the repository at this point in the history
Backport and release v0.14.14
  • Loading branch information
messense authored Feb 24, 2023
2 parents be4d639 + de265a8 commit 2110d39
Show file tree
Hide file tree
Showing 31 changed files with 407 additions and 218 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["konstin <konstin@mailbox.org>", "messense <messense@icloud.com>"]
name = "maturin"
version = "0.14.13"
version = "0.14.14"
description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages"
exclude = ["test-crates/**/*", "sysconfig/*", "test-data/*", "ci/*", "tests/*", "guide/*", ".github/*"]
homepage = "https://github.com/pyo3/maturin"
Expand Down
10 changes: 9 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.14.14] - 2023-02-24

* Add support for Emscripten in `generate-ci` command in [#1484](https://github.com/PyO3/maturin/pull/1484)
* Add support for linking with pyo3 in abi3 debug mode on Windows in [#1487](https://github.com/PyO3/maturin/pull/1487)
* Use default `ext_suffix` for Emscripten target if not provided in `PYO3_CONFIG_FILE` in [#1491](https://github.com/PyO3/maturin/pull/1491)
* Deprecate `package.metadata.maturin.data` in favor of `tool.maturin.data` in `pyproject.toml` in [#1492](https://github.com/PyO3/maturin/pull/1492)

## [0.14.13] - 2023-02-12

* `maturin develop` now looks for a virtualenv `.venv` in the current or any parent directory if no virtual environment is active.
Expand Down Expand Up @@ -815,7 +822,8 @@ points-0.1.0-py2.py3-none-manylinux1_x86_64.whl | 2,8M | 752K | 85K

* Initial Release

[Unreleased]: https://github.com/pyo3/maturin/compare/v0.14.13...HEAD
[Unreleased]: https://github.com/pyo3/maturin/compare/v0.14.14...HEAD
[0.14.14]: https://github.com/pyo3/maturin/compare/v0.14.13...v0.14.14
[0.14.13]: https://github.com/pyo3/maturin/compare/v0.14.12...v0.14.13
[0.14.12]: https://github.com/pyo3/maturin/compare/v0.14.11...v0.14.12
[0.14.11]: https://github.com/pyo3/maturin/compare/v0.14.10...v0.14.11
Expand Down
38 changes: 25 additions & 13 deletions guide/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,42 @@ rand = "0.8.4"

[dependencies.pyo3]
version = "0.18.0"
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
# "abi3-py37" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.7
features = ["extension-module", "abi3-py37"]
features = ["abi3-py37"]
```

Add a `pyproject.toml` to configure [PEP 518](https://peps.python.org/pep-0518/) build system requirements
and enable the `extension-module` feature of pyo3.

```toml
[build-system]
requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"

[tool.maturin]
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
features = ["pyo3/extension-module"]
```

### Use `maturin new`

New projects can also be quickly created using the `maturin new` command:

```bash
USAGE:
maturin new [FLAGS] [OPTIONS] <path>
maturin new --help
Create a new cargo project

FLAGS:
-h, --help Prints help information
--mixed Use mixed Rust/Python project layout
-V, --version Prints version information
Usage: maturin new [OPTIONS] <PATH>

OPTIONS:
-b, --bindings <bindings> Which kind of bindings to use [possible values: pyo3, rust-cpython, cffi, bin]
--name <name> Set the resulting package name, defaults to the directory name
Arguments:
<PATH> Project path

ARGS:
<path> Project path
Options:
--name <NAME> Set the resulting package name, defaults to the directory name
--mixed Use mixed Rust/Python project layout
--src Use Python first src layout for mixed Rust/Python project
-b, --bindings <BINDINGS> Which kind of bindings to use [possible values: pyo3, rust-cpython, cffi, uniffi, bin]
-h, --help Print help information
```

The above process can be achieved by running `maturin new -b pyo3 guessing_game`
Expand Down
4 changes: 3 additions & 1 deletion src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ impl BuildContext {
&self.project_layout,
&self.module_name,
&artifact.path,
None,
self.interpreter.first(),
true,
&self.target,
self.editable,
self.pyproject_toml.as_ref(),
Expand Down Expand Up @@ -605,6 +606,7 @@ impl BuildContext {
&self.module_name,
&artifact.path,
Some(python_interpreter),
false,
&self.target,
self.editable,
self.pyproject_toml.as_ref(),
Expand Down
5 changes: 5 additions & 0 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ impl BuildOptions {
implmentation_name: "cpython".to_string(),
soabi: None,
}])
} else if let Some(config_file) = env::var_os("PYO3_CONFIG_FILE") {
let interpreter_config =
InterpreterConfig::from_pyo3_config(config_file.as_ref(), target)
.context("Invalid PYO3_CONFIG_FILE")?;
Ok(vec![PythonInterpreter::from_config(interpreter_config)])
} else if let Some(interp) = interpreters.get(0) {
println!("🐍 Using {interp} to generate to link bindings (With abi3, an interpreter is only required on windows)");
Ok(interpreters)
Expand Down
Loading

0 comments on commit 2110d39

Please sign in to comment.