Skip to content

Commit 3730cba

Browse files
authored
Move some non-core dependencies to the apache-airflow meta package (apache#49846)
Some of the extras in `airflow-core` do not really belong there, they should be moved to the `apache-airflow` meta-package.
1 parent 9fb9ce0 commit 3730cba

File tree

3 files changed

+63
-84
lines changed

3 files changed

+63
-84
lines changed

airflow-core/pyproject.toml

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -146,35 +146,11 @@ dependencies = [
146146

147147

148148
[project.optional-dependencies]
149-
# Aiobotocore required for AWS deferrable operators.
150-
# There is conflict between boto3 and aiobotocore dependency botocore.
151-
# TODO: We can remove it once boto3 and aiobotocore both have compatible botocore version or
152-
# boto3 have native aync support and we move away from aio aiobotocore
153-
"aiobotocore" = [
154-
"apache-airflow-providers-amazon[aiobotocore]>=9.6.0",
155-
]
156149
"async" = [
157150
"eventlet>=0.37.0",
158151
"gevent>=24.2.1",
159152
"greenlet>=0.4.9",
160153
]
161-
"apache-atlas" = [
162-
"atlasclient>=0.1.2",
163-
]
164-
"apache-webhdfs" = [
165-
"apache-airflow-providers-apache-hdfs",
166-
]
167-
"cloudpickle" = [
168-
"cloudpickle>=2.2.1",
169-
]
170-
"github-enterprise" = [
171-
"apache-airflow-providers-fab",
172-
"authlib>=1.0.0",
173-
]
174-
"google-auth" = [
175-
"apache-airflow-providers-fab",
176-
"authlib>=1.0.0",
177-
]
178154
"graphviz" = [
179155
# The graphviz package creates friction when installing on MacOS as it needs graphviz system package to
180156
# be installed, and it's really only used for very obscure features of Airflow, so we can skip it on MacOS
@@ -186,27 +162,9 @@ dependencies = [
186162
"requests-kerberos>=0.14.0",
187163
"thrift-sasl>=0.4.2",
188164
]
189-
"ldap" = [
190-
"python-ldap>=3.4.4",
191-
]
192165
"otel" = [
193166
"opentelemetry-exporter-prometheus>=0.47b0",
194167
]
195-
196-
"pandas" = [
197-
# In pandas 2.2 minimal version of the sqlalchemy is 2.0
198-
# https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#increased-minimum-versions-for-dependencies
199-
# However Airflow not fully supports it yet: https://github.com/apache/airflow/issues/28723
200-
"pandas>=2.1.2,<2.3",
201-
]
202-
"rabbitmq" = [
203-
"amqp>=5.2.0",
204-
]
205-
"s3fs" = [
206-
# This is required for support of S3 file system which uses aiobotocore
207-
# which can have a conflict with boto3 as mentioned in aiobotocore extra
208-
"apache-airflow-providers-amazon[s3fs]",
209-
]
210168
"sentry" = [
211169
"blinker>=1.1",
212170
# Sentry SDK 1.33 is broken when greenlets are installed and fails to import
@@ -216,11 +174,8 @@ dependencies = [
216174
"statsd" = [
217175
"statsd>=3.3.0",
218176
]
219-
"uv" = [
220-
"uv>=0.6.17",
221-
]
222177
"all" = [
223-
"apache-airflow-core[aiobotocore,apache-atlas,apache-webhdfs,cloudpickle,github-enterprise,google-auth,graphviz,kerberos,ldap,otel,pandas,rabbitmq,s3fs,sentry,statsd,uv]"
178+
"apache-airflow-core[graphviz,kerberos,otel,sentry,statsd]"
224179
]
225180

226181
[project.scripts]
@@ -281,11 +236,14 @@ dev = [
281236
"apache-airflow-ctl",
282237
"apache-airflow-devel-common",
283238
"apache-airflow-task-sdk",
239+
# TODO(potiuk): eventually we do not want any providers nor apache-airflow extras to be needed for
240+
# airflow-core tests
241+
"apache-airflow[pandas]",
284242
"apache-airflow-providers-amazon",
285243
"apache-airflow-providers-celery",
286244
"apache-airflow-providers-cncf-kubernetes",
245+
"apache-airflow-providers-fab",
287246
"apache-airflow-providers-git",
288-
# TODO(potiuk): check if this is really needed
289247
"apache-airflow-providers-ftp",
290248
]
291249

pyproject.toml

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,60 +70,27 @@ packages = []
7070

7171
[project.optional-dependencies]
7272
# Automatically generated airflow optional dependencies
73-
"aiobotocore" = [
74-
"apache-airflow-core[aiobotocore]"
75-
]
7673
"all-core" = [
7774
"apache-airflow-core[all]"
7875
]
79-
"apache-atlas" = [
80-
"apache-airflow-core[apache-atlas]"
81-
]
82-
"apache-webhdfs" = [
83-
"apache-airflow-core[apache-webhdfs]"
84-
]
8576
"async" = [
8677
"apache-airflow-core[async]"
8778
]
88-
"cloudpickle" = [
89-
"apache-airflow-core[cloudpickle]"
90-
]
91-
"github-enterprise" = [
92-
"apache-airflow-core[github-enterprise]"
93-
]
94-
"google-auth" = [
95-
"apache-airflow-core[google-auth]"
96-
]
9779
"graphviz" = [
9880
"apache-airflow-core[graphviz]"
9981
]
10082
"kerberos" = [
10183
"apache-airflow-core[kerberos]"
10284
]
103-
"ldap" = [
104-
"apache-airflow-core[ldap]"
105-
]
10685
"otel" = [
10786
"apache-airflow-core[otel]"
10887
]
109-
"pandas" = [
110-
"apache-airflow-core[pandas]"
111-
]
112-
"rabbitmq" = [
113-
"apache-airflow-core[rabbitmq]"
114-
]
115-
"s3fs" = [
116-
"apache-airflow-core[s3fs]"
117-
]
11888
"sentry" = [
11989
"apache-airflow-core[sentry]"
12090
]
12191
"statsd" = [
12292
"apache-airflow-core[statsd]"
12393
]
124-
"uv" = [
125-
"apache-airflow-core[uv]"
126-
]
12794
"airbyte" = [
12895
"apache-airflow-providers-airbyte>=5.0.0"
12996
]
@@ -413,6 +380,7 @@ packages = []
413380
"apache-airflow-providers-zendesk>=4.9.0"
414381
]
415382
"all" = [
383+
"apache-airflow[aiobotocore,apache-atlas,apache-webhdfs,async,cloudpickle,github-enterprise,google-auth,graphviz,kerberos,ldap,otel,pandas,rabbitmq,s3fs,sentry,statsd,uv]",
416384
"apache-airflow-core[all]",
417385
"apache-airflow-providers-airbyte>=5.0.0",
418386
"apache-airflow-providers-alibaba>=3.0.0",
@@ -512,6 +480,51 @@ packages = []
512480
"apache-airflow-providers-zendesk>=4.9.0",
513481
]
514482
# End of automatically generated airflow optional dependencies
483+
# Aiobotocore required for AWS deferrable operators.
484+
# There is conflict between boto3 and aiobotocore dependency botocore.
485+
# TODO: We can remove it once boto3 and aiobotocore both have compatible botocore version or
486+
# boto3 have native aync support and we move away from aio aiobotocore
487+
"aiobotocore" = [
488+
"apache-airflow-providers-amazon[aiobotocore]>=9.6.0",
489+
]
490+
"apache-atlas" = [
491+
"atlasclient>=0.1.2",
492+
]
493+
"apache-webhdfs" = [
494+
"apache-airflow-providers-apache-hdfs",
495+
]
496+
"cloudpickle" = [
497+
"cloudpickle>=2.2.1",
498+
]
499+
"github-enterprise" = [
500+
"apache-airflow-providers-fab",
501+
"authlib>=1.0.0",
502+
]
503+
"google-auth" = [
504+
"apache-airflow-providers-fab",
505+
"authlib>=1.0.0",
506+
]
507+
"ldap" = [
508+
"python-ldap>=3.4.4",
509+
]
510+
"pandas" = [
511+
# In pandas 2.2 minimal version of the sqlalchemy is 2.0
512+
# https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#increased-minimum-versions-for-dependencies
513+
# However Airflow not fully supports it yet: https://github.com/apache/airflow/issues/28723
514+
"pandas>=2.1.2,<2.3",
515+
]
516+
"rabbitmq" = [
517+
"amqp>=5.2.0",
518+
]
519+
"s3fs" = [
520+
# This is required for support of S3 file system which uses aiobotocore
521+
# which can have a conflict with boto3 as mentioned in aiobotocore extra
522+
"apache-airflow-providers-amazon[s3fs]",
523+
]
524+
"uv" = [
525+
"uv>=0.6.17",
526+
]
527+
515528

516529
[project.urls]
517530
"Bug Tracker" = "https://github.com/apache/airflow/issues"

scripts/ci/pre_commit/update_airflow_pyproject_toml.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@
6363
}
6464

6565

66-
def get_optional_dependencies_from_airflow_core() -> list[str]:
66+
def get_optional_dependencies(pyproject_toml_path: Path) -> list[str]:
6767
try:
6868
import tomllib
6969
except ImportError:
7070
import tomli as tomllib
71-
airflow_core_toml_dict = tomllib.loads(AIRFLOW_CORE_PYPROJECT_TOML_FILE.read_text())
71+
airflow_core_toml_dict = tomllib.loads(pyproject_toml_path.read_text())
7272
return airflow_core_toml_dict["project"]["optional-dependencies"].keys()
7373

7474

@@ -131,7 +131,7 @@ def find_min_provider_version(provider_id: str) -> Version | None:
131131

132132
if __name__ == "__main__":
133133
all_optional_dependencies = []
134-
optional_airflow_core_dependencies = get_optional_dependencies_from_airflow_core()
134+
optional_airflow_core_dependencies = get_optional_dependencies(AIRFLOW_CORE_PYPROJECT_TOML_FILE)
135135
for optional in sorted(optional_airflow_core_dependencies):
136136
if optional == "all":
137137
all_optional_dependencies.append('"all-core" = [\n "apache-airflow-core[all]"\n]\n')
@@ -150,7 +150,15 @@ def find_min_provider_version(provider_id: str) -> Version | None:
150150
else:
151151
all_optional_dependencies.append(f'"{provider_id}" = [\n "{distribution_name}"\n]\n')
152152
all_provider_lines.append(f' "{distribution_name}",\n')
153-
all_optional_dependencies.append('"all" = [\n "apache-airflow-core[all]",\n')
153+
all_optional_dependencies.append('"all" = [\n')
154+
optional_apache_airflow_dependencies = get_optional_dependencies(AIRFLOW_PYPROJECT_TOML_FILE)
155+
all_local_extras = [
156+
extra
157+
for extra in sorted(optional_apache_airflow_dependencies)
158+
if extra not in all_providers and not extra.startswith("all")
159+
]
160+
all_optional_dependencies.append(f' "apache-airflow[{",".join(all_local_extras)}]",\n')
161+
all_optional_dependencies.append(' "apache-airflow-core[all]",\n')
154162
all_optional_dependencies.extend(all_provider_lines)
155163
all_optional_dependencies.append("]\n")
156164
insert_documentation(

0 commit comments

Comments
 (0)