Skip to content

Commit

Permalink
Add Python 3.10 drop 3.5 (grpc#26074)
Browse files Browse the repository at this point in the history
* Add Python 3.10.0rc1 binary wheels

* Drop Python 3.5 artifacts

* Document the drop of 3.5

* Fix the wrong pip pointer

* Update manylinux2014 to a newer version, remove 3.5 distribtest

* Update manylinux aarch64 to see if the absl error go away

* Use the preferred alias

* Allow different wheel library to produce different tag order

* Remove unused shell var and log produced wheels

* Use copy instead of move

* Make bash happy about the wildcard

* Upgrade the debian image to use 3.5+ Python

* Polish the comments for the Dockerfiles
  • Loading branch information
lidizheng authored Sep 2, 2021
1 parent 8fca16a commit 4729f6f
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 67 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: Apache Software License',
]

Expand Down
2 changes: 1 addition & 1 deletion src/python/grpcio/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Package for gRPC Python.

Supported Python Versions
-------------------------
Python >= 3.5
Python >= 3.6

Installation
------------
Expand Down
6 changes: 1 addition & 5 deletions src/python/grpcio_channelz/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Channelz is a live debug tool in gRPC Python.

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Dependencies
------------
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_channelz/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def run(self):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: Apache Software License',
]

Expand Down
6 changes: 1 addition & 5 deletions src/python/grpcio_health_checking/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Reference package for GRPC Python health checking.

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Dependencies
------------
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_health_checking/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def run(self):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: Apache Software License',
]

Expand Down
6 changes: 1 addition & 5 deletions src/python/grpcio_reflection/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Reference package for reflection in GRPC Python.

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Dependencies
------------
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_reflection/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def run(self):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: Apache Software License',
]

Expand Down
6 changes: 1 addition & 5 deletions src/python/grpcio_status/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Reference package for GRPC Python status proto mapping.

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Dependencies
------------
Expand Down
1 change: 1 addition & 0 deletions src/python/grpcio_status/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def run(self):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: Apache Software License',
]

Expand Down
6 changes: 1 addition & 5 deletions src/python/grpcio_testing/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ Testing utilities for gRPC Python

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Dependencies
------------
Expand Down
9 changes: 2 additions & 7 deletions tools/distrib/python/grpcio_tools/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ Package for gRPC Python tools.

Supported Python Versions
-------------------------
Python >= 3.5

Deprecated Python Versions
--------------------------
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
Python >= 3.6

Installation
------------

The gRPC Python tools package is available for Linux, Mac OS X, and Windows
running Python 2.7.
The gRPC Python tools package is available for Linux, Mac OS X, and Windows.

Installing From PyPI
~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:stretch
FROM debian:buster

RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install virtualenv==16.7.9
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM i386/debian:stretch
FROM i386/debian:buster

RUN apt-get update && apt-get install -y python3 python3-pip

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
# limitations under the License.

# Docker file for building gRPC manylinux Python artifacts.
# Updated: 2021-08-23

# Use a tagged version to use Python 3.5
FROM quay.io/pypa/manylinux2014_x86_64:2021-05-01-28d233a
FROM quay.io/pypa/manylinux2014_x86_64:2021-08-26-12e5da0

# manylinux_2_17 is the preferred alias of manylinux2014
ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH

# TODO(jtattermusch): revisit which of the deps are really required
RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel

###################################
# Install Python build requirements
RUN /opt/python/cp35-cp35m/bin/pip install --upgrade cython
RUN /opt/python/cp36-cp36m/bin/pip install --upgrade cython
RUN /opt/python/cp37-cp37m/bin/pip install --upgrade cython
RUN /opt/python/cp38-cp38/bin/pip install --upgrade cython
RUN /opt/python/cp39-cp39/bin/pip install --upgrade cython
RUN /opt/python/cp310-cp310/bin/pip install --upgrade cython
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
# limitations under the License.

# Docker file for building gRPC manylinux Python artifacts.
# Updated: 2021-08-23

# Use a tagged version to use Python 3.5
FROM quay.io/pypa/manylinux2014_i686:2021-05-01-28d233a
FROM quay.io/pypa/manylinux2014_i686:2021-08-26-12e5da0

# manylinux_2_17 is the preferred alias of manylinux2014
ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH

# TODO(jtattermusch): revisit which of the deps are really required
RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel

###################################
# Install Python build requirements
RUN /opt/python/cp35-cp35m/bin/pip install --upgrade cython
RUN /opt/python/cp36-cp36m/bin/pip install --upgrade cython
RUN /opt/python/cp37-cp37m/bin/pip install --upgrade cython
RUN /opt/python/cp38-cp38/bin/pip install --upgrade cython
RUN /opt/python/cp39-cp39/bin/pip install --upgrade cython
RUN /opt/python/cp310-cp310/bin/pip install --upgrade cython
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
# before https://github.com/dockcross/dockcross/pull/449
# Thanks to that, wheel build with this image aren't actually
# compliant with manylinux2014, but only with manylinux_2_24
FROM dockcross/manylinux2014-aarch64:20200929-608e6ac
FROM dockcross/manylinux2014-aarch64:20210826-19322ba

# Make the grpc wheels correctly tagged with manylinux_2_24
# instead of the incorrect manylinux2014 (see the note above).
ENV AUDITWHEEL_PLAT manylinux_2_24_$AUDITWHEEL_ARCH

###################################
# Install Python build requirements
RUN /opt/python/cp35-cp35m/bin/pip install --upgrade cython
RUN /opt/python/cp36-cp36m/bin/pip install --upgrade cython
RUN /opt/python/cp37-cp37m/bin/pip install --upgrade cython
RUN /opt/python/cp38-cp38/bin/pip install --upgrade cython
RUN /opt/python/cp39-cp39/bin/pip install --upgrade cython
RUN /opt/python/cp310-cp310/bin/pip install --upgrade cython

# the dockcross docker image sets variables like CC, CXX etc.
# to point to the crosscompilation toolchain, but doesn't set corresponding
Expand Down
17 changes: 17 additions & 0 deletions tools/internal_ci/helper_scripts/install_python_interpreters.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,20 @@ $Python39x64Config = @{
PythonInstallerHash = "b61a33dc28f13b561452f3089c87eb63"
}
Install-Python @Python39x64Config

# Python 3.10
$Python310x86Config = @{
PythonVersion = "3.10.0"
PythonInstaller = "python-3.10.0rc1"
PythonInstallPath = "C:\Python310_32bit"
PythonInstallerHash = "6de353f2f7422aa030d4ccc788ffa75e"
}
Install-Python @Python310x86Config

$Python310x64Config = @{
PythonVersion = "3.10.0"
PythonInstaller = "python-3.10.0rc1-amd64"
PythonInstallPath = "C:\Python310"
PythonInstallerHash = "39135519b044757f0a3b09d63612b0da"
}
Install-Python @Python310x64Config
8 changes: 8 additions & 0 deletions tools/internal_ci/helper_scripts/prepare_build_macos_rc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ then
shasum -c /tmp/python_installer_checksum.sha256
time sudo installer -pkg ./python-3.9.0-macosx10.9.pkg -target /
fi

# Install Python 3.10 if it doesn't exist
if [ ! -f "/usr/local/bin/python3.10" ]; then
time curl -O https://www.python.org/ftp/python/3.10.0/python-3.10.0rc1-macos11.pkg
echo "5933d3d72438b03742d2bb3c8d6cb0e5db165d7110bbc95dac8016f5e31fae7b python-3.10.0rc1-macos11.pkg" > /tmp/python_installer_checksum.sha256
shasum -c /tmp/python_installer_checksum.sha256
time sudo installer -pkg ./python-3.10.0rc1-macos11.pkg -target /
fi
fi

if [ "${PREPARE_BUILD_INSTALL_DEPS_CSHARP}" == "true" ]
Expand Down
14 changes: 7 additions & 7 deletions tools/run_tests/artifacts/artifact_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,22 +353,20 @@ def targets():
CSharpExtArtifact('linux', 'android', arch_abi='armeabi-v7a'),
CSharpExtArtifact('linux', 'android', arch_abi='x86'),
CSharpExtArtifact('macos', 'ios'),
PythonArtifact('manylinux2014', 'x64', 'cp35-cp35m'),
PythonArtifact('manylinux2014', 'x64', 'cp36-cp36m'),
PythonArtifact('manylinux2014', 'x64', 'cp37-cp37m'),
PythonArtifact('manylinux2014', 'x64', 'cp38-cp38'),
PythonArtifact('manylinux2014', 'x64', 'cp39-cp39'),
PythonArtifact('manylinux2014', 'x86', 'cp35-cp35m'),
PythonArtifact('manylinux2014', 'x64', 'cp310-cp310'),
PythonArtifact('manylinux2014', 'x86', 'cp36-cp36m'),
PythonArtifact('manylinux2014', 'x86', 'cp37-cp37m'),
PythonArtifact('manylinux2014', 'x86', 'cp38-cp38'),
PythonArtifact('manylinux2014', 'x86', 'cp39-cp39'),
PythonArtifact('manylinux2010', 'x64', 'cp35-cp35m'),
PythonArtifact('manylinux2014', 'x86', 'cp310-cp310'),
PythonArtifact('manylinux2010', 'x64', 'cp36-cp36m'),
PythonArtifact('manylinux2010', 'x64', 'cp37-cp37m'),
PythonArtifact('manylinux2010', 'x64', 'cp38-cp38'),
PythonArtifact('manylinux2010', 'x64', 'cp39-cp39'),
PythonArtifact('manylinux2010', 'x86', 'cp35-cp35m'),
PythonArtifact('manylinux2010', 'x86', 'cp36-cp36m'),
PythonArtifact('manylinux2010', 'x86', 'cp37-cp37m'),
PythonArtifact('manylinux2010', 'x86', 'cp38-cp38'),
Expand All @@ -377,25 +375,27 @@ def targets():
PythonArtifact('manylinux_2_24', 'aarch64', 'cp37-cp37m'),
PythonArtifact('manylinux_2_24', 'aarch64', 'cp38-cp38'),
PythonArtifact('manylinux_2_24', 'aarch64', 'cp39-cp39'),
PythonArtifact('manylinux_2_24', 'aarch64', 'cp310-cp310'),
PythonArtifact('linux_extra', 'armv7', 'cp36-cp36m'),
PythonArtifact('linux_extra', 'armv7', 'cp37-cp37m'),
PythonArtifact('linux_extra', 'armv7', 'cp38-cp38'),
PythonArtifact('linux_extra', 'armv7', 'cp39-cp39'),
PythonArtifact('macos', 'x64', 'python3.5'),
PythonArtifact('linux_extra', 'armv7', 'cp310-cp310'),
PythonArtifact('macos', 'x64', 'python3.6'),
PythonArtifact('macos', 'x64', 'python3.7'),
PythonArtifact('macos', 'x64', 'python3.8'),
PythonArtifact('macos', 'x64', 'python3.9'),
PythonArtifact('windows', 'x86', 'Python35_32bit'),
PythonArtifact('macos', 'x64', 'python3.10'),
PythonArtifact('windows', 'x86', 'Python36_32bit'),
PythonArtifact('windows', 'x86', 'Python37_32bit'),
PythonArtifact('windows', 'x86', 'Python38_32bit'),
PythonArtifact('windows', 'x86', 'Python39_32bit'),
PythonArtifact('windows', 'x64', 'Python35'),
PythonArtifact('windows', 'x86', 'Python310_32bit'),
PythonArtifact('windows', 'x64', 'Python36'),
PythonArtifact('windows', 'x64', 'Python37'),
PythonArtifact('windows', 'x64', 'Python38'),
PythonArtifact('windows', 'x64', 'Python39'),
PythonArtifact('windows', 'x64', 'Python310'),
RubyArtifact('linux', 'x64'),
RubyArtifact('macos', 'x64'),
PHPArtifact('linux', 'x64'),
Expand Down
20 changes: 11 additions & 9 deletions tools/run_tests/artifacts/build_artifact_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ cd "$(dirname "$0")/../../.."

export GRPC_PYTHON_BUILD_WITH_CYTHON=1
export PYTHON=${PYTHON:-python}
export PIP=${PIP:-pip}
export AUDITWHEEL=${AUDITWHEEL:-auditwheel}

# Needed for building binary distribution wheels -- bdist_wheel
"${PYTHON}" -m pip install --upgrade wheel

if [ "$GRPC_SKIP_PIP_CYTHON_UPGRADE" == "" ]
then
# Install Cython to avoid source wheel build failure.
Expand All @@ -31,7 +33,7 @@ then
# Any installation step is a potential source of breakages,
# so we are trying to perform as few download-and-install operations
# as possible.
"${PIP}" install --upgrade cython
"${PYTHON}" -m pip install --upgrade cython
fi

# Allow build_ext to build C/C++ files in parallel
Expand Down Expand Up @@ -144,15 +146,15 @@ fi
# are in a docker image or in a virtualenv.
if [ "$GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS" != "" ]
then
"${PIP}" install -rrequirements.txt
"${PYTHON}" -m pip install -rrequirements.txt

if [ "$("$PYTHON" -c "import sys; print(sys.version_info[0])")" == "2" ]
then
"${PIP}" install futures>=2.2.0 enum34>=1.0.4
"${PYTHON}" -m pip install futures>=2.2.0 enum34>=1.0.4
fi

"${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/"
"${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"
"${PYTHON}" -m pip install grpcio --no-index --find-links "file://$ARTIFACT_DIR/"
"${PYTHON}" -m pip install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"

# Note(lidiz) setuptools's "sdist" command creates a source tarball, which
# demands an extra step of building the wheel. The building step is merely ran
Expand Down Expand Up @@ -191,9 +193,9 @@ then

# Build grpcio_admin source distribution and it needs the cutting-edge version
# of Channelz and CSDS to be installed.
"${PIP}" install --upgrade xds-protos==0.0.8
"${PIP}" install grpcio-channelz --no-index --find-links "file://$ARTIFACT_DIR/"
"${PIP}" install grpcio-csds --no-index --find-links "file://$ARTIFACT_DIR/"
"${PYTHON}" -m pip install --upgrade xds-protos==0.0.8
"${PYTHON}" -m pip install grpcio-channelz --no-index --find-links "file://$ARTIFACT_DIR/"
"${PYTHON}" -m pip install grpcio-csds --no-index --find-links "file://$ARTIFACT_DIR/"
${SETARCH_CMD} "${PYTHON}" src/python/grpcio_admin/setup.py \
sdist bdist_wheel
cp -r src/python/grpcio_admin/dist/* "$ARTIFACT_DIR"
Expand Down
3 changes: 1 addition & 2 deletions tools/run_tests/artifacts/build_package_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ strip_binary_wheel() {
find "$TEMP_WHEEL_DIR" -name "_protoc_compiler*.so" -exec strip --strip-debug {} ";"
find "$TEMP_WHEEL_DIR" -name "cygrpc*.so" -exec strip --strip-debug {} ";"

WHEEL_FILE=$(basename "$WHEEL_PATH")
DISTRIBUTION_NAME=$(basename "$WHEEL_PATH" | cut -d '-' -f 1)
VERSION=$(basename "$WHEEL_PATH" | cut -d '-' -f 2)
${PYTHON} -m wheel pack "$TEMP_WHEEL_DIR/$DISTRIBUTION_NAME-$VERSION" -d "$TEMP_WHEEL_DIR"
mv "$TEMP_WHEEL_DIR/$WHEEL_FILE" "$WHEEL_PATH"
mv "${TEMP_WHEEL_DIR}"/*.whl "$WHEEL_PATH"
}

for wheel in artifacts/*.whl; do
Expand Down
Loading

0 comments on commit 4729f6f

Please sign in to comment.