Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated provider aliases #15465

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from distutils import log
from os.path import dirname, relpath
from textwrap import wrap
from typing import Dict, List, Tuple
from typing import Dict, List

from setuptools import Command, Distribution, find_namespace_packages, setup
from setuptools.command.develop import develop as develop_orig
Expand Down Expand Up @@ -669,17 +669,10 @@ def add_additional_extras() -> None:
'winrm': 'microsoft.winrm',
}


def find_requirements_for_alias(alias_to_look_for: Tuple[str, str]) -> List[str]:
"""Finds requirements for an alias"""
deprecated_extra = alias_to_look_for[0]
new_extra = alias_to_look_for[1]
if new_extra == '': # Handle case for crypto
return []
try:
return EXTRAS_REQUIREMENTS[new_extra]
except KeyError: # noqa
raise Exception(f"The extra {new_extra} is missing for alias {deprecated_extra}")
EXTRAS_DEPRECATED_ALIASES_NOT_PROVIDERS: List[str] = [
"crypto",
"webhdfs",
]


def add_extras_for_all_deprecated_aliases() -> None:
Expand All @@ -696,6 +689,20 @@ def add_extras_for_all_deprecated_aliases() -> None:
EXTRAS_REQUIREMENTS[alias] = requirements


def add_all_deprecated_provider_packages() -> None:
"""
For deprecated aliases that are providers, we will swap the providers requirements to instead
be the provider itself.

e.g. {"kubernetes": ["kubernetes>=3.0.0, <12.0.0", ...]} becomes
{"kubernetes": ["apache-airflow-provider-cncf-kubernetes"]}
"""
for alias, provider in EXTRAS_DEPRECATED_ALIASES.items():
if alias in EXTRAS_DEPRECATED_ALIASES_NOT_PROVIDERS:
continue
replace_extra_requirement_with_provider_packages(alias, [provider])


add_extras_for_all_deprecated_aliases()

#############################################################################################################
Expand Down Expand Up @@ -939,6 +946,7 @@ def add_all_provider_packages() -> None:
add_provider_packages_to_extra_requirements(
"devel_hadoop", ["apache.hdfs", "apache.hive", "presto", "trino"]
)
add_all_deprecated_provider_packages()


class Develop(develop_orig):
Expand Down