Skip to content

Commit

Permalink
Drop Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut authored and henryiii committed May 7, 2021
1 parent 1197061 commit 18f2fb8
Show file tree
Hide file tree
Showing 28 changed files with 146 additions and 507 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@ 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 2.7 || | ✅¹ | ✅¹ ||| | | |
| CPython 3.6 || ||||||||
| CPython 3.7 || ||||||||
| CPython 3.8 || ||||||||
| CPython 3.9 ||||||||||
| PyPy 2.7 v7.3.3 || | ||| | | | |
| PyPy 3.6 v7.3.3 || | ||| | | | |
| PyPy 3.7 (beta) v7.3.3 || | ||| | | | |

<sup>¹ Only using a workaround with a newer compiler; Microsoft removed the 2008 compiler for Python 2.7 in April 2021.</sup><br>

- Builds manylinux, macOS 10.9+, and Windows wheels for CPython and PyPy
- Works on GitHub Actions, Azure Pipelines, Travis CI, AppVeyor, CircleCI, and GitLab CI
- Bundles shared library dependencies on Linux and macOS through [auditwheel](https://github.com/pypa/auditwheel) and [delocate](https://github.com/matthew-brett/delocate)
- Runs your library's tests against the wheel-installed version of your library

See the [cibuildwheel 1 documentation](https://cibuildwheel.readthedocs.io/en/1.x/) if you need to build unsupported versions of Python, such as Python 2.

Usage
-----

Expand Down Expand Up @@ -98,7 +96,7 @@ jobs:
path: ./wheelhouse/*.whl
```
For more information, including building on Python 2, PyPI deployment, and the use of other CI services or the dedicated GitHub Action, check out the [documentation](https://cibuildwheel.readthedocs.org) and the [examples](https://github.com/joerick/cibuildwheel/tree/master/examples).
For more information, including PyPI deployment, and the use of other CI services or the dedicated GitHub Action, check out the [documentation](https://cibuildwheel.readthedocs.org) and the [examples](https://github.com/joerick/cibuildwheel/tree/master/examples).
Options
-------
Expand Down
11 changes: 5 additions & 6 deletions 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 = ["27", "36", "37", "38", "39"]
PYTHON_VERSIONS = ["36", "37", "38", "39"]

if "--no-docker" in sys.argv:
for python_version in PYTHON_VERSIONS:
Expand All @@ -32,8 +32,7 @@
check=True,
)
else:
# latest manylinux2010 image with cpython 2.7 support
image_runner = "quay.io/pypa/manylinux2010_x86_64:2021-02-06-3d322a5"
image_runner = "quay.io/pypa/manylinux2010_x86_64:latest"
subprocess.run(["docker", "pull", image_runner], check=True)
for python_version in PYTHON_VERSIONS:
abi_flags = "" if int(python_version) >= 38 else "m"
Expand Down Expand Up @@ -77,9 +76,9 @@ class Image(NamedTuple):
images = [
Image("manylinux1", "x86_64", "quay.io/pypa/manylinux1_x86_64", None),
Image("manylinux1", "i686", "quay.io/pypa/manylinux1_i686", None),
# Images for manylinux2010 are pinned to the latest tag supporting cp27
Image("manylinux2010", "x86_64", "quay.io/pypa/manylinux2010_x86_64", "2021-02-06-3d322a5"),
Image("manylinux2010", "i686", "quay.io/pypa/manylinux2010_i686", "2021-02-06-3d322a5"),
# 2010 images
Image("manylinux2010", "x86_64", "quay.io/pypa/manylinux2010_x86_64", None),
Image("manylinux2010", "i686", "quay.io/pypa/manylinux2010_i686", None),
Image("manylinux2010", "pypy_x86_64", "pypywheels/manylinux2010-pypy_x86_64", None),
# 2014 images
Image("manylinux2014", "x86_64", "quay.io/pypa/manylinux2014_x86_64", None),
Expand Down
3 changes: 1 addition & 2 deletions cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ def build(options: BuildOptions) -> None:
dependency_constraint_flags: List[PathOrStr] = []
if config.identifier.startswith("pp"):
# Patch PyPy to make sure headers get installed into a venv
patch_version = "_27" if config.version == "2.7" else ""
patch_path = resources_dir / f"pypy_venv{patch_version}.patch"
patch_path = resources_dir / "pypy_venv.patch"
patch_docker_path = PurePath("/pypy_venv.patch")
docker.copy_into(patch_path, patch_docker_path)
try:
Expand Down
11 changes: 5 additions & 6 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def install_cpython(version: str, url: str) -> Path:

# if this version of python isn't installed, get it from python.org and install
python_package_identifier = f"org.python.Python.PythonFramework-{version}"
python_executable = "python3" if version[0] == "3" else "python"
python_executable = "python3"
installation_bin_path = Path(f"/Library/Frameworks/Python.framework/Versions/{version}/bin")

if python_package_identifier not in installed_system_packages:
Expand All @@ -151,7 +151,7 @@ def install_cpython(version: str, url: str) -> Path:
call(["sudo", "installer", "-pkg", "/tmp/Python.pkg", "-target", "/"])
call(["sudo", str(installation_bin_path / python_executable), str(install_certifi_script)])

pip_executable = "pip3" if version[0] == "3" else "pip"
pip_executable = "pip3"
make_symlinks(installation_bin_path, python_executable, pip_executable)

return installation_bin_path
Expand All @@ -168,13 +168,12 @@ def install_pypy(version: str, url: str) -> Path:
download(url, downloaded_tar_bz2)
call(["tar", "-C", "/tmp", "-xf", downloaded_tar_bz2])
# Patch PyPy to make sure headers get installed into a venv
patch_version = "_27" if version == "2.7" else ""
patch_path = resources_dir / f"pypy_venv{patch_version}.patch"
patch_path = resources_dir / "pypy_venv.patch"
call(["patch", "--force", "-p1", "-d", installation_path, "-i", patch_path])

installation_bin_path = installation_path / "bin"
python_executable = "pypy3" if version[0] == "3" else "pypy"
pip_executable = "pip3" if version[0] == "3" else "pip"
python_executable = "pypy3"
pip_executable = "pip3"
make_symlinks(installation_bin_path, python_executable, pip_executable)

return installation_bin_path
Expand Down
10 changes: 0 additions & 10 deletions cibuildwheel/resources/build-platforms.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
[linux]
python_configurations = [
{ identifier = "cp27-manylinux_x86_64", version = "2.7", path_str = "/opt/python/cp27-cp27m" },
{ identifier = "cp27-manylinux_x86_64", version = "2.7", path_str = "/opt/python/cp27-cp27mu" },
{ 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 = "cp27-manylinux_i686", version = "2.7", path_str = "/opt/python/cp27-cp27m" },
{ identifier = "cp27-manylinux_i686", version = "2.7", path_str = "/opt/python/cp27-cp27mu" },
{ 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 = "pp27-manylinux_x86_64", version = "2.7", path_str = "/opt/python/pp27-pypy_73" },
{ 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 = "cp36-manylinux_aarch64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
Expand All @@ -31,22 +26,18 @@ python_configurations = [

[macos]
python_configurations = [
{ identifier = "cp27-macosx_x86_64", version = "2.7", url = "https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.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" },
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
{ identifier = "pp27-macosx_x86_64", version = "2.7", url = "https://downloads.python.org/pypy/pypy2.7-v7.3.3-osx64.tar.bz2" },
{ identifier = "pp36-macosx_x86_64", version = "3.6", url = "https://downloads.python.org/pypy/pypy3.6-v7.3.3-osx64.tar.bz2" },
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2" },
]

[windows]
python_configurations = [
{ identifier = "cp27-win32", version = "2.7.18", arch = "32" },
{ identifier = "cp27-win_amd64", version = "2.7.18", 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 All @@ -55,7 +46,6 @@ python_configurations = [
{ identifier = "cp38-win_amd64", version = "3.8.9", arch = "64" },
{ identifier = "cp39-win32", version = "3.9.4", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.4", arch = "64" },
{ identifier = "pp27-win32", version = "2.7", arch = "32", url = "https://downloads.python.org/pypy/pypy2.7-v7.3.3-win32.zip" },
{ identifier = "pp36-win32", version = "3.6", arch = "32", url = "https://downloads.python.org/pypy/pypy3.6-v7.3.3-win32.zip" },
{ identifier = "pp37-win32", version = "3.7", arch = "32", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.3-win32.zip" },
]
55 changes: 0 additions & 55 deletions cibuildwheel/resources/constraints-python27.txt

This file was deleted.

3 changes: 0 additions & 3 deletions cibuildwheel/resources/install_certifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
| stat.S_IXOTH
)

if sys.version_info[0] == 2:
FileNotFoundError = OSError


def main():
openssl_dir, openssl_cafile = os.path.split(ssl.get_default_verify_paths().openssl_cafile)
Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/resources/pinned_docker_images.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-04-05-14df3a6
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-02-06-3d322a5
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-04-05-b4fd19d
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-04-05-b4fd19d
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-04-05-b4fd19d

[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2021-04-05-14df3a6
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-02-06-3d322a5
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-04-05-b4fd19d
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-04-05-b4fd19d
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-04-05-b4fd19d

Expand Down
27 changes: 0 additions & 27 deletions cibuildwheel/resources/pypy_venv_27.patch

This file was deleted.

2 changes: 1 addition & 1 deletion cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_for_python_version(self, version: str) -> Path:
version_parts = version.split(".")

# try to find a version-specific dependency file e.g. if
# ./constraints.txt is the base, look for ./constraints-python27.txt
# ./constraints.txt is the base, look for ./constraints-python36.txt
specific_stem = self.base_file_path.stem + f"-python{version_parts[0]}{version_parts[1]}"
specific_name = specific_stem + self.base_file_path.suffix
specific_file_path = self.base_file_path.with_name(specific_name)
Expand Down
14 changes: 2 additions & 12 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
read_python_configs,
)

IS_RUNNING_ON_AZURE = Path("C:\\hostedtoolcache").exists()


def call(
args: Sequence[PathOrStr], env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None
Expand All @@ -40,7 +38,7 @@ def shell(command: str, env: Optional[Dict[str, str]] = None, cwd: Optional[str]


def get_nuget_args(version: str, arch: str) -> List[str]:
python_name = "python" if version[0] == "3" else "python2"
python_name = "python"
if arch == "32":
python_name += "x86"
return [
Expand Down Expand Up @@ -75,13 +73,6 @@ def get_python_configurations(
"64": Architecture.AMD64,
}

# Only supported with custom compiler, since MS removed the 2008 compiler download
custom_compiler = os.environ.get("DISTUTILS_USE_SDK") and os.environ.get("MSSdk")
if not custom_compiler:
python_configurations = [
c for c in python_configurations if not c.version.startswith("2.7")
]

# skip builds as required
python_configurations = [
c
Expand Down Expand Up @@ -116,8 +107,7 @@ def install_pypy(version: str, arch: str, url: str) -> Path:
download(url, pypy_zip)
# Extract to the parent directory because the zip file still contains a directory
extract_zip(pypy_zip, installation_path.parent)
pypy_exe = "pypy3.exe" if version[0] == "3" else "pypy.exe"
(installation_path / "python.exe").symlink_to(installation_path / pypy_exe)
(installation_path / "python.exe").symlink_to(installation_path / "pypy3.exe")
return installation_path


Expand Down
3 changes: 0 additions & 3 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 2.7.18
pyenv install 3.6.11
pyenv install 3.7.8
# Optionally add 3.8 and make it the local version;
Expand All @@ -81,8 +80,6 @@ pyenv install 3.7.8
Then, you need to make the required virtual environments:

```bash
$(pyenv prefix 2.7.18)/bin/python -m pip install virtualenv
$(pyenv prefix 2.7.18)/bin/python -m virtualenv env27
$(pyenv prefix 3.6.11)/bin/python -m venv env36
$(pyenv prefix 3.7.8)/bin/python -m venv env37
```
Expand Down
Loading

0 comments on commit 18f2fb8

Please sign in to comment.