Skip to content

Commit

Permalink
Drop Python 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed May 3, 2021
1 parent 0a20669 commit 2cafd21
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 160 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ What does it do?

| | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux i686 | manylinux aarch64 | manylinux ppc64le | manylinux s390x |
|---|---|---|---|---|---|---|---|---|---|
| CPython 3.5 || ||||||||
| CPython 3.6 || ||||||||
| CPython 3.7 || ||||||||
| CPython 3.8 || ||||||||
Expand Down
2 changes: 1 addition & 1 deletion bin/update_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# regenerate the constraints files
os.environ["CUSTOM_COMPILE_COMMAND"] = "bin/update_dependencies.py"

PYTHON_VERSIONS = ["35", "36", "37", "38", "39"]
PYTHON_VERSIONS = ["36", "37", "38", "39"]

if "--no-docker" in sys.argv:
for python_version in PYTHON_VERSIONS:
Expand Down
40 changes: 1 addition & 39 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,6 @@ def get_python_configurations(
c for c in python_configurations if not c.identifier.startswith("pp")
]

if any(c.identifier.startswith("cp35") for c in python_configurations):
# CPython 3.5 doesn't work on macOS 11
log.warning(
unwrap(
"""
CPython 3.5 is unsupported when building on macOS 11. To build CPython 3.5
wheels, build on an older OS, such as macOS 10.15. To silence this warning,
deselect CPython 3.5 by adding "cp35-macosx_x86_64" to your CIBW_SKIP option.
"""
)
)
python_configurations = [
c for c in python_configurations if not c.identifier.startswith("cp35")
]

return python_configurations


Expand Down Expand Up @@ -164,21 +149,6 @@ def install_cpython(version: str, url: str) -> Path:
download(url, Path("/tmp/Python.pkg"))
# install
call(["sudo", "installer", "-pkg", "/tmp/Python.pkg", "-target", "/"])
# patch open ssl
if version == "3.5":
open_ssl_patch_url = f"https://github.com/mayeut/patch-macos-python-openssl/releases/download/v1.1.1h/patch-macos-python-{version}-openssl-v1.1.1h.tar.gz"
download(open_ssl_patch_url, Path("/tmp/python-patch.tar.gz"))
call(
[
"sudo",
"tar",
"-C",
f"/Library/Frameworks/Python.framework/Versions/{version}/",
"-xmf",
"/tmp/python-patch.tar.gz",
]
)

call(["sudo", str(installation_bin_path / python_executable), str(install_certifi_script)])

pip_executable = "pip3"
Expand Down Expand Up @@ -278,20 +248,12 @@ def setup_python(
sys.exit(1)

# Set MACOSX_DEPLOYMENT_TARGET to 10.9, if the user didn't set it.
# CPython 3.5 defaults to 10.6, and pypy defaults to 10.7, causing
# inconsistencies if it's left unset.
# PyPy defaults to 10.7, causing inconsistencies if it's left unset.
env.setdefault("MACOSX_DEPLOYMENT_TARGET", "10.9")

config_is_arm64 = python_configuration.identifier.endswith("arm64")
config_is_universal2 = python_configuration.identifier.endswith("universal2")

if python_configuration.version == "3.5":
# Cross-compilation platform override - CPython 3.5 has an
# i386/x86_64 version of Python, but we only want a x64_64 build
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
# https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260
env.setdefault("ARCHFLAGS", "-arch x86_64")

if python_configuration.version == "3.9":
if python_configuration.identifier.endswith("x86_64"):
# even on the macos11.0 Python installer, on the x86_64 side it's
Expand Down
8 changes: 0 additions & 8 deletions cibuildwheel/resources/build-platforms.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
[linux]
python_configurations = [
{ identifier = "cp35-manylinux_x86_64", version = "3.5", path_str = "/opt/python/cp35-cp35m" },
{ identifier = "cp36-manylinux_x86_64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_x86_64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_x86_64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-manylinux_x86_64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp35-manylinux_i686", version = "3.5", path_str = "/opt/python/cp35-cp35m" },
{ identifier = "cp36-manylinux_i686", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_i686", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_i686", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-manylinux_i686", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "pp36-manylinux_x86_64", version = "3.6", path_str = "/opt/python/pp36-pypy36_pp73" },
{ identifier = "pp37-manylinux_x86_64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "cp35-manylinux_aarch64", version = "3.5", path_str = "/opt/python/cp35-cp35m" },
{ identifier = "cp36-manylinux_aarch64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_aarch64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_aarch64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-manylinux_aarch64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp35-manylinux_ppc64le", version = "3.5", path_str = "/opt/python/cp35-cp35m" },
{ identifier = "cp36-manylinux_ppc64le", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_ppc64le", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_ppc64le", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-manylinux_ppc64le", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp35-manylinux_s390x", version = "3.5", path_str = "/opt/python/cp35-cp35m" },
{ identifier = "cp36-manylinux_s390x", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_s390x", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_s390x", version = "3.8", path_str = "/opt/python/cp38-cp38" },
Expand All @@ -31,7 +26,6 @@ python_configurations = [

[macos]
python_configurations = [
{ identifier = "cp35-macosx_x86_64", version = "3.5", url = "https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg" },
{ identifier = "cp36-macosx_x86_64", version = "3.6", url = "https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg" },
{ identifier = "cp37-macosx_x86_64", version = "3.7", url = "https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg" },
{ identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.9/python-3.8.9-macosx10.9.pkg" },
Expand All @@ -44,8 +38,6 @@ python_configurations = [

[windows]
python_configurations = [
{ identifier = "cp35-win32", version = "3.5.4", arch = "32" },
{ identifier = "cp35-win_amd64", version = "3.5.4", arch = "64" },
{ identifier = "cp36-win32", version = "3.6.8", arch = "32" },
{ identifier = "cp36-win_amd64", version = "3.6.8", arch = "64" },
{ identifier = "cp37-win32", version = "3.7.9", arch = "32" },
Expand Down
36 changes: 0 additions & 36 deletions cibuildwheel/resources/constraints-python35.txt

This file was deleted.

35 changes: 0 additions & 35 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from typing import Dict, List, NamedTuple, Optional, Sequence, Set
from zipfile import ZipFile

import toml

from .architecture import Architecture
from .environment import ParsedEnvironment
from .logger import log
Expand Down Expand Up @@ -209,34 +207,6 @@ def setup_python(
return env


def pep_518_cp35_workaround(package_dir: Path, env: Dict[str, str]) -> None:
"""
Python 3.5 PEP 518 hack (see https://github.com/pypa/pip/issues/8392#issuecomment-639563494)
Basically, nuget's Python is an embedded Python distribution, which is not supported by pip.
Before version 3.6, there was no way to disable the "embedded" behavior, including the ignoring
of environment variables, including the ones pip uses to setup PEP 518 builds.
The fix here is as suggested in that issue; we manually setup the PEP 518 requirements. Since we
are in a fresh environment (except for pinned cibuildweel dependencies), the build is already
mostly "isolated".
"""

pyproject_path = package_dir / "pyproject.toml"

if pyproject_path.exists():
data = toml.load(pyproject_path)
requirements = data["build-system"].get("requires", []) if "build-system" in data else []

if requirements:
log.step("Performing PEP518 workaround...")
with tempfile.TemporaryDirectory() as d:
reqfile = Path(d) / "requirements.txt"
with reqfile.open("w") as f:
for r in requirements:
print(r, file=f)
call(["pip", "install", "-r", reqfile], env=env)


def build(options: BuildOptions) -> None:
temp_dir = Path(tempfile.mkdtemp(prefix="cibuildwheel"))
built_wheel_dir = temp_dir / "built_wheel"
Expand Down Expand Up @@ -276,11 +246,6 @@ def build(options: BuildOptions) -> None:
)
shell(before_build_prepared, env=env)

# activate the PEP 518 patch if on Windows Python 3.5
# (will only have an effect if PEP 517 builds are used):
if config.version.startswith("3.5"):
pep_518_cp35_workaround(options.package_dir, env)

log.step("Building wheel...")
if built_wheel_dir.exists():
shutil.rmtree(built_wheel_dir)
Expand Down
2 changes: 0 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ This has been moved to using docker, so you only need the following instructions
The dependency update script in the next section requires multiple python versions installed. One way to do this is to use `pyenv`:

```bash
pyenv install 3.5.9
pyenv install 3.6.11
pyenv install 3.7.8
# Optionally add 3.8 and make it the local version;
Expand All @@ -81,7 +80,6 @@ pyenv install 3.7.8
Then, you need to make the required virtual environments:

```bash
$(pyenv prefix 3.5.9)/bin/python -m venv env35
$(pyenv prefix 3.6.11)/bin/python -m venv env36
$(pyenv prefix 3.7.8)/bin/python -m venv env37
```
Expand Down
7 changes: 3 additions & 4 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This option can also be set using the [command-line option](#command-line) `--pl

> Choose the Python versions to build
Space-separated list of builds to build and skip. Each build has an identifier like `cp27-manylinux_x86_64` or `cp35-macosx_x86_64` - you can list specific ones to build and cibuildwheel will only build those, and/or list ones to skip and cibuildwheel won't try to build them.
Space-separated list of builds to build and skip. Each build has an identifier like `cp38-manylinux_x86_64` or `cp37-macosx_x86_64` - you can list specific ones to build and cibuildwheel will only build those, and/or list ones to skip and cibuildwheel won't try to build them.

When both options are specified, both conditions are applied and only builds with a tag that matches `CIBW_BUILD` and does not match `CIBW_SKIP` will be built.

Expand All @@ -120,7 +120,6 @@ When setting the options, you can use shell-style globbing syntax, as per [fnmat

| | macOS | Windows | Manylinux Intel | Manylinux Other |
|--------------|---------------------------------------------------------------------|-------------------------------|-----------------------------------------------|----------------------------------------------------------------------------|
| Python 3.5 | cp35-macosx_x86_64 | cp35-win_amd64<br/>cp35-win32 | cp35-manylinux_x86_64<br/>cp35-manylinux_i686 | cp35-manylinux_aarch64<br/>cp35-manylinux_ppc64le<br/>cp35-manylinux_s390x |
| Python 3.6 | cp36-macosx_x86_64 | cp36-win_amd64<br/>cp36-win32 | cp36-manylinux_x86_64<br/>cp36-manylinux_i686 | cp36-manylinux_aarch64<br/>cp36-manylinux_ppc64le<br/>cp36-manylinux_s390x |
| Python 3.7 | cp37-macosx_x86_64 | cp37-win_amd64<br/>cp37-win32 | cp37-manylinux_x86_64<br/>cp37-manylinux_i686 | cp37-manylinux_aarch64<br/>cp37-manylinux_ppc64le<br/>cp37-manylinux_s390x |
| Python 3.8 | cp38-macosx_x86_64 | cp38-win_amd64<br/>cp38-win32 | cp38-manylinux_x86_64<br/>cp38-manylinux_i686 | cp38-manylinux_aarch64<br/>cp38-manylinux_ppc64le<br/>cp38-manylinux_s390x |
Expand Down Expand Up @@ -155,8 +154,8 @@ CIBW_SKIP: cp36-win*
# Skip CPython 3.6 on 32-bit Windows
CIBW_SKIP: cp36-win32

# Skip CPython 3.5 and CPython 3.6
CIBW_SKIP: cp35-* cp36-*
# Skip CPython 3.6 and CPython 3.7
CIBW_SKIP: cp36-* cp37-*

# Skip Python 3.6 on Linux
CIBW_SKIP: cp36-manylinux*
Expand Down
3 changes: 0 additions & 3 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ To build Linux, Mac, and Windows wheels on Azure Pipelines, create a `azure-pipe
{% include "../examples/azure-pipelines-minimal.yml" %}
```

!!! note
To support Python 3.5 on Windows, make sure to specify the use of `{vmImage: 'vs2017-win2016'}` on Windows, to ensure the required toolchain is available.

Commit this file, enable building of your repo on Azure Pipelines, and push.

Wheels will be stored for you and available through the Pipelines interface. For more info on this file, check out the [docs](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema).
Expand Down
31 changes: 6 additions & 25 deletions test/test_dependency_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,17 @@ def get_versions_from_constraint_file(constraint_file):
}


@pytest.mark.parametrize("python_version", ["3.5", "3.6", "3.8", "3.9"])
@pytest.mark.parametrize("python_version", ["3.6", "3.8", "3.9"])
def test_pinned_versions(tmp_path, python_version):
if utils.platform == "linux":
pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead")

is_macos_11_or_later = utils.platform == "macos" and utils.get_macos_version() >= (10, 16)

if is_macos_11_or_later and python_version == "3.5":
pytest.skip("CPython 3.5 doesn't work on macOS Big Sur+")

project_dir = tmp_path / "project"
project_with_expected_version_checks.generate(project_dir)

build_environment = {}

if python_version == "3.5":
constraint_filename = "constraints-python35.txt"
build_pattern = "[cp]p35-*"
elif python_version == "3.6":
if python_version == "3.6":
constraint_filename = "constraints-python36.txt"
build_pattern = "[cp]p36-*"
elif python_version == "3.7":
Expand Down Expand Up @@ -97,11 +89,7 @@ def test_pinned_versions(tmp_path, python_version):
)

# also check that we got the right wheels
if python_version == "3.5":
expected_wheels = [
w for w in utils.expected_wheels("spam", "0.1.0") if "-cp35" in w or "-pp35" in w
]
elif python_version == "3.6":
if python_version == "3.6":
expected_wheels = [
w for w in utils.expected_wheels("spam", "0.1.0") if "-cp36" in w or "-pp36" in w
]
Expand All @@ -119,8 +107,7 @@ def test_pinned_versions(tmp_path, python_version):
assert set(actual_wheels) == set(expected_wheels)


@pytest.mark.parametrize("python_version", ["3.5", "3.x"])
def test_dependency_constraints_file(tmp_path, python_version):
def test_dependency_constraints_file(tmp_path):
if utils.platform == "linux":
pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead")

Expand All @@ -129,7 +116,7 @@ def test_dependency_constraints_file(tmp_path, python_version):

tool_versions = {
"pip": "20.0.2",
"setuptools": "50.3.2" if python_version == "3.5" else "53.0.0",
"setuptools": "53.0.0",
"wheel": "0.34.2",
"virtualenv": "20.0.10",
}
Expand Down Expand Up @@ -160,17 +147,11 @@ def test_dependency_constraints_file(tmp_path, python_version):
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_BUILD": "cp35-*" if python_version == "3.5" else "[cp]p3?-*",
"CIBW_SKIP": "" if python_version == "3.5" else "cp35-*",
"CIBW_ENVIRONMENT": cibw_environment_option,
"CIBW_DEPENDENCY_VERSIONS": str(constraints_file),
},
)

# also check that we got the right wheels
if python_version == "3.5":
expected_wheels = [w for w in utils.expected_wheels("spam", "0.1.0") if "-cp35" in w]
else:
expected_wheels = [w for w in utils.expected_wheels("spam", "0.1.0") if "-cp35" not in w]

expected_wheels = utils.expected_wheels("spam", "0.1.0")
assert set(actual_wheels) == set(expected_wheels)
4 changes: 1 addition & 3 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ def expected_wheels(
else:
manylinux_versions = ["manylinux2014"]

python_abi_tags = ["cp35-cp35m", "cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39"]
python_abi_tags = ["cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39"]

if machine_arch in ["x86_64", "AMD64", "x86"]:
python_abi_tags += ["pp36-pypy36_pp73", "pp37-pypy37_pp73"]

if platform == "macos" and get_macos_version() >= (10, 16):
# 10.16 is sometimes reported as the macOS version on macOS 11.
# CPython 3.5 doesn't work on macOS 11.
python_abi_tags.remove("cp35-cp35m")
# pypy not supported on macOS 11.
python_abi_tags = [t for t in python_abi_tags if not t.startswith("pp")]

Expand Down
3 changes: 0 additions & 3 deletions unit_test/dependency_constraints_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ def test_defaults():
assert dependency_constraints.get_for_python_version("3.6").samefile(
resources_dir / "constraints-python36.txt"
)
assert dependency_constraints.get_for_python_version("3.5").samefile(
resources_dir / "constraints-python35.txt"
)

0 comments on commit 2cafd21

Please sign in to comment.