Skip to content

Commit

Permalink
Remove Python 3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed May 6, 2023
1 parent 49cc213 commit f3e1370
Show file tree
Hide file tree
Showing 238 changed files with 1,675 additions and 1,882 deletions.
2 changes: 1 addition & 1 deletion .github/actions/breeze/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- name: Cache breeze
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/build-prod-images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:
shell: bash
run: breeze ci-image pull --tag-as-latest
env:
PYTHON_MAJOR_MINOR_VERSION: "3.7"
PYTHON_MAJOR_MINOR_VERSION: "3.8"
- name: "Cleanup dist and context file"
shell: bash
run: rm -fv ./dist/* ./docker-context-files/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: "Retrieve defaults from branch_defaults.py"
# We cannot "execute" the branch_defaults.py python code here because that would be
# a security problem (we cannot run any code that comes from the sources coming from the PR.
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ formats: []
sphinx:
configuration: docs/rtd-deprecation/conf.py
python:
version: "3.7"
version: "3.8"
install:
- method: pip
path: .
Expand Down
12 changes: 6 additions & 6 deletions BREEZE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ You can use additional ``breeze`` flags to choose your environment. You can spec
version to use, and backend (the meta-data database). Thanks to that, with Breeze, you can recreate the same
environments as we have in matrix builds in the CI.

For example, you can choose to run Python 3.7 tests with MySQL as backend and with mysql version 8
For example, you can choose to run Python 3.8 tests with MySQL as backend and with mysql version 8
as follows:

.. code-block:: bash
breeze --python 3.7 --backend mysql --mysql-version 8
breeze --python 3.8 --backend mysql --mysql-version 8
The choices you make are persisted in the ``./.build/`` cache directory so that next time when you use the
``breeze`` script, it could use the values that were used previously. This way you do not have to specify
Expand Down Expand Up @@ -499,15 +499,15 @@ When you are starting airflow from local sources, www asset compilation is autom

.. code-block:: bash
breeze --python 3.7 --backend mysql start-airflow
breeze --python 3.8 --backend mysql start-airflow
You can also use it to start any released version of Airflow from ``PyPI`` with the
``--use-airflow-version`` flag.

.. code-block:: bash
breeze start-airflow --python 3.7 --backend mysql --use-airflow-version 2.2.5
breeze start-airflow --python 3.8 --backend mysql --use-airflow-version 2.2.5
Those are all available flags of ``start-airflow`` command:

Expand Down Expand Up @@ -1395,10 +1395,10 @@ suffix and they need to also be paired with corresponding runtime dependency add
.. code-block:: bash
breeze prod-image build --python 3.7 --additional-dev-deps "libasound2-dev" \
breeze prod-image build --python 3.8 --additional-dev-deps "libasound2-dev" \
--additional-runtime-apt-deps "libasound2"
Same as above but uses python 3.7.
Same as above but uses python 3.8.
Building PROD image
...................
Expand Down
8 changes: 4 additions & 4 deletions CI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Container Registry used as cache
We are using GitHub Container Registry to store the results of the ``Build Images``
workflow which is used in the ``Tests`` workflow.

Currently in main version of Airflow we run tests in 4 different versions of Python (3.7, 3.8, 3.9, 3.10)
Currently in main version of Airflow we run tests in 4 different versions of Python (3.8, 3.9, 3.10)
which means that we have to build 8 images (4 CI ones and 4 PROD ones). Yet we run around 12 jobs
with each of the CI images. That is a lot of time to just build the environment to run. Therefore
we are utilising ``pull_request_target`` feature of GitHub Actions.
Expand Down Expand Up @@ -145,7 +145,7 @@ have to be percent-encoded when you access them via UI (/ = %2F)
+--------------+----------------------------------------------------------+----------------------------------------------------------+

* <BRANCH> might be either "main" or "v2-*-test"
* <X.Y> - Python version (Major + Minor).Should be one of ["3.7", "3.8", "3.9"].
* <X.Y> - Python version (Major + Minor).Should be one of ["3.8", "3.9", "3.10"].
* <COMMIT_SHA> - full-length SHA of commit either from the tip of the branch (for pushes/schedule) or
commit from the tip of the branch used for the PR.
Expand Down Expand Up @@ -523,9 +523,9 @@ For example knowing that the CI job was for commit ``cd27124534b46c9688a1d89e75f

.. code-block:: bash
docker pull ghcr.io/apache/airflow/main/ci/python3.7:cd27124534b46c9688a1d89e75fcd137ab5137e3
docker pull ghcr.io/apache/airflow/main/ci/python3.8:cd27124534b46c9688a1d89e75fcd137ab5137e3
docker run -it ghcr.io/apache/airflow/main/ci/python3.7:cd27124534b46c9688a1d89e75fcd137ab5137e3
docker run -it ghcr.io/apache/airflow/main/ci/python3.8:cd27124534b46c9688a1d89e75fcd137ab5137e3
But you usually need to pass more variables and complex setup if you want to connect to a database or
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ these guidelines:
- Run tests locally before opening PR.

- You can use any supported python version to run the tests, but the best is to check
if it works for the oldest supported version (Python 3.7 currently). In rare cases
if it works for the oldest supported version (Python 3.8 currently). In rare cases
tests might fail with the oldest version when you use features that are available in newer Python
versions. For that purpose we have ``airflow.compat`` package where we keep back-ported
useful features from newer versions.
Expand Down Expand Up @@ -830,7 +830,7 @@ from the PyPI package:
.. code-block:: bash
pip install apache-airflow[google,amazon,async]==2.2.5 \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.5/constraints-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.2.5/constraints-3.8.txt"
The last one can be used to install Airflow in "minimal" mode - i.e when bare Airflow is installed without
extras.
Expand All @@ -842,15 +842,15 @@ requirements).
.. code-block:: bash
pip install -e . \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-source-providers-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-source-providers-3.8.txt"
This works also with extras - for example:

.. code-block:: bash
pip install ".[ssh]" \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-source-providers-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-source-providers-3.8.txt"
There are different set of fixed constraint files for different python major/minor versions and you should
Expand All @@ -862,7 +862,7 @@ If you want to update just airflow dependencies, without paying attention to pro
.. code-block:: bash
pip install . --upgrade \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-no-providers-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-no-providers-3.8.txt"
The ``constraints-<PYTHON_MAJOR_MINOR_VERSION>.txt`` and ``constraints-no-providers-<PYTHON_MAJOR_MINOR_VERSION>.txt``
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ARG AIRFLOW_USER_HOME_DIR=/home/airflow
# latest released version here
ARG AIRFLOW_VERSION="2.6.0"

ARG PYTHON_BASE_IMAGE="python:3.7-slim-bullseye"
ARG PYTHON_BASE_IMAGE="python:3.8-slim-bullseye"

ARG AIRFLOW_PIP_VERSION=23.1.2
ARG AIRFLOW_IMAGE_REPOSITORY="https://github.com/apache/airflow"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# WARNING: THIS DOCKERFILE IS NOT INTENDED FOR PRODUCTION USE OR DEPLOYMENT.
#
ARG PYTHON_BASE_IMAGE="python:3.7-slim-bullseye"
ARG PYTHON_BASE_IMAGE="python:3.8-slim-bullseye"

##############################################################################################
# This is the script image where we keep all inlined bash scripts needed in other segments
Expand Down Expand Up @@ -615,7 +615,7 @@ chmod 1777 /tmp

AIRFLOW_SOURCES=$(cd "${IN_CONTAINER_DIR}/../.." || exit 1; pwd)

PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION:=3.7}
PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION:=3.8}

export AIRFLOW_HOME=${AIRFLOW_HOME:=${HOME}}

Expand Down
56 changes: 28 additions & 28 deletions IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ image version for the chosen Python version.
The images are build with default extras - different extras for CI and production image and you
can change the extras via the ``--extras`` parameters and add new ones with ``--additional-extras``.

For example if you want to build Python 3.7 version of production image with
For example if you want to build Python 3.8 version of production image with
"all" extras installed you should run this command:

.. code-block:: bash
breeze prod-image build --python 3.7 --extras "all"
breeze prod-image build --python 3.8 --extras "all"
If you just want to add new extras you can add them like that:

.. code-block:: bash
breeze prod-image build --python 3.7 --additional-extras "all"
breeze prod-image build --python 3.8 --additional-extras "all"
The command that builds the CI image is optimized to minimize the time needed to rebuild the image when
the source code of Airflow evolves. This means that if you already have the image locally downloaded and
Expand All @@ -128,15 +128,15 @@ parameter to Breeze:

.. code-block:: bash
breeze prod-image build --python 3.7 --additional-extras=trino --install-airflow-version=2.0.0
breeze prod-image build --python 3.8 --additional-extras=trino --install-airflow-version=2.0.0
This will build the image using command similar to:

.. code-block:: bash
pip install \
apache-airflow[async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv]==2.0.0 \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.0.0/constraints-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.0.0/constraints-3.8.txt"
.. note::

Expand All @@ -158,14 +158,14 @@ HEAD of development for constraints):
.. code-block:: bash
pip install "https://github.com/apache/airflow/archive/<tag>.tar.gz#egg=apache-airflow" \
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-3.7.txt"
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-main/constraints-3.8.txt"
You can also skip installing airflow and install it from locally provided files by using
``--install-packages-from-context`` parameter to Breeze:

.. code-block:: bash
breeze prod-image build --python 3.7 --additional-extras=trino --install-packages-from-context
breeze prod-image build --python 3.8 --additional-extras=trino --install-packages-from-context
In this case you airflow and all packages (.whl files) should be placed in ``docker-context-files`` folder.

Expand All @@ -192,21 +192,21 @@ or ``disabled`` flags when you run Breeze commands. For example:

.. code-block:: bash
breeze ci-image build --python 3.7 --docker-cache local
breeze ci-image build --python 3.8 --docker-cache local
Will build the CI image using local build cache (note that it will take quite a long time the first
time you run it).

.. code-block:: bash
breeze prod-image build --python 3.7 --docker-cache registry
breeze prod-image build --python 3.8 --docker-cache registry
Will build the production image with cache used from registry.


.. code-block:: bash
breeze prod-image build --python 3.7 --docker-cache disabled
breeze prod-image build --python 3.8 --docker-cache disabled
Will build the production image from the scratch.

Expand Down Expand Up @@ -304,7 +304,7 @@ in the `<#ci-image-build-arguments>`_ chapter below.

Here just a few examples are presented which should give you general understanding of what you can customize.

This builds the production image in version 3.7 with additional airflow extras from 2.0.0 PyPI package and
This builds the production image in version 3.8 with additional airflow extras from 2.0.0 PyPI package and
additional apt dev and runtime dependencies.

As of Airflow 2.3.0, it is required to build images with ``DOCKER_BUILDKIT=1`` variable
Expand All @@ -315,7 +315,7 @@ you have ``buildx`` plugin installed.
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="jdbc" \
--build-arg ADDITIONAL_PYTHON_DEPS="pandas" \
--build-arg ADDITIONAL_DEV_APT_DEPS="gcc g++" \
Expand All @@ -326,7 +326,7 @@ the same image can be built using ``breeze`` (it supports auto-completion of the

.. code-block:: bash
breeze ci-image build --python 3.7 --additional-extras=jdbc --additional-python-deps="pandas" \
breeze ci-image build --python 3.8 --additional-extras=jdbc --additional-python-deps="pandas" \
--additional-dev-apt-deps="gcc g++"
You can customize more aspects of the image - such as additional commands executed before apt dependencies
Expand All @@ -338,7 +338,7 @@ based on example in `this comment <https://github.com/apache/airflow/issues/8605
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg AIRFLOW_INSTALLATION_METHOD="apache-airflow" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="slack" \
--build-arg ADDITIONAL_PYTHON_DEPS="apache-airflow-providers-odbc \
Expand All @@ -363,9 +363,9 @@ The following build arguments (``--build-arg`` in docker build command) can be u
+------------------------------------------+------------------------------------------+------------------------------------------+
| Build argument | Default value | Description |
+==========================================+==========================================+==========================================+
| ``PYTHON_BASE_IMAGE`` | ``python:3.7-slim-bullseye`` | Base Python image |
| ``PYTHON_BASE_IMAGE`` | ``python:3.8-slim-bullseye`` | Base Python image |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``PYTHON_MAJOR_MINOR_VERSION`` | ``3.7`` | major/minor version of Python (should |
| ``PYTHON_MAJOR_MINOR_VERSION`` | ``3.8`` | major/minor version of Python (should |
| | | match base image) |
+------------------------------------------+------------------------------------------+------------------------------------------+
| ``DEPENDENCIES_EPOCH_NUMBER`` | ``2`` | increasing this number will reinstall |
Expand Down Expand Up @@ -464,59 +464,59 @@ The following build arguments (``--build-arg`` in docker build command) can be u

Here are some examples of how CI images can built manually. CI is always built from local sources.

This builds the CI image in version 3.7 with default extras ("all").
This builds the CI image in version 3.8 with default extras ("all").

.. code-block:: bash
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" --tag my-image:0.0.1
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" --tag my-image:0.0.1
This builds the CI image in version 3.7 with "gcp" extra only.
This builds the CI image in version 3.8 with "gcp" extra only.

.. code-block:: bash
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg AIRFLOW_EXTRAS=gcp --tag my-image:0.0.1
This builds the CI image in version 3.7 with "apache-beam" extra added.
This builds the CI image in version 3.8 with "apache-beam" extra added.

.. code-block:: bash
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg ADDITIONAL_AIRFLOW_EXTRAS="apache-beam" --tag my-image:0.0.1
This builds the CI image in version 3.7 with "mssql" additional package added.
This builds the CI image in version 3.8 with "mssql" additional package added.

.. code-block:: bash
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg ADDITIONAL_PYTHON_DEPS="mssql" --tag my-image:0.0.1
This builds the CI image in version 3.7 with "gcc" and "g++" additional apt dev dependencies added.
This builds the CI image in version 3.8 with "gcc" and "g++" additional apt dev dependencies added.

.. code-block::
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg ADDITIONAL_DEV_APT_DEPS="gcc g++" --tag my-image:0.0.1
This builds the CI image in version 3.7 with "jdbc" extra and "default-jre-headless" additional apt runtime dependencies added.
This builds the CI image in version 3.8 with "jdbc" extra and "default-jre-headless" additional apt runtime dependencies added.

.. code-block::
DOCKER_BUILDKIT=1 docker build . -f Dockerfile.ci \
--pull \
--build-arg PYTHON_BASE_IMAGE="python:3.7-slim-bullseye" \
--build-arg PYTHON_BASE_IMAGE="python:3.8-slim-bullseye" \
--build-arg AIRFLOW_EXTRAS=jdbc \
--tag my-image:0.0.1
Expand Down
Loading

0 comments on commit f3e1370

Please sign in to comment.