Skip to content

Commit

Permalink
Merge pull request #2006 from davidhewitt/drop-py36
Browse files Browse the repository at this point in the history
python: drop support for 3.6
  • Loading branch information
davidhewitt committed Nov 20, 2021
2 parents cc91a7c + 70030f1 commit ded44ee
Show file tree
Hide file tree
Showing 30 changed files with 104 additions and 272 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/ci.yml
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Run cargo checks
run: |
set -x
VERSIONS=("3.6" "3.7" "3.8" "3.9" "3.10")
VERSIONS=("3.7" "3.8" "3.9" "3.10")
for VERSION in ${VERSIONS[@]}; do
echo "version=$VERSION" > config.txt
echo "suppress_build_script_link_lines=true" >> config.txt
Expand All @@ -76,7 +76,7 @@ jobs:
fail-fast: false # If one platform fails, allow the rest to keep testing.
matrix:
rust: [stable]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy-3.6, pypy-3.7, pypy-3.8]
python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.7, pypy-3.8]
platform:
[
{
Expand All @@ -101,27 +101,12 @@ jobs:
},
]
exclude:
# PyPy 3.6 is EOL and not working on macos-latest (now macos-11)
- python-version: pypy-3.6
platform: { os: "macos-latest", python-architecture: "x64" }
# There is no 64-bit pypy on windows for pypy-3.6
- python-version: pypy-3.6
platform: { os: "windows-latest", python-architecture: "x64" }
# PyPy 3.7 on Windows doesn't release 32-bit builds any more
# PyPy doesn't release 32-bit Windows builds any more
- python-version: pypy-3.7
platform: { os: "windows-latest", python-architecture: "x86" }
- python-version: pypy-3.8
platform: { os: "windows-latest", python-architecture: "x86" }
include:
# PyPy3.6 still runs on macos-10.15
- rust: stable
python-version: pypy-3.6
platform:
{
os: "macos-10.15",
python-architecture: "x64",
rust-target: "x86_64-apple-darwin",
}
# Test minimal supported Rust version
- rust: 1.48.0
python-version: "3.10"
Expand Down Expand Up @@ -212,8 +197,8 @@ jobs:
run: cargo build --lib --tests --no-default-features --features "${{ steps.settings.outputs.all_additive_features }}"

- if: ${{ startsWith(matrix.python-version, 'pypy') }}
name: Build PyPy (abi3-py36)
run: cargo build --lib --tests --no-default-features --features "abi3-py36 ${{ steps.settings.outputs.all_additive_features }}"
name: Build PyPy (abi3-py37)
run: cargo build --lib --tests --no-default-features --features "abi3-py37 ${{ steps.settings.outputs.all_additive_features }}"

# Run tests (except on PyPy, because no embedding API).
- if: ${{ !startsWith(matrix.python-version, 'pypy') }}
Expand All @@ -225,10 +210,10 @@ jobs:
name: Test (abi3)
run: cargo test --no-default-features --features "abi3 ${{ steps.settings.outputs.all_additive_features }}"

# Run tests again, for abi3-py36 (the minimal Python version)
- if: ${{ (!startsWith(matrix.python-version, 'pypy')) && (matrix.python-version != '3.6') }}
name: Test (abi3-py36)
run: cargo test --no-default-features --features "abi3-py36 ${{ steps.settings.outputs.all_additive_features }}"
# Run tests again, for abi3-py37 (the minimal Python version)
- if: ${{ (!startsWith(matrix.python-version, 'pypy')) && (matrix.python-version != '3.7') }}
name: Test (abi3-py37)
run: cargo test --no-default-features --features "abi3-py37 ${{ steps.settings.outputs.all_additive_features }}"

- name: Test proc-macro code
run: cargo test --manifest-path=pyo3-macros-backend/Cargo.toml
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update MSRV to Rust 1.48. [#2004](https://github.com/PyO3/pyo3/pull/2004)
- Update `indoc` optional dependency to 1.0. [#2004](https://github.com/PyO3/pyo3/pull/2004)
- Update `paste` optional dependency to 1.0. [#2004](https://github.com/PyO3/pyo3/pull/2004)
- Drop support for Python 3.6, remove `abi3-py36` feature. [#2006](https://github.com/PyO3/pyo3/pull/2006)
- `pyo3-build-config` no longer enables the `resolve-config` feature by default. [#2008](https://github.com/PyO3/pyo3/pull/2008)

### Added
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -71,7 +71,6 @@ extension-module = []
abi3 = ["pyo3-build-config/abi3"]

# With abi3, we can manually set the minimum Python version.
abi3-py36 = ["abi3-py37", "pyo3-build-config/abi3-py36"]
abi3-py37 = ["abi3-py38", "pyo3-build-config/abi3-py37"]
abi3-py38 = ["abi3-py39", "pyo3-build-config/abi3-py38"]
abi3-py39 = ["abi3-py310", "pyo3-build-config/abi3-py39"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -17,7 +17,7 @@
## Usage

PyO3 supports the following software versions:
- Python 3.6 and up (CPython and PyPy)
- Python 3.7 and up (CPython and PyPy)
- Rust 1.48 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.
Expand Down
10 changes: 5 additions & 5 deletions guide/src/building_and_distribution.md
Expand Up @@ -13,7 +13,7 @@ PyO3 uses a build script (backed by the [`pyo3-build-config`] crate) to determin
- The `python` executable (if it's a Python 3 interpreter).
- The `python3` executable.

You can override the Python interpreter by setting the `PYO3_PYTHON` environment variable, e.g. `PYO3_PYTHON=python3.6`, `PYO3_PYTHON=/usr/bin/python3.9`, or even a PyPy interpreter `PYO3_PYTHON=pypy3`.
You can override the Python interpreter by setting the `PYO3_PYTHON` environment variable, e.g. `PYO3_PYTHON=python3.7`, `PYO3_PYTHON=/usr/bin/python3.9`, or even a PyPy interpreter `PYO3_PYTHON=pypy3`.

Once the Python interpreter is located, `pyo3-build-config` executes it to query the information in the `sysconfig` module which is needed to configure the rest of the compilation.

Expand Down Expand Up @@ -145,16 +145,16 @@ See the [corresponding](https://github.com/PyO3/maturin/pull/353) [PRs](https://

#### Minimum Python version for `abi3`

Because a single `abi3` wheel can be used with many different Python versions, PyO3 has feature flags `abi3-py36`, `abi3-py37`, `abi-py38` etc. to set the minimum required Python version for your `abi3` wheel.
For example, if you set the `abi3-py36` feature, your extension wheel can be used on all Python 3 versions from Python 3.6 and up. `maturin` and `setuptools-rust` will give the wheel a name like `my-extension-1.0-cp36-abi3-manylinux2020_x86_64.whl`.
Because a single `abi3` wheel can be used with many different Python versions, PyO3 has feature flags `abi3-py37`, `abi3-py38`, `abi3-py39` etc. to set the minimum required Python version for your `abi3` wheel.
For example, if you set the `abi3-py37` feature, your extension wheel can be used on all Python 3 versions from Python 3.7 and up. `maturin` and `setuptools-rust` will give the wheel a name like `my-extension-1.0-cp37-abi3-manylinux2020_x86_64.whl`.

As your extension module may be run with multiple different Python versions you may occasionally find you need to check the Python version at runtime to customize behavior. See [the relevant section of this guide](./building_and_distribution/multiple_python_versions.html#checking-the-python-version-at-runtime) on supporting multiple Python versions at runtime.

PyO3 is only able to link your extension module to api3 version up to and including your host Python version. E.g., if you set `abi3-py38` and try to compile the crate with a host of Python 3.6, the build will fail.
PyO3 is only able to link your extension module to api3 version up to and including your host Python version. E.g., if you set `abi3-py38` and try to compile the crate with a host of Python 3.7, the build will fail.

As an advanced feature, you can build PyO3 wheel without calling Python interpreter with the environment variable `PYO3_NO_PYTHON` set. On unix systems this works unconditionally; on Windows you must also set the `RUSTFLAGS` evironment variable to contain `-L native=/path/to/python/libs` so that the linker can find `python3.lib`.

> Note: If you set more that one of these api version feature flags the highest version always wins. For example, with both `abi3-py36` and `abi3-py38` set, PyO3 would build a wheel which supports Python 3.8 and up.
> Note: If you set more that one of these api version feature flags the lowest version always wins. For example, with both `abi3-py37` and `abi3-py38` set, PyO3 would build a wheel which supports Python 3.7 and up.
#### Missing features

Expand Down
2 changes: 1 addition & 1 deletion guide/src/debugging.md
Expand Up @@ -24,7 +24,7 @@ Valgrind is a tool to detect memory management bugs such as memory leaks.

You first need to install a debug build of Python, otherwise Valgrind won't produce usable results. In Ubuntu there's e.g. a `python3-dbg` package.

Activate an environment with the debug interpreter and recompile. If you're on Linux, use `ldd` with the name of your binary and check that you're linking e.g. `libpython3.6dm.so.1.0` instead of `libpython3.6m.so.1.0`.
Activate an environment with the debug interpreter and recompile. If you're on Linux, use `ldd` with the name of your binary and check that you're linking e.g. `libpython3.7d.so.1.0` instead of `libpython3.7.so.1.0`.

[Download the suppressions file for cpython](https://raw.githubusercontent.com/python/cpython/master/Misc/valgrind-python.supp).

Expand Down
2 changes: 1 addition & 1 deletion guide/src/features.md
Expand Up @@ -24,7 +24,7 @@ See the [building and distribution](building_and_distribution.md#py_limited_apia

### The `abi3-pyXY` features

(`abi3-py36`, `abi3-py37`, `abi3-py38`, `abi3-py39`, and `abi3-py310`)
(`abi3-py37`, `abi3-py38`, `abi3-py39`, and `abi3-py310`)

These features are extensions of the `abi3` feature to specify the exact minimum Python version which the multiple-version-wheel will support.

Expand Down
6 changes: 6 additions & 0 deletions guide/src/migration.md
Expand Up @@ -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.15.* to 0.16

### Drop support for older technogies

PyO3 0.16 has increased minimum Rust version to 1.48 and minimum Python version to 3.7. This enables ore use of newer language features (enabling some of the other additions in 0.16) and simplifies maintenance of the project.

## from 0.14.* to 0.15

### Changes in sequence indexing
Expand Down
1 change: 0 additions & 1 deletion pyo3-build-config/Cargo.toml
Expand Up @@ -21,7 +21,6 @@ default = []
resolve-config = []

abi3 = []
abi3-py36 = ["abi3-py37"]
abi3-py37 = ["abi3-py38"]
abi3-py38 = ["abi3-py39"]
abi3-py39 = ["abi3-py310"]
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/build.rs
Expand Up @@ -63,7 +63,7 @@ pub fn abi3_config() -> Option<InterpreterConfig> {
abi3: true,
lib_name: None,
lib_dir: None,
build_flags: BuildFlags::abi3(),
build_flags: BuildFlags::default(),
pointer_width: None,
executable: None,
shared: true,
Expand Down

0 comments on commit ded44ee

Please sign in to comment.