You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/12/08 15:23:40 UTC
[airflow] branch master updated: Adds predefined providers to
install_requires. (#12916)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new e7c1771 Adds predefined providers to install_requires. (#12916)
e7c1771 is described below
commit e7c1771cba16e3f554d6de5f77c97e49b16f7bed
Author: Ash Berlin-Taylor <as...@firemirror.com>
AuthorDate: Tue Dec 8 15:22:47 2020 +0000
Adds predefined providers to install_requires. (#12916)
* The 4 providers (http, ftp, sqlite, imap) are popular
and they do not require any additionl dependencies so we decided
to include them by default in Airflow 2.0
Co-authored-by: Jarek Potiuk <ja...@polidea.com>
* Update setup.py
Co-authored-by: Jarek Potiuk <ja...@polidea.com>
Co-authored-by: Kaxil Naik <ka...@gmail.com>
---
setup.cfg | 4 ++++
setup.py | 19 ++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/setup.cfg b/setup.cfg
index d30225a..c8aeec1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -80,6 +80,10 @@ setup_requires =
#####################################################################################################
install_requires =
alembic>=1.2, <2.0
+ apache-airflow-providers-ftp
+ apache-airflow-providers-http
+ apache-airflow-providers-imap
+ apache-airflow-providers-sqlite
argcomplete~=1.10
attrs>=20.0, <21.0
cached_property~=1.5
diff --git a/setup.py b/setup.py
index 0bdbfe7..070ff29 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ from os.path import dirname
from textwrap import wrap
from typing import Dict, Iterable, List
-from setuptools import Command, find_namespace_packages, setup
+from setuptools import Command, Distribution, find_namespace_packages, setup
logger = logging.getLogger(__name__)
@@ -884,6 +884,22 @@ EXTRAS_REQUIREMENTS.update(
)
+class AirflowDistribtuion(Distribution):
+ """setuptools.Distribution subclass with Airflow specific behaviour"""
+
+ # https://github.com/PyCQA/pylint/issues/3737
+ def parse_config_files(self, *args, **kwargs): # pylint: disable=signature-differs
+ """
+ Ensure that when we have been asked to install providers from sources
+ that we don't *also* try to install those providers from PyPI
+ """
+ super().parse_config_files(*args, **kwargs)
+ if os.getenv('INSTALL_PROVIDERS_FROM_SOURCES') == 'true':
+ self.install_requires = [ # pylint: disable=attribute-defined-outside-init
+ req for req in self.install_requires if not req.startswith('apache-airflow-providers-')
+ ]
+
+
def get_provider_package_from_package_id(package_id: str):
"""
Builds the name of provider package out of the package id provided/
@@ -911,6 +927,7 @@ def do_setup():
write_version()
setup(
+ distclass=AirflowDistribtuion,
# Most values come from setup.cfg -- see
# https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html
version=version,