apache-airflow-task-sdk 1.0.0b4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- apache_airflow_task_sdk-1.0.0b4/.gitignore +262 -0
- apache_airflow_task_sdk-1.0.0b4/PKG-INFO +41 -0
- apache_airflow_task_sdk-1.0.0b4/README.md +22 -0
- apache_airflow_task_sdk-1.0.0b4/dev/generate_models.py +96 -0
- apache_airflow_task_sdk-1.0.0b4/pyproject.toml +182 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/__init__.py +21 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/__init__.py +106 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/api/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/api/client.py +631 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/api/datamodels/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/api/datamodels/_generated.py +413 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/api/datamodels/activities.py +31 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/abstractoperator.py +499 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/contextmanager.py +138 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/dag_parsing_context.py +37 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/decorators.py +42 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/expandinput.py +278 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/mixins.py +142 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/node.py +221 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/templater.py +298 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/_internal/types.py +75 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/asset/__init__.py +645 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/asset/decorators.py +225 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/asset/metadata.py +36 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/baseoperator.py +1850 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/baseoperatorlink.py +66 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/connection.py +100 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/context.py +137 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/dag.py +1143 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/edges.py +189 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/macros.py +117 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/mappedoperator.py +837 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/param.py +352 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/taskgroup.py +691 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/template.py +32 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/variable.py +57 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/definitions/xcom_arg.py +626 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/exceptions.py +63 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/__init__.py +17 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/comms.py +457 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/context.py +458 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/execute_workload.py +90 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/lazy_sequence.py +188 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/secrets_masker.py +424 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/supervisor.py +1153 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/task_runner.py +931 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/execution_time/xcom.py +294 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/log.py +517 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/py.typed +18 -0
- apache_airflow_task_sdk-1.0.0b4/src/airflow/sdk/types.py +109 -0
- apache_airflow_task_sdk-1.0.0b4/tests/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/tests/conftest.py +408 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/__init__.py +45 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/api/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/api/test_client.py +814 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/dags/dag_parsing_context.py +36 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/dags/super_basic.py +29 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/dags/super_basic_deferred_run.py +37 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/dags/super_basic_run.py +37 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/_internal/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/_internal/test_templater.py +128 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/conftest.py +49 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_asset.py +414 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_asset_decorators.py +326 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_baseoperator.py +900 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_connections.py +150 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_context.py +41 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_dag.py +488 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_macros.py +143 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_mappedoperator.py +700 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_mixins.py +330 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_param.py +308 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_secrets_masker.py +484 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_template.py +43 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_variables.py +112 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/definitions/test_xcom_arg.py +361 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/execution_time/__init__.py +16 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/execution_time/conftest.py +33 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/execution_time/test_context.py +412 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/execution_time/test_supervisor.py +1408 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/execution_time/test_task_runner.py +2152 -0
- apache_airflow_task_sdk-1.0.0b4/tests/task_sdk/log/test_log.py +56 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Airflow configuration
|
|
2
|
+
airflow.cfg
|
|
3
|
+
airflow_login.py
|
|
4
|
+
dbinit.py
|
|
5
|
+
initdb.py
|
|
6
|
+
secrets.py
|
|
7
|
+
|
|
8
|
+
# Airflow sqlite databases
|
|
9
|
+
airflow.db
|
|
10
|
+
|
|
11
|
+
# Airflow temporary artifacts
|
|
12
|
+
airflow/git_version
|
|
13
|
+
airflow/ui/coverage/
|
|
14
|
+
logs/
|
|
15
|
+
airflow-webserver.pid
|
|
16
|
+
standalone_admin_password.txt
|
|
17
|
+
warnings.txt
|
|
18
|
+
warn-summary-*.txt
|
|
19
|
+
|
|
20
|
+
# Byte-compiled / optimized / DLL files
|
|
21
|
+
__pycache__/
|
|
22
|
+
*.py[cod]
|
|
23
|
+
*$py.class
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
|
|
26
|
+
# C extensions
|
|
27
|
+
*.so
|
|
28
|
+
|
|
29
|
+
# Distribution / packaging
|
|
30
|
+
.Python
|
|
31
|
+
env/
|
|
32
|
+
build/
|
|
33
|
+
develop-eggs/
|
|
34
|
+
dist/
|
|
35
|
+
!providers/fab/**/www/static/dist
|
|
36
|
+
downloads/
|
|
37
|
+
eggs/
|
|
38
|
+
.eggs/
|
|
39
|
+
lib/
|
|
40
|
+
lib64/
|
|
41
|
+
parts/
|
|
42
|
+
sdist/
|
|
43
|
+
var/
|
|
44
|
+
wheels/
|
|
45
|
+
*.egg-info/
|
|
46
|
+
.installed.cfg
|
|
47
|
+
*.egg
|
|
48
|
+
|
|
49
|
+
# PyInstaller
|
|
50
|
+
# Usually these files are written by a python script from a template
|
|
51
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
52
|
+
*.manifest
|
|
53
|
+
*.spec
|
|
54
|
+
|
|
55
|
+
# Installer logs
|
|
56
|
+
pip-log.txt
|
|
57
|
+
pip-delete-this-directory.txt
|
|
58
|
+
|
|
59
|
+
# Unit test / coverage reports
|
|
60
|
+
htmlcov/
|
|
61
|
+
.coverage
|
|
62
|
+
.coverage.*
|
|
63
|
+
.cache
|
|
64
|
+
nosetests.xml
|
|
65
|
+
coverage*.xml
|
|
66
|
+
*,cover
|
|
67
|
+
.hypothesis/
|
|
68
|
+
.pytest_cache
|
|
69
|
+
|
|
70
|
+
# Translations
|
|
71
|
+
*.mo
|
|
72
|
+
*.pot
|
|
73
|
+
|
|
74
|
+
# Django stuff:
|
|
75
|
+
# *.log
|
|
76
|
+
local_settings.py
|
|
77
|
+
|
|
78
|
+
# Flask stuff:
|
|
79
|
+
instance/
|
|
80
|
+
.webassets-cache
|
|
81
|
+
/webserver_config.py
|
|
82
|
+
|
|
83
|
+
# Scrapy stuff:
|
|
84
|
+
.scrapy
|
|
85
|
+
|
|
86
|
+
# Sphinx documentation
|
|
87
|
+
docs/_build/
|
|
88
|
+
docs/rtd-deprecation/_build/
|
|
89
|
+
docs/_doctrees/
|
|
90
|
+
docs/_inventory_cache/
|
|
91
|
+
docs/*/_api/
|
|
92
|
+
|
|
93
|
+
# PyBuilder
|
|
94
|
+
target/
|
|
95
|
+
|
|
96
|
+
# Jupyter Notebook
|
|
97
|
+
.ipynb_checkpoints
|
|
98
|
+
|
|
99
|
+
# pyenv
|
|
100
|
+
.python-version
|
|
101
|
+
|
|
102
|
+
# nvm (Node Version Manager)
|
|
103
|
+
.nvmrc
|
|
104
|
+
|
|
105
|
+
# celery beat schedule file
|
|
106
|
+
celerybeat-schedule
|
|
107
|
+
|
|
108
|
+
# SageMath parsed files
|
|
109
|
+
*.sage.py
|
|
110
|
+
|
|
111
|
+
# dotenv
|
|
112
|
+
.env
|
|
113
|
+
.env.local
|
|
114
|
+
.autoenv*.zsh
|
|
115
|
+
|
|
116
|
+
# virtualenv
|
|
117
|
+
.venv*
|
|
118
|
+
venv*
|
|
119
|
+
ENV/
|
|
120
|
+
|
|
121
|
+
# Spyder project settings
|
|
122
|
+
.spyderproject
|
|
123
|
+
|
|
124
|
+
# Rope project settings
|
|
125
|
+
.ropeproject
|
|
126
|
+
|
|
127
|
+
# PyCharm
|
|
128
|
+
.idea/
|
|
129
|
+
*.iml
|
|
130
|
+
|
|
131
|
+
# vim
|
|
132
|
+
*.swp
|
|
133
|
+
|
|
134
|
+
# Emacs
|
|
135
|
+
*~
|
|
136
|
+
\#*\#
|
|
137
|
+
/.emacs.desktop
|
|
138
|
+
/.emacs.desktop.lock
|
|
139
|
+
*.elc
|
|
140
|
+
auto-save-list
|
|
141
|
+
tramp
|
|
142
|
+
.\#*
|
|
143
|
+
|
|
144
|
+
# OSX
|
|
145
|
+
.DS_Store
|
|
146
|
+
|
|
147
|
+
# SQL Server backups
|
|
148
|
+
*.bkp
|
|
149
|
+
|
|
150
|
+
# Spark
|
|
151
|
+
rat-results.txt
|
|
152
|
+
|
|
153
|
+
# Git stuff
|
|
154
|
+
# Kubernetes generated templated files
|
|
155
|
+
*.generated
|
|
156
|
+
*.tar.gz
|
|
157
|
+
scripts/ci/kubernetes/kube/.generated/airflow.yaml
|
|
158
|
+
scripts/ci/kubernetes/docker/requirements.txt
|
|
159
|
+
|
|
160
|
+
# Node & Webpack Stuff
|
|
161
|
+
*.entry.js
|
|
162
|
+
node_modules
|
|
163
|
+
npm-debug.log*
|
|
164
|
+
derby.log
|
|
165
|
+
metastore_db
|
|
166
|
+
npm-debug.log*
|
|
167
|
+
yarn-debug.log*
|
|
168
|
+
yarn-error.log*
|
|
169
|
+
pnpm-debug.log*
|
|
170
|
+
.vscode/*
|
|
171
|
+
!.vscode/extensions.json
|
|
172
|
+
/.vite/
|
|
173
|
+
airflow/ui/.vite/
|
|
174
|
+
.pnpm-store
|
|
175
|
+
*.tsbuildinfo
|
|
176
|
+
|
|
177
|
+
# Airflow log files when airflow is run locally
|
|
178
|
+
airflow-*.err
|
|
179
|
+
airflow-*.out
|
|
180
|
+
airflow-*.log
|
|
181
|
+
airflow-*.pid
|
|
182
|
+
.airflow_db_initialised
|
|
183
|
+
|
|
184
|
+
# mypy
|
|
185
|
+
.mypy_cache/
|
|
186
|
+
.dmypy.json
|
|
187
|
+
dmypy.json
|
|
188
|
+
|
|
189
|
+
# Needed for CI Dockerfile.ci build system
|
|
190
|
+
.build
|
|
191
|
+
/tmp
|
|
192
|
+
/files
|
|
193
|
+
|
|
194
|
+
/hive_scratch_dir/
|
|
195
|
+
/.bash_aliases
|
|
196
|
+
/.bash_history
|
|
197
|
+
/.kube
|
|
198
|
+
/.inputrc
|
|
199
|
+
log.txt*
|
|
200
|
+
|
|
201
|
+
# Provider-related ignores
|
|
202
|
+
/airflow/providers/__init__.py
|
|
203
|
+
|
|
204
|
+
# Docker context files
|
|
205
|
+
/docker-context-files/*
|
|
206
|
+
!/docker-context-files/.README.md
|
|
207
|
+
# Local .terraform directories
|
|
208
|
+
**/.terraform/*
|
|
209
|
+
|
|
210
|
+
# .tfstate files
|
|
211
|
+
*.tfstate
|
|
212
|
+
*.tfstate.*
|
|
213
|
+
|
|
214
|
+
# Terraform variables
|
|
215
|
+
*.tfvars
|
|
216
|
+
|
|
217
|
+
# Might be generated when you build wheels
|
|
218
|
+
pip-wheel-metadata
|
|
219
|
+
|
|
220
|
+
.pypirc
|
|
221
|
+
|
|
222
|
+
/.docs-venv
|
|
223
|
+
|
|
224
|
+
# Dev files
|
|
225
|
+
/dev/packages.txt
|
|
226
|
+
/dev/Dockerfile.pmc
|
|
227
|
+
|
|
228
|
+
# Generated UI licenses
|
|
229
|
+
3rd-party-licenses/LICENSES-ui.txt
|
|
230
|
+
licenses/LICENSES-ui.txt
|
|
231
|
+
|
|
232
|
+
# Packaged breeze on Windows
|
|
233
|
+
/breeze.exe
|
|
234
|
+
|
|
235
|
+
# Generated out dir
|
|
236
|
+
|
|
237
|
+
/out
|
|
238
|
+
|
|
239
|
+
# files generated by memray
|
|
240
|
+
*.py.*.html
|
|
241
|
+
*.py.*.bin
|
|
242
|
+
|
|
243
|
+
# used to checkout target-branch in CI
|
|
244
|
+
/target-airflow
|
|
245
|
+
|
|
246
|
+
# This directory used for generate provider packages before https://github.com/apache/airflow/pull/35617
|
|
247
|
+
/provider_packages/
|
|
248
|
+
|
|
249
|
+
# This directory used for store autogenerated images
|
|
250
|
+
/images
|
|
251
|
+
|
|
252
|
+
# Dask Executor tests generate this directory
|
|
253
|
+
/tests/executors/dask-worker-space/
|
|
254
|
+
|
|
255
|
+
# airflow-build-dockerfile and correconding ignore file
|
|
256
|
+
airflow-build-dockerfile*
|
|
257
|
+
|
|
258
|
+
# Temporary ignore uv.lock until we integrate it fully in our constraint preparation mechanism
|
|
259
|
+
/uv.lock
|
|
260
|
+
|
|
261
|
+
# Ignore zip files https://github.com/apache/airflow/issues/46449
|
|
262
|
+
*.zip
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: apache-airflow-task-sdk
|
|
3
|
+
Version: 1.0.0b4
|
|
4
|
+
Summary: Python Task SDK for Apache Airflow DAG Authors
|
|
5
|
+
Classifier: Framework :: Apache Airflow
|
|
6
|
+
Requires-Python: <3.13,>=3.9
|
|
7
|
+
Requires-Dist: attrs!=25.2.0,>=24.2.0
|
|
8
|
+
Requires-Dist: httpx>=0.27.0
|
|
9
|
+
Requires-Dist: jinja2>=3.1.4
|
|
10
|
+
Requires-Dist: methodtools>=0.4.7
|
|
11
|
+
Requires-Dist: msgspec>=0.19.0
|
|
12
|
+
Requires-Dist: pendulum<4.0,>=2.1.2; python_version < '3.12'
|
|
13
|
+
Requires-Dist: pendulum<4.0,>=3.0.0; python_version >= '3.12'
|
|
14
|
+
Requires-Dist: psutil>=6.1.0
|
|
15
|
+
Requires-Dist: python-dateutil>=2.7.0
|
|
16
|
+
Requires-Dist: retryhttp!=1.3.0,>=1.2.0
|
|
17
|
+
Requires-Dist: structlog>=25.2.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
<!--
|
|
21
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
22
|
+
or more contributor license agreements. See the NOTICE file
|
|
23
|
+
distributed with this work for additional information
|
|
24
|
+
regarding copyright ownership. The ASF licenses this file
|
|
25
|
+
to you under the Apache License, Version 2.0 (the
|
|
26
|
+
"License"); you may not use this file except in compliance
|
|
27
|
+
with the License. You may obtain a copy of the License at
|
|
28
|
+
|
|
29
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
|
|
31
|
+
Unless required by applicable law or agreed to in writing,
|
|
32
|
+
software distributed under the License is distributed on an
|
|
33
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
34
|
+
KIND, either express or implied. See the License for the
|
|
35
|
+
specific language governing permissions and limitations
|
|
36
|
+
under the License.
|
|
37
|
+
-->
|
|
38
|
+
|
|
39
|
+
# Apache Airflow Task SDK
|
|
40
|
+
|
|
41
|
+
The Apache Airflow Task SDK includes interfaces for DAG authors.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
# Apache Airflow Task SDK
|
|
21
|
+
|
|
22
|
+
The Apache Airflow Task SDK includes interfaces for DAG authors.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
import httpx
|
|
24
|
+
from datamodel_code_generator import (
|
|
25
|
+
DataModelType,
|
|
26
|
+
DatetimeClassType,
|
|
27
|
+
InputFileType,
|
|
28
|
+
LiteralType,
|
|
29
|
+
PythonVersion,
|
|
30
|
+
generate as generate_models,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
os.environ["_AIRFLOW__AS_LIBRARY"] = "1"
|
|
34
|
+
sys.path.insert(
|
|
35
|
+
0,
|
|
36
|
+
str(Path(__file__).parents[2].joinpath("scripts", "ci", "pre_commit").resolve()),
|
|
37
|
+
) # make sure common utils are importable
|
|
38
|
+
|
|
39
|
+
from common_precommit_utils import (
|
|
40
|
+
AIRFLOW_SOURCES_ROOT_PATH,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
sys.path.insert(0, str(AIRFLOW_SOURCES_ROOT_PATH)) # make sure setup is imported from Airflow
|
|
44
|
+
|
|
45
|
+
from airflow.api_fastapi.execution_api.app import InProcessExecutionAPI
|
|
46
|
+
|
|
47
|
+
task_sdk_root = Path(__file__).parents[1]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def load_config():
|
|
51
|
+
try:
|
|
52
|
+
from tomllib import load as load_tomllib
|
|
53
|
+
except ImportError:
|
|
54
|
+
from tomli import load as load_tomllib
|
|
55
|
+
|
|
56
|
+
pyproject = task_sdk_root / "pyproject.toml"
|
|
57
|
+
# Simulate what `datamodel-code-generator` does on the CLI
|
|
58
|
+
with pyproject.open("rb") as fh:
|
|
59
|
+
cfg = load_tomllib(fh)["tool"]["datamodel-codegen"]
|
|
60
|
+
|
|
61
|
+
cfg = {k.replace("-", "_"): v for k, v in cfg.items()}
|
|
62
|
+
|
|
63
|
+
# Translate config file option names to generate() kwarg names
|
|
64
|
+
if (use_default := cfg.pop("use_default", None)) is not None:
|
|
65
|
+
cfg["apply_default_values_for_required_fields"] = use_default
|
|
66
|
+
|
|
67
|
+
if cfg.get("use_annotated"):
|
|
68
|
+
cfg["field_constraints"] = True
|
|
69
|
+
|
|
70
|
+
cfg["output"] = Path(cfg["output"])
|
|
71
|
+
cfg["output_model_type"] = DataModelType(cfg["output_model_type"])
|
|
72
|
+
cfg["output_datetime_class"] = DatetimeClassType(cfg["output_datetime_class"])
|
|
73
|
+
cfg["input_file_type"] = InputFileType(cfg["input_file_type"])
|
|
74
|
+
cfg["target_python_version"] = PythonVersion(cfg["target_python_version"])
|
|
75
|
+
cfg["enum_field_as_literal"] = LiteralType(cfg["enum_field_as_literal"])
|
|
76
|
+
return cfg
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def generate_file():
|
|
80
|
+
app = InProcessExecutionAPI()
|
|
81
|
+
|
|
82
|
+
latest_version = app.app.versions.version_values[-1]
|
|
83
|
+
client = httpx.Client(transport=app.transport)
|
|
84
|
+
openapi_schema = (
|
|
85
|
+
client.get(f"http://localhost/openapi.json?version={latest_version}").raise_for_status().text
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
os.chdir(task_sdk_root)
|
|
89
|
+
|
|
90
|
+
args = load_config()
|
|
91
|
+
args["input_filename"] = args.pop("url")
|
|
92
|
+
args["custom_formatters_kwargs"] = {"api_version": latest_version}
|
|
93
|
+
generate_models(openapi_schema, **args)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
generate_file()
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
[project]
|
|
19
|
+
name = "apache-airflow-task-sdk"
|
|
20
|
+
dynamic = ["version"]
|
|
21
|
+
description = "Python Task SDK for Apache Airflow DAG Authors"
|
|
22
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
23
|
+
requires-python = ">=3.9, <3.13"
|
|
24
|
+
dependencies = [
|
|
25
|
+
"attrs>=24.2.0, !=25.2.0",
|
|
26
|
+
"httpx>=0.27.0",
|
|
27
|
+
"jinja2>=3.1.4",
|
|
28
|
+
"methodtools>=0.4.7",
|
|
29
|
+
"msgspec>=0.19.0",
|
|
30
|
+
'pendulum>=2.1.2,<4.0;python_version<"3.12"',
|
|
31
|
+
'pendulum>=3.0.0,<4.0;python_version>="3.12"',
|
|
32
|
+
"python-dateutil>=2.7.0",
|
|
33
|
+
"psutil>=6.1.0",
|
|
34
|
+
"structlog>=25.2.0",
|
|
35
|
+
"retryhttp>=1.2.0,!=1.3.0",
|
|
36
|
+
]
|
|
37
|
+
classifiers = [
|
|
38
|
+
"Framework :: Apache Airflow",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["hatchling"]
|
|
43
|
+
build-backend = "hatchling.build"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.version]
|
|
46
|
+
path = "src/airflow/sdk/__init__.py"
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/airflow"]
|
|
50
|
+
# This file only exists to make pyright/VSCode happy, don't ship it
|
|
51
|
+
exclude = ["src/airflow/__init__.py"]
|
|
52
|
+
|
|
53
|
+
[tool.ruff]
|
|
54
|
+
extend = "../pyproject.toml"
|
|
55
|
+
src = ["src"]
|
|
56
|
+
namespace-packages = ["src/airflow"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff.lint.per-file-ignores]
|
|
59
|
+
|
|
60
|
+
# Ignore Doc rules et al for anything outside of tests
|
|
61
|
+
"!src/*" = ["D", "TID253", "S101", "TRY002"]
|
|
62
|
+
|
|
63
|
+
# Ignore the pytest rules outside the tests folder - https://github.com/astral-sh/ruff/issues/14205
|
|
64
|
+
"!tests/*" = ["PT"]
|
|
65
|
+
|
|
66
|
+
# Pycharm barfs if this "stub" file has future imports
|
|
67
|
+
"src/airflow/__init__.py" = ["I002"]
|
|
68
|
+
|
|
69
|
+
"src/airflow/sdk/__init__.py" = ["TC004"]
|
|
70
|
+
|
|
71
|
+
# msgspec needs types for annotations to be defined, even with future
|
|
72
|
+
# annotations, so disable the "type check only import" for these files
|
|
73
|
+
"src/airflow/sdk/api/datamodels/*.py" = ["TC001"]
|
|
74
|
+
|
|
75
|
+
# Only the public API should _require_ docstrings on classes
|
|
76
|
+
"!src/airflow/sdk/definitions/*" = ["D101"]
|
|
77
|
+
|
|
78
|
+
# Generated file, be less strict
|
|
79
|
+
"src/airflow/sdk/*/_generated.py" = ["D"]
|
|
80
|
+
|
|
81
|
+
[tool.coverage.run]
|
|
82
|
+
branch = true
|
|
83
|
+
relative_files = true
|
|
84
|
+
source = ["src/airflow"]
|
|
85
|
+
include_namespace_packages = true
|
|
86
|
+
|
|
87
|
+
[tool.coverage.report]
|
|
88
|
+
skip_empty = true
|
|
89
|
+
exclude_also = [
|
|
90
|
+
"def __repr__",
|
|
91
|
+
"raise AssertionError",
|
|
92
|
+
"raise NotImplementedError",
|
|
93
|
+
"if __name__ == .__main__.:",
|
|
94
|
+
"@(abc\\.)?abstractmethod",
|
|
95
|
+
"@(typing(_extensions)?\\.)?overload",
|
|
96
|
+
"if (typing(_extensions)?\\.)?TYPE_CHECKING:",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
[dependency-groups]
|
|
100
|
+
codegen = [
|
|
101
|
+
"datamodel-code-generator[http]==0.28.2",
|
|
102
|
+
"apache-airflow",
|
|
103
|
+
"rich",
|
|
104
|
+
"ruff",
|
|
105
|
+
"svcs>=25.1.0",
|
|
106
|
+
]
|
|
107
|
+
dev = [
|
|
108
|
+
"apache-airflow",
|
|
109
|
+
"apache-airflow-providers-common-sql",
|
|
110
|
+
"apache-airflow-providers-standard",
|
|
111
|
+
"apache-airflow-devel-common",
|
|
112
|
+
]
|
|
113
|
+
[tool.uv.sources]
|
|
114
|
+
# These names must match the names as defined in the pyproject.toml of the workspace items,
|
|
115
|
+
# *not* the workspace folder paths
|
|
116
|
+
apache-airflow = {workspace = true}
|
|
117
|
+
apache-airflow-devel-common = {workspace = true}
|
|
118
|
+
apache-airflow-providers-common-sql = {workspace = true}
|
|
119
|
+
apache-airflow-providers-standard = {workspace = true}
|
|
120
|
+
|
|
121
|
+
# To use:
|
|
122
|
+
#
|
|
123
|
+
# uv run --group codegen --project apache-airflow-task-sdk --directory task_sdk datamodel-codegen
|
|
124
|
+
[tool.datamodel-codegen]
|
|
125
|
+
capitalise-enum-members=true # `State.RUNNING` not `State.running`
|
|
126
|
+
disable-timestamp=true
|
|
127
|
+
enable-version-header=true
|
|
128
|
+
enum-field-as-literal='one' # When a single enum member, make it output a `Literal["..."]`
|
|
129
|
+
input-file-type='openapi'
|
|
130
|
+
output-model-type='pydantic_v2.BaseModel'
|
|
131
|
+
output-datetime-class='datetime'
|
|
132
|
+
target-python-version='3.9'
|
|
133
|
+
use-annotated=true
|
|
134
|
+
use-default=true
|
|
135
|
+
use-double-quotes=true
|
|
136
|
+
use-schema-description=true # Desc becomes class doc comment
|
|
137
|
+
use-standard-collections=true # list[] not List[]
|
|
138
|
+
use-subclass-enum=true # enum, not union of Literals
|
|
139
|
+
use-union-operator=true # 3.9+annotations, not `Union[]`
|
|
140
|
+
custom-formatters = ['dev.datamodel_code_formatter',]
|
|
141
|
+
|
|
142
|
+
url = 'http://0.0.0.0:8080/execution/openapi.json'
|
|
143
|
+
output = 'src/airflow/sdk/api/datamodels/_generated.py'
|
|
144
|
+
|
|
145
|
+
## pytest settings ##
|
|
146
|
+
[tool.pytest.ini_options]
|
|
147
|
+
addopts = [
|
|
148
|
+
"--tb=short",
|
|
149
|
+
"-rasl",
|
|
150
|
+
"--verbosity=2",
|
|
151
|
+
# Disable `flaky` plugin for pytest. This plugin conflicts with `rerunfailures` because provide the same marker.
|
|
152
|
+
"-p", "no:flaky",
|
|
153
|
+
# Disable `nose` builtin plugin for pytest. This feature is deprecated in 7.2 and will be removed in pytest>=8
|
|
154
|
+
"-p", "no:nose",
|
|
155
|
+
# Disable support of a legacy `LocalPath` in favor of stdlib `pathlib.Path`.
|
|
156
|
+
"-p", "no:legacypath",
|
|
157
|
+
# Disable warnings summary, because we use our warning summary.
|
|
158
|
+
"--disable-warnings",
|
|
159
|
+
"--asyncio-mode=strict",
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
norecursedirs = [
|
|
163
|
+
".eggs",
|
|
164
|
+
]
|
|
165
|
+
log_level = "INFO"
|
|
166
|
+
filterwarnings = [
|
|
167
|
+
"error::pytest.PytestCollectionWarning",
|
|
168
|
+
"error::pytest.PytestReturnNotNoneWarning",
|
|
169
|
+
]
|
|
170
|
+
python_files = [
|
|
171
|
+
"test_*.py",
|
|
172
|
+
]
|
|
173
|
+
testpaths = [
|
|
174
|
+
"tests",
|
|
175
|
+
]
|
|
176
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
177
|
+
|
|
178
|
+
pythonpath = "tests"
|
|
179
|
+
|
|
180
|
+
# Keep temporary directories (created by `tmp_path`) for 2 recent runs only failed tests.
|
|
181
|
+
tmp_path_retention_count = "2"
|
|
182
|
+
tmp_path_retention_policy = "failed"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
|
4
|
+
# distributed with this work for additional information
|
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
|
7
|
+
# "License"); you may not use this file except in compliance
|
|
8
|
+
# with the License. You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
|
13
|
+
# software distributed under the License is distributed on an
|
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
# KIND, either express or implied. See the License for the
|
|
16
|
+
# specific language governing permissions and limitations
|
|
17
|
+
# under the License.
|
|
18
|
+
|
|
19
|
+
# Pycharm needs to see this line. VSCode/pyright doesn't care about it, but this file needs to exist
|
|
20
|
+
# https://github.com/microsoft/pyright/issues/9439#issuecomment-2468990559
|
|
21
|
+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
|