| 1 |
# Migrating from older maturin versions |
| 2 |
|
| 3 |
This guide can help you upgrade code through breaking changes from one maturin version to the next. |
| 4 |
For a detailed list of all changes, see the [CHANGELOG](changelog.md). |
| 5 |
|
| 6 |
## From 0.14.* to 0.15 |
| 7 |
|
| 8 |
### Build with `--no-default-features` by default when bootstrapping from sdist |
| 9 |
|
| 10 |
When bootstrapping maturin from sdist, maturin 0.15 will build with `--no-default-features` by default, |
| 11 |
which means that for distro packaging, you might want to set the environment variable `MATURIN_SETUP_ARGS="--features full,rustls"` to enable full features. |
| 12 |
|
| 13 |
### Remove `[tool.maturin.sdist-include]` |
| 14 |
|
| 15 |
Use `[tool.maturin.include]` option instead. |
| 16 |
|
| 17 |
### Remove `[package.metadata.maturin]` from `Cargo.toml` |
| 18 |
|
| 19 |
Package metadata is now specified in `[tool.maturin]` section of `pyproject.toml` instead of `Cargo.toml`. |
| 20 |
Note that the replacement for `package.metadata.maturin.name` is `tool.maturin.module-name`. |
| 21 |
|
| 22 |
### Require `uniffi-bindgen` CLI to building `uniffi` bindings |
| 23 |
|
| 24 |
maturin 0.15 requires `uniffi-bindgen` CLI to build `uniffi` bindings, |
| 25 |
you can install it with `pip install uniffi-bindgen`. |
| 26 |
|
| 27 |
## From 0.13.* to 0.14 |
| 28 |
|
| 29 |
### Remove support for specifying python package metadata in `Cargo.toml` |
| 30 |
|
| 31 |
maturin 0.14 removed support for specifying python package metadata in `Cargo.toml`, |
| 32 |
Python package metadata should be specified in the `project` section of `pyproject.toml` instead as [PEP 621](https://peps.python.org/pep-0621/) specifies. |
| 33 |
|
| 34 |
### Deprecate `[tool.maturin.sdist-include]` |
| 35 |
|
| 36 |
maturin 0.14 added `[tool.maturin.include]` and `[tool.maturin.exclude]` |
| 37 |
to replace `[tool.maturin.sdist-include]` which was sdist only, the new options |
| 38 |
can be configured to apply to sdist and/or wheel. |
| 39 |
|
| 40 |
### macOS deployment target version defaults what `rustc` supports |
| 41 |
|
| 42 |
If you don't set the `MACOSX_DEPLOYMENT_TARGET` environment variable, |
| 43 |
maturin 0.14 will use the default target version acquired from `rustc`, |
| 44 |
this may cause build issue for projects that depend on C/C++ code, |
| 45 |
usually you can fix it by setting a correct `MACOSX_DEPLOYMENT_TARGET`, for example |
| 46 |
|
| 47 |
```bash |
| 48 |
export MACOSX_DEPLOYMENT_TARGET=10.9 |
| 49 |
``` |
| 50 |
|
| 51 |
### Deprecate `python-source` option in `Cargo.toml` |
| 52 |
|
| 53 |
maturin 0.14 deprecated the `python-source` option in `Cargo.toml`, |
| 54 |
use `[tool.maturin.python-source]` option in `pyproject.toml` instead. |
| 55 |
|
| 56 |
## From 0.12.* to 0.13 |
| 57 |
|
| 58 |
### Drop support for Python 3.6 |
| 59 |
|
| 60 |
maturin 0.13 has dropped support for Python 3.6, to support Python 3.6 you can use the old 0.12 versions. |
| 61 |
|
| 62 |
### Removed `--cargo-extra-args` and `--rustc-extra-args` |
| 63 |
|
| 64 |
maturin 0.13 added most of the `cargo rustc` options so you can just use them directly, |
| 65 |
for example `--cargo-extra-args="--no-default-features"` becomes `--no-default-features`. |
| 66 |
|
| 67 |
To pass extra arguments to rustc, add them after `--`, |
| 68 |
for example use `maturin build -- -Clink-arg=-s` instead of `--rustc-extra-args="-Clink-arg=-s"`. |
| 69 |
|
| 70 |
### Source distributions are not built by default |
| 71 |
|
| 72 |
maturin 0.13 replaced `--no-sdist` with the new `--sdist` option in `maturin build` command, |
| 73 |
source distributions are now only built when `--sdist` is specified. |
| 74 |
|
| 75 |
### Only build wheels for current Python interpreter in `PATH` by default |
| 76 |
|
| 77 |
maturin 0.13 no longer searches for Python interpreters by default and only build wheels for the current |
| 78 |
Python interpreter (i.e. `python3`) in `PATH`. |
| 79 |
|
| 80 |
To enable the old behavior, use the new `--find-interpreter` option. |
| 81 |
|
| 82 |
### `--repository-url` only accepts full URL now |
| 83 |
|
| 84 |
Previously `--repository-url` option in `maturin upload` and `maturin publish` commands accepts both |
| 85 |
repository name and URL. maturin 0.13 changed `--repository-url` to only accept full URL and added a |
| 86 |
new `--repository` for the repository name. This new behavior matches `twine upload`. |