Content-Length: 810181 | pFad | http://github.com/apache/airflow/commit/8c5638832f2b6507dd872d37f4a02d66f938d5fd

78 [AIRFLOW-7067] Pinned version of Apache Airflow (#7730) · apache/airflow@8c56388 · GitHub
Skip to content

Commit 8c56388

Browse files
authored
[AIRFLOW-7067] Pinned version of Apache Airflow (#7730)
1 parent d9ea57b commit 8c56388

24 files changed

+962
-161
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
!MANIFEST.in
4949
!NOTICE
5050
!.github
51+
!requirements.txt
5152

5253
# Avoid triggering context change on README change (new companies using Airflow)
5354
# So please do not uncomment this line ;)

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ repos:
223223
files: ^airflow/providers/.*\.py$|^tests/providers/.*\.py$
224224
pass_filenames: false
225225
require_serial: true
226+
- id: update-extras
227+
name: Update extras in documentation
228+
entry: "./scripts/ci/pre_commit_update_extras.sh"
229+
language: system
230+
files: ^setup.py$|^INSTALL$|^CONTRIBUTING.rst$
231+
pass_filenames: false
232+
require_serial: true
226233
- id: pydevd
227234
language: pygrep
228235
name: Check for pydevd debug statements accidentally left
@@ -286,6 +293,13 @@ repos:
286293
language: system
287294
always_run: true
288295
pass_filenames: false
296+
- id: generate-requirements
297+
name: Generate requirements
298+
entry: "./scripts/ci/pre_commit_generate_requirements.sh"
299+
language: system
300+
files: ^setup.py$
301+
pass_filenames: false
302+
require_serial: true
289303
- id: check-apache-license
290304
name: Check if licenses are OK for Apache
291305
entry: "./scripts/ci/pre_commit_check_license.sh"

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
env: >-
4444
PYTHON_VERSION=3.6
4545
AIRFLOW_MOUNT_SOURCE_DIR_FOR_STATIC_CHECKS="true"
46-
SKIP=pylint-tests
46+
SKIP=pylint-tests,generate-requirements
4747
- name: "Static checks - pylint tests only"
4848
stage: pre-test
4949
script: ./scripts/ci/ci_run_static_checks_pylint_tests.sh
@@ -133,10 +133,10 @@ jobs:
133133
ENABLED_INTEGRATIONS="kerberos"
134134
script: "./scripts/ci/ci_run_airflow_testing.sh --ignore=tests/providers"
135135
stage: test
136-
- name: "Prepare backport packages"
136+
- name: "Prepare packages and generate requirements"
137137
before_install: pip install bowler
138138
stage: test
139-
script: ./scripts/ci/ci_prepare_backport_packages.sh
139+
script: ./scripts/ci/ci_prepare_packages.sh && ./scripts/ci/ci_generate_requirements.sh
140140
before_install:
141141
- ./scripts/ci/ci_before_install.sh
142142
script: ./scripts/ci/ci_run_airflow_testing.sh

BREEZE.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ This is the current syntax for `./breeze <./breeze>`_:
711711
****************************************************************************************************
712712
breeze [FLAGS] initialize-local-virtualenv -- <EXTRA_ARGS>
713713
714-
Initializes locally created virtualenv installing all dependencies of Airflow.
714+
Initializes locally created virtualenv installing all dependencies of Airflow
715+
taking into account the frozen requirements from requirements.txt.
715716
This local virtualenv can be used to aid autocompletion and IDE support as
716717
well as run unit tests directly from the IDE. You need to have virtualenv
717718
activated before running this command.

CONTRIBUTING.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,71 @@ Limitations:
302302
They are optimized for repeatability of tests, maintainability and speed of building rather
303303
than production performance. The production images are not yet officially published.
304304

305+
Extras
306+
------
307+
308+
There are a number of extras that can be specified when installing Airflow. Those
309+
extras can be specified after the usual pip install - for example
310+
``pip install -e .[gcp]``. For development purpose there is a ``devel`` extra that
311+
installs all development dependencies. There is also ``devel_ci`` that installs
312+
all dependencies needed in CI envioronment.
313+
314+
This is the full list of those extras:
315+
316+
.. START EXTRAS HERE
317+
318+
all, all_dbs, async, atlas, aws, azure, cassandra, celery, cgroups, cloudant, dask, databricks,
319+
datadog, devel, devel_ci, devel_hadoop, doc, docker, druid, elasticsearch, gcp, gcp_api,
320+
github_enterprise, google_auth, grpc, hdfs, hive, hvac, jdbc, jira, kerberos, kubernetes, ldap,
321+
mongo, mssql, mysql, odbc, oracle, pagerduty, papermill, password, pinot, postgres, presto, qds,
322+
rabbitmq, redis, salesforce, samba, segment, sendgrid, sentry, singularity, slack, snowflake, ssh,
323+
statsd, tableau, vertica, webhdfs, winrm, yandexcloud
324+
325+
.. END EXTRAS HERE
326+
327+
328+
Pinned Airflow requirements.txt file
329+
------------------------------------
330+
331+
Airflow is not a standard python project. Most of the python projects fall into one of two types -
332+
application or library. As described in
333+
[StackOverflow Question](https://stackoverflow.com/questions/28509481/should-i-pin-my-python-dependencies-versions)
334+
decision whether to pin (freeze) requirements for a python project depdends on the type. For
335+
applications, dependencies should be pinned, but for libraries, they should be open.
336+
337+
For application, pinning the dependencies makes it more stable to install in the future - because new
338+
(even transitive) dependencies might cause installation to fail. For libraries - the dependencies should
339+
be open to allow several different libraries with the same requirements to be installed at the same time.
340+
341+
The problem is that Apache Airflow is a bit of both - application to install and library to be used when
342+
you are developing your own operators and DAGs.
343+
344+
This - seemingly unsolvable - puzzle is solved as follows:
345+
346+
* by default when you install ``apache-airflow`` package - the dependencies are as open as possible while
347+
still allowing the apache-airflow to install. This means that 'apache-airflow' package might fail to
348+
install in case a direct or transitive dependency is released that breaks the installation. In such case
349+
when installing ``apache-airflow``, you might need to provide additional constraints (for
350+
example ``pip install apache-airflow==1.10.2 Werkzeug<1.0.0``)
351+
352+
* we have ``requirements.txt`` file generated automatically based on the set of all latest working
353+
and tested requirement versions. You can also use that file as a constraints file when installing
354+
apache airflow - either from the sources ``pip install -e . --constraint requirements.txt`` or
355+
from the pypi package ``pip install apache-airflow --constraint requirements.txt``. Note that
356+
this will also work with extras for example ``pip install .[gcp] --constraint requirements.txt`` or
357+
``pip install apache-airflow[gcp] --constraint requirements.txt``
358+
359+
The ``requirements.txt`` file should be updated automatically via pre-commit whenever you update dependencies
360+
It reflects the current set of dependencies installed in the CI image of Apache Airflow.
361+
The same set of requirements will be used to produce the production image.
362+
363+
If you do not use pre-commits and the CI builds fails / you need to regenerate it, you can do it manually:
364+
``pre-commit run generate-requirements --all-files`` or via script
365+
``./scripts/ci/ci_generate_requirements.sh``.
366+
This will try to regenerate the requirements.txt file with the latest requirements matching
367+
the setup.py constraints.
368+
369+
305370
Backport providers packages
306371
---------------------------
307372

@@ -713,6 +778,7 @@ useful for "bisecting" when looking for a commit that introduced some bugs.
713778

714779
First of all - you can read about rebase workflow here:
715780
`Merging vs. rebasing <https://www.atlassian.com/git/tutorials/merging-vs-rebasing>`_ - this is an
781+
`Merging vs. rebasing <https://www.atlassian.com/git/tutorials/merging-vs-rebasing>`_ - this is an
716782
excellent article that describes all ins/outs of rebase. I recommend reading it and keeping it as reference.
717783

718784
The goal of rebasing your PR on top of ``apache/master`` is to "transplant" your change on top of

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,20 @@ COPY airflow/version.py ${AIRFLOW_SOURCES}/airflow/version.py
368368
COPY airflow/__init__.py ${AIRFLOW_SOURCES}/airflow/__init__.py
369369
COPY airflow/bin/airflow ${AIRFLOW_SOURCES}/airflow/bin/airflow
370370

371+
COPY requirements.txt ${AIRFLOW_SOURCES}/requirements.txt
372+
373+
ENV UPGRADE_TO_LATEST_REQUIREMENTS_IN_DOCKER_BUILD=${UPGRADE_TO_LATEST_REQUIREMENTS_IN_DOCKER_BUILD}
371374
# The goal of this line is to install the dependencies from the most current setup.py from sources
372375
# This will be usually incremental small set of packages in CI optimized build, so it will be very fast
373376
# In non-CI optimized build this will install all dependencies before installing sources.
374-
RUN pip install -e ".[${AIRFLOW_EXTRAS}]"
377+
# Usually we will install versions constrained to the current requirements.txt
378+
# But in cron job we will install latest versions matching setup.py to see if there is no breaking change
379+
RUN \
380+
if [[ "${UPGRADE_TO_LATEST_REQUIREMENTS_IN_DOCKER_BUILD}" == "true" ]]; then \
381+
pip install -e ".[${AIRFLOW_EXTRAS}]" --upgrade; \
382+
else \
383+
pip install -e ".[${AIRFLOW_EXTRAS}]" --constraint ${AIRFLOW_SOURCES}/requirements.txt ; \
384+
fi
375385

376386
# Copy all the www/ files we need to compile assets. Done as two separate COPY
377387
# commands so as otherwise it copies the _contents_ of static/ in to www/

INSTALL

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
# INSTALL / BUILD instructions for Apache Airflow
22

3-
# [required] fetch the tarball and untar the source
4-
# change into the directory that was untarred.
3+
This ia a generic installation method that requires a number of dependencies to be installed.
4+
5+
Depending on your system you might need different prerequisites, but the following
6+
systems/prerequisites are known to work:
7+
8+
Linux (Debian Buster and Linux Mint Tricia):
9+
10+
sudo apt install build-essentials python3.6-dev python3.7-dev python-dev openssl \
11+
sqlite sqlite-dev default-libmysqlclient-dev libmysqld-dev postgresq
12+
13+
MacOS (Mojave/Catalina):
14+
15+
brew install sqlite mysql postgresql
16+
17+
# [required] fetch the tarball and untar the source move into the directory that was untarred.
518

619
# [optional] run Apache RAT (release audit tool) to validate license headers
720
# RAT docs here: https://creadur.apache.org/rat/. Requires Java and Apache Rat
@@ -11,12 +24,32 @@ java -jar apache-rat.jar -E ./.rat-excludes -d .
1124
# to connect to other services. You might want to test or run Airflow
1225
# from a virtual env to make sure those dependencies are separated
1326
# from your system wide versions
14-
python -m my_env
15-
source my_env/bin/activate
1627

17-
# [required] building and installing
18-
# by pip (preferred)
28+
python3 -m venv PATH_TO_YOUR_VENV
29+
source PATH_TO_YOUR_VENV/bin/activate
30+
31+
# [required] building and installing by pip (preferred)
1932
pip install .
2033

2134
# or directly
2235
python setup.py install
36+
37+
# You can also install recommended version of the dependencies by using requirements.txt
38+
# as constraint file. This is needed in case you have problems with installint latest
39+
# requirements.
40+
41+
pip install . --constraint requirements.txt
42+
43+
# You can also install Airflow with extras specified. The list of available extras:
44+
# START EXTRAS HERE
45+
46+
all, all_dbs, async, atlas, aws, azure, cassandra, celery, cgroups, cloudant, dask, databricks,
47+
datadog, devel, devel_ci, devel_hadoop, doc, docker, druid, elasticsearch, gcp, gcp_api,
48+
github_enterprise, google_auth, grpc, hdfs, hive, hvac, jdbc, jira, kerberos, kubernetes, ldap,
49+
mongo, mssql, mysql, odbc, oracle, pagerduty, papermill, password, pinot, postgres, presto, qds,
50+
rabbitmq, redis, salesforce, samba, segment, sendgrid, sentry, singularity, slack, snowflake, ssh,
51+
statsd, tableau, vertica, webhdfs, winrm, yandexcloud
52+
53+
# END EXTRAS HERE
54+
55+
# For installing Airflow in development environments - see CONTRIBUTING.rst

breeze

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function initialize_virtualenv() {
177177
echo
178178
pushd "${MY_DIR}"
179179
set +e
180-
pip install -e ".[devel]"
180+
pip install -e ".[devel]" --constraint requirements.txt
181181
RES=$?
182182
set -e
183183
popd
@@ -954,7 +954,8 @@ prepare_usage() {
954954
Explains in detail all the flags that can be used with breeze.
955955
"
956956
export DETAILED_USAGE_INITIALIZE_LOCAL_VIRTUALENV="
957-
Initializes locally created virtualenv installing all dependencies of Airflow.
957+
Initializes locally created virtualenv installing all dependencies of Airflow
958+
taking into account the frozen requirements from requirements.txt.
958959
This local virtualenv can be used to aid autocompletion and IDE support as
959960
well as run unit tests directly from the IDE. You need to have virtualenv
960961
activated before running this command.

common/_files_for_rebuild_check.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
FILES_FOR_REBUILD_CHECK=(
2121
"setup.py"
2222
"setup.cfg"
23+
"requirements.txt"
2324
"Dockerfile"
2425
".dockerignore"
2526
"airflow/version.py"

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/airflow/commit/8c5638832f2b6507dd872d37f4a02d66f938d5fd

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy