Skip to content

Commit

Permalink
Refactored setup.py to better reflect changes in providers (apache#13314
Browse files Browse the repository at this point in the history
)

This is a complete refactor of the setup.py providers/dependencies.

It much better reflects the current setup where we have most of
the extras 1-1 reflecting providers but also some extras that do
not have their own providers.

The pre-commits that were verifying setup versus documentation
can now be vastly simplified (no more need to parse the
comments so we can import setup.py variables directly rather
than parse it via regexps. Also we can better categorize the
extras - separate out (and verify) whether we correctly
described deprecated extras and to mark extras that install
additional providers as such.

Fixes: apache#13309
  • Loading branch information
potiuk authored Dec 28, 2020
1 parent d23ac9b commit 0d21457
Show file tree
Hide file tree
Showing 12 changed files with 792 additions and 707 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ repos:
files: ^setup.py$|^setup.cfg$
pass_filenames: false
entry: ./scripts/ci/pre_commit/pre_commit_check_order_setup.py
additional_dependencies: ['rich']
- id: setup-extra-packages
name: Checks setup extra packages
description: Checks if all the libraries in setup.py are listed in extra-packages-ref.rst file
Expand Down Expand Up @@ -482,6 +483,7 @@ repos:
files: "setup.py|^airflow/providers/.*.py"
pass_filenames: false
require_serial: true
additional_dependencies: ['rich']
- id: markdownlint
name: Run markdownlint
description: "Checks the style of Markdown files."
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,17 @@ This is the full list of those extras:

.. START EXTRAS HERE
all_dbs, amazon, apache.atlas, apache.beam, apache.cassandra, apache.druid, apache.hdfs,
all, all_dbs, amazon, apache.atlas, apache.beam, apache.cassandra, apache.druid, apache.hdfs,
apache.hive, apache.kylin, apache.livy, apache.pig, apache.pinot, apache.spark, apache.sqoop,
apache.webhdfs, async, atlas, aws, azure, cassandra, celery, cgroups, cloudant, cncf.kubernetes,
crypto, dask, databricks, datadog, dingding, discord, docker, druid, elasticsearch, exasol,
facebook, ftp, gcp, gcp_api, github_enterprise, google, google_auth, grpc, hashicorp, hdfs, hive,
http, imap, jdbc, jenkins, jira, kerberos, kubernetes, ldap, microsoft.azure, microsoft.mssql,
microsoft.winrm, mongo, mssql, mysql, odbc, openfaas, opsgenie, oracle, pagerduty, papermill,
password, pinot, plexus, postgres, presto, qds, qubole, rabbitmq, redis, s3, salesforce, samba,
segment, sendgrid, sentry, sftp, singularity, slack, snowflake, spark, sqlite, ssh, statsd, tableau,
telegram, vertica, virtualenv, webhdfs, winrm, yandex, zendesk, all, devel, devel_hadoop, doc,
devel_all, devel_ci
crypto, dask, databricks, datadog, devel, devel_all, devel_ci, devel_hadoop, dingding, discord, doc,
docker, druid, elasticsearch, exasol, facebook, ftp, gcp, gcp_api, github_enterprise, google,
google_auth, grpc, hashicorp, hdfs, hive, http, imap, jdbc, jenkins, jira, kerberos, kubernetes,
ldap, microsoft.azure, microsoft.mssql, microsoft.winrm, mongo, mssql, mysql, odbc, openfaas,
opsgenie, oracle, pagerduty, papermill, password, pinot, plexus, postgres, presto, qds, qubole,
rabbitmq, redis, s3, salesforce, samba, segment, sendgrid, sentry, sftp, singularity, slack,
snowflake, spark, sqlite, ssh, statsd, tableau, telegram, vertica, virtualenv, webhdfs, winrm,
yandex, zendesk

.. END EXTRAS HERE
Expand Down
18 changes: 9 additions & 9 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ pip install -e . \
# You can also install Airflow with extras specified. The list of available extras:
# START EXTRAS HERE

all_dbs, amazon, apache.atlas, apache.beam, apache.cassandra, apache.druid, apache.hdfs,
all, all_dbs, amazon, apache.atlas, apache.beam, apache.cassandra, apache.druid, apache.hdfs,
apache.hive, apache.kylin, apache.livy, apache.pig, apache.pinot, apache.spark, apache.sqoop,
apache.webhdfs, async, atlas, aws, azure, cassandra, celery, cgroups, cloudant, cncf.kubernetes,
crypto, dask, databricks, datadog, dingding, discord, docker, druid, elasticsearch, exasol,
facebook, ftp, gcp, gcp_api, github_enterprise, google, google_auth, grpc, hashicorp, hdfs, hive,
http, imap, jdbc, jenkins, jira, kerberos, kubernetes, ldap, microsoft.azure, microsoft.mssql,
microsoft.winrm, mongo, mssql, mysql, odbc, openfaas, opsgenie, oracle, pagerduty, papermill,
password, pinot, plexus, postgres, presto, qds, qubole, rabbitmq, redis, s3, salesforce, samba,
segment, sendgrid, sentry, sftp, singularity, slack, snowflake, spark, sqlite, ssh, statsd, tableau,
telegram, vertica, virtualenv, webhdfs, winrm, yandex, zendesk, all, devel, devel_hadoop, doc,
devel_all, devel_ci
crypto, dask, databricks, datadog, devel, devel_all, devel_ci, devel_hadoop, dingding, discord, doc,
docker, druid, elasticsearch, exasol, facebook, ftp, gcp, gcp_api, github_enterprise, google,
google_auth, grpc, hashicorp, hdfs, hive, http, imap, jdbc, jenkins, jira, kerberos, kubernetes,
ldap, microsoft.azure, microsoft.mssql, microsoft.winrm, mongo, mssql, mysql, odbc, openfaas,
opsgenie, oracle, pagerduty, papermill, password, pinot, plexus, postgres, presto, qds, qubole,
rabbitmq, redis, s3, salesforce, samba, segment, sendgrid, sentry, sftp, singularity, slack,
snowflake, spark, sqlite, ssh, statsd, tableau, telegram, vertica, virtualenv, webhdfs, winrm,
yandex, zendesk

# END EXTRAS HERE

Expand Down
24 changes: 24 additions & 0 deletions airflow/providers/mysql/ADDITIONAL_INFO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Mysql client requirements

The version of MySQL server has to be 5.6.4+. The exact version upper bound depends
on the version of ``mysqlclient`` package. For example, ``mysqlclient`` 1.3.12 can only be
used with MySQL server 5.6.4 through 5.7.
13 changes: 7 additions & 6 deletions dev/provider_packages/prepare_provider_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# running the script
import tests.deprecated_classes # noqa # isort:skip
from dev.import_all_classes import import_all_classes # noqa # isort:skip
from setup import PROVIDERS_REQUIREMENTS # noqa # isort:skip
from setup import PROVIDERS_REQUIREMENTS, PREINSTALLED_PROVIDERS # noqa # isort:skip

# Note - we do not test protocols as they are not really part of the official API of
# Apache Airflow
Expand Down Expand Up @@ -287,8 +287,9 @@ def get_install_requirements(provider_package_id: str, backport_packages: bool)
else 'apache-airflow>=1.10.12, <2.0.0'
)
else:
airflow_dependency = 'apache-airflow>=2.0.0a0'
install_requires = [airflow_dependency]
airflow_dependency = 'apache-airflow>=2.0.0'
# Avoid circular dependency for the preinstalled packages
install_requires = [airflow_dependency] if provider_package_id not in PREINSTALLED_PROVIDERS else []
install_requires.extend(dependencies)
return install_requires

Expand Down Expand Up @@ -324,12 +325,12 @@ def get_package_extras(provider_package_id: str, backport_packages: bool) -> Dic
return extras_dict


def get_provider_packages():
def get_provider_packages() -> List[str]:
"""
Returns all provider packages.
"""
return list(PROVIDERS_REQUIREMENTS)
return list(PROVIDERS_REQUIREMENTS.keys())


def usage() -> None:
Expand Down Expand Up @@ -795,7 +796,7 @@ def convert_cross_package_dependencies_to_table(
"""
Converts cross-package dependencies to a markdown table
:param cross_package_dependencies: list of cross-package dependencies
:param base_url: base url to use for links
:param backport_packages: whether we are preparing backport packages
:return: markdown-formatted table
"""
from tabulate import tabulate
Expand Down
Loading

0 comments on commit 0d21457

Please sign in to comment.