airflow-provider-anakin 0.2.0__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.
- airflow_provider_anakin-0.2.0/.github/workflows/ci.yml +95 -0
- airflow_provider_anakin-0.2.0/.github/workflows/publish.yml +97 -0
- airflow_provider_anakin-0.2.0/.gitignore +15 -0
- airflow_provider_anakin-0.2.0/CHANGELOG.md +18 -0
- airflow_provider_anakin-0.2.0/LICENSE +202 -0
- airflow_provider_anakin-0.2.0/PKG-INFO +224 -0
- airflow_provider_anakin-0.2.0/README.md +193 -0
- airflow_provider_anakin-0.2.0/anakin_provider/__init__.py +75 -0
- airflow_provider_anakin-0.2.0/anakin_provider/hooks/__init__.py +3 -0
- airflow_provider_anakin-0.2.0/anakin_provider/hooks/anakin.py +444 -0
- airflow_provider_anakin-0.2.0/anakin_provider/operators/__init__.py +3 -0
- airflow_provider_anakin-0.2.0/anakin_provider/operators/anakin.py +1185 -0
- airflow_provider_anakin-0.2.0/example_dags/example_anakin.py +46 -0
- airflow_provider_anakin-0.2.0/example_dags/example_anakin_advanced.py +180 -0
- airflow_provider_anakin-0.2.0/pyproject.toml +76 -0
- airflow_provider_anakin-0.2.0/tests/__init__.py +0 -0
- airflow_provider_anakin-0.2.0/tests/test_hooks.py +379 -0
- airflow_provider_anakin-0.2.0/tests/test_operators.py +489 -0
- airflow_provider_anakin-0.2.0/tests/test_provider_info.py +40 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ci-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint:
|
|
17
|
+
name: Lint and type check
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 15
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: astral-sh/setup-uv@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- name: Install
|
|
26
|
+
run: |
|
|
27
|
+
uv venv
|
|
28
|
+
uv pip install -e . --group test --group lint
|
|
29
|
+
- run: uv run --no-sync ruff check .
|
|
30
|
+
- run: uv run --no-sync ruff format --check .
|
|
31
|
+
- run: uv run --no-sync mypy anakin_provider
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
name: Airflow ${{ matrix.airflow }} / Python ${{ matrix.python }}
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
timeout-minutes: 20
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
include:
|
|
41
|
+
- { airflow: "2.10.5", python: "3.10" }
|
|
42
|
+
- { airflow: "2.10.5", python: "3.12" }
|
|
43
|
+
- { airflow: "3.3.2", python: "3.10" }
|
|
44
|
+
- { airflow: "3.3.2", python: "3.13" }
|
|
45
|
+
env:
|
|
46
|
+
AIRFLOW_HOME: ${{ github.workspace }}/.airflow
|
|
47
|
+
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: astral-sh/setup-uv@v6
|
|
51
|
+
with:
|
|
52
|
+
python-version: ${{ matrix.python }}
|
|
53
|
+
- name: Install Airflow ${{ matrix.airflow }} with its constraints
|
|
54
|
+
run: |
|
|
55
|
+
uv venv
|
|
56
|
+
uv pip install "apache-airflow==${{ matrix.airflow }}" \
|
|
57
|
+
-c "https://raw.githubusercontent.com/apache/airflow/constraints-${{ matrix.airflow }}/constraints-${{ matrix.python }}.txt"
|
|
58
|
+
uv pip install -e . --group test
|
|
59
|
+
- name: Test
|
|
60
|
+
run: uv run --no-sync pytest
|
|
61
|
+
- name: Provider is discovered and example DAGs import
|
|
62
|
+
run: |
|
|
63
|
+
uv run --no-sync airflow providers get airflow-provider-anakin
|
|
64
|
+
uv run --no-sync python -c "
|
|
65
|
+
from airflow.models.dagbag import DagBag
|
|
66
|
+
bag = DagBag('example_dags')
|
|
67
|
+
assert not bag.import_errors, bag.import_errors
|
|
68
|
+
assert {'example_anakin', 'example_anakin_advanced'} <= set(bag.dags), bag.dags
|
|
69
|
+
"
|
|
70
|
+
|
|
71
|
+
build:
|
|
72
|
+
name: Build and install
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
timeout-minutes: 15
|
|
75
|
+
steps:
|
|
76
|
+
- uses: actions/checkout@v4
|
|
77
|
+
- uses: astral-sh/setup-uv@v6
|
|
78
|
+
with:
|
|
79
|
+
python-version: "3.12"
|
|
80
|
+
- run: uv build --out-dir dist
|
|
81
|
+
- run: uvx twine check --strict dist/*
|
|
82
|
+
- name: Install the wheel
|
|
83
|
+
run: |
|
|
84
|
+
uv venv /tmp/smoke
|
|
85
|
+
uv pip install --python /tmp/smoke dist/*.whl
|
|
86
|
+
/tmp/smoke/bin/python -c "
|
|
87
|
+
import anakin_provider.operators.anakin as ops
|
|
88
|
+
names = [n for n in dir(ops) if n.startswith('Anakin') and n.endswith('Operator')]
|
|
89
|
+
assert len(names) == 22, names
|
|
90
|
+
"
|
|
91
|
+
- uses: actions/upload-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: dist
|
|
94
|
+
path: dist/
|
|
95
|
+
retention-days: 7
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Release by pushing a tag: v0.2.0 publishes airflow-provider-anakin 0.2.0.
|
|
4
|
+
# The tag must match the version in pyproject.toml.
|
|
5
|
+
#
|
|
6
|
+
# Uses PyPI trusted publishing (no API token). Before the first release, add
|
|
7
|
+
# a pending publisher on your PyPI account (Publishing -> Add a new pending
|
|
8
|
+
# publisher): project airflow-provider-anakin, owner Anakin-Inc, repository
|
|
9
|
+
# airflow-provider-anakin, workflow publish.yml, environment pypi.
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
push:
|
|
13
|
+
tags:
|
|
14
|
+
- "v[0-9]+.[0-9]+.[0-9]+*"
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
inputs:
|
|
17
|
+
target:
|
|
18
|
+
description: Where to publish
|
|
19
|
+
required: true
|
|
20
|
+
type: choice
|
|
21
|
+
default: testpypi
|
|
22
|
+
options:
|
|
23
|
+
- testpypi
|
|
24
|
+
- pypi
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
build:
|
|
31
|
+
name: Test and build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
timeout-minutes: 20
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
- uses: astral-sh/setup-uv@v6
|
|
37
|
+
with:
|
|
38
|
+
python-version: "3.12"
|
|
39
|
+
- name: Check the tag matches the version
|
|
40
|
+
if: github.event_name == 'push'
|
|
41
|
+
env:
|
|
42
|
+
REF_NAME: ${{ github.ref_name }}
|
|
43
|
+
run: |
|
|
44
|
+
version=$(uv version --short)
|
|
45
|
+
if [ "${REF_NAME#v}" != "$version" ]; then
|
|
46
|
+
echo "Tag $REF_NAME doesn't match version $version" >&2
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
- name: Test
|
|
50
|
+
run: |
|
|
51
|
+
uv venv
|
|
52
|
+
uv pip install -e . --group test
|
|
53
|
+
uv run --no-sync pytest
|
|
54
|
+
- run: uv build --out-dir dist
|
|
55
|
+
- run: uvx twine check --strict dist/*
|
|
56
|
+
- uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
publish-testpypi:
|
|
62
|
+
name: Publish to TestPyPI
|
|
63
|
+
needs: build
|
|
64
|
+
if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
timeout-minutes: 10
|
|
67
|
+
environment:
|
|
68
|
+
name: testpypi
|
|
69
|
+
url: https://test.pypi.org/p/airflow-provider-anakin
|
|
70
|
+
permissions:
|
|
71
|
+
id-token: write
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/download-artifact@v4
|
|
74
|
+
with:
|
|
75
|
+
name: dist
|
|
76
|
+
path: dist/
|
|
77
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
78
|
+
with:
|
|
79
|
+
repository-url: https://test.pypi.org/legacy/
|
|
80
|
+
|
|
81
|
+
publish-pypi:
|
|
82
|
+
name: Publish to PyPI
|
|
83
|
+
needs: build
|
|
84
|
+
if: github.event_name == 'push' || inputs.target == 'pypi'
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
timeout-minutes: 10
|
|
87
|
+
environment:
|
|
88
|
+
name: pypi
|
|
89
|
+
url: https://pypi.org/p/airflow-provider-anakin
|
|
90
|
+
permissions:
|
|
91
|
+
id-token: write
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/download-artifact@v4
|
|
94
|
+
with:
|
|
95
|
+
name: dist
|
|
96
|
+
path: dist/
|
|
97
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
First release on PyPI.
|
|
6
|
+
|
|
7
|
+
- 22 operators covering the Anakin API: scrape, search, map, crawl, agentic
|
|
8
|
+
search; Wire discover, catalog, read and write actions, identities, login,
|
|
9
|
+
build and build status; website monitors (create, list, changes, control);
|
|
10
|
+
AI visibility search and sources; browser sessions and AI browser tasks.
|
|
11
|
+
- `AnakinHook` and the `anakin` connection type, with connection form
|
|
12
|
+
metadata for both the Airflow 2 and Airflow 3 UIs.
|
|
13
|
+
- Built on `anakin-sdk` 0.2. Wire actions accept `credential_id` and
|
|
14
|
+
`identity_id`, so actions that need a login work.
|
|
15
|
+
- Wire action input is `action_params` and Wire login input is
|
|
16
|
+
`login_params`, because `params` is reserved by Airflow.
|
|
17
|
+
- Every operator returns JSON-safe data for the default XCom backend.
|
|
18
|
+
- Supports Apache Airflow 2.10+ and 3.x on Python 3.10 to 3.13.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: airflow-provider-anakin
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Apache Airflow provider for Anakin: scrape, crawl, search, Wire site actions, website monitors and AI browser tasks from your DAGs
|
|
5
|
+
Project-URL: Homepage, https://anakin.io
|
|
6
|
+
Project-URL: Documentation, https://anakin.io/docs/integrations/workflow/airflow
|
|
7
|
+
Project-URL: Repository, https://github.com/Anakin-Inc/airflow-provider-anakin
|
|
8
|
+
Project-URL: Issues, https://github.com/Anakin-Inc/airflow-provider-anakin/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Anakin-Inc/airflow-provider-anakin/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Anakin <support@anakin.io>
|
|
11
|
+
License: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: airflow,airflow-provider,anakin,crawler,web-data,web-scraping
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Framework :: Apache Airflow
|
|
16
|
+
Classifier: Framework :: Apache Airflow :: Provider
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
25
|
+
Classifier: Topic :: System :: Monitoring
|
|
26
|
+
Requires-Python: <4.0,>=3.10
|
|
27
|
+
Requires-Dist: anakin-sdk<0.3.0,>=0.2.0
|
|
28
|
+
Requires-Dist: apache-airflow>=2.10.0
|
|
29
|
+
Requires-Dist: httpx>=0.27
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# airflow-provider-anakin
|
|
33
|
+
|
|
34
|
+
An [Apache Airflow](https://airflow.apache.org) provider for
|
|
35
|
+
[Anakin](https://anakin.io). Scrape pages, map and crawl sites, run web
|
|
36
|
+
search and multi-step research, run Wire actions on sites like Amazon or
|
|
37
|
+
Walmart, create website monitors, and drive an AI browser, all as Airflow
|
|
38
|
+
tasks. Each operator returns JSON-safe results to XCom.
|
|
39
|
+
|
|
40
|
+
Built on the official [`anakin-sdk`](https://pypi.org/project/anakin-sdk/)
|
|
41
|
+
Python client, which handles authentication, retries and job polling.
|
|
42
|
+
|
|
43
|
+
| | |
|
|
44
|
+
|---|---|
|
|
45
|
+
| **Operators** | 22 (parity with the [Anakin MCP server](https://anakin.io/docs/integrations/ai-agents/mcp-server)) |
|
|
46
|
+
| **Hook / connection type** | `AnakinHook` / `anakin` |
|
|
47
|
+
| **Requires** | Python 3.10+, Apache Airflow 2.10+ or 3.x |
|
|
48
|
+
| **License** | Apache-2.0 |
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install airflow-provider-anakin
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Airflow discovers the provider automatically. Check with:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
airflow providers get airflow-provider-anakin
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Connection
|
|
63
|
+
|
|
64
|
+
Get an API key (starts with `ask_`) from the
|
|
65
|
+
[Anakin dashboard](https://anakin.io/dashboard). Sign-up is free and
|
|
66
|
+
includes 300 credits.
|
|
67
|
+
|
|
68
|
+
Create a connection with conn type **Anakin**:
|
|
69
|
+
|
|
70
|
+
- **Connection Id**: `anakin_default` (the default every operator uses; pass
|
|
71
|
+
`anakin_conn_id=...` to use another)
|
|
72
|
+
- **API Key** (password field): your Anakin API key
|
|
73
|
+
- **Base URL** (optional extra): only for non-production environments
|
|
74
|
+
|
|
75
|
+
Or from the CLI:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
airflow connections add anakin_default --conn-type anakin --conn-password "ask_..."
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If no connection exists, the hook falls back to the `ANAKIN_API_KEY`
|
|
82
|
+
environment variable. The connection's **Test** button checks that a key
|
|
83
|
+
resolves; it makes no API call, so it never spends credits.
|
|
84
|
+
|
|
85
|
+
## Quick start
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import pendulum
|
|
89
|
+
|
|
90
|
+
from airflow.sdk import DAG # Airflow 2: from airflow import DAG
|
|
91
|
+
from anakin_provider.operators.anakin import AnakinCrawlOperator, AnakinScrapeOperator
|
|
92
|
+
|
|
93
|
+
with DAG("anakin_quickstart", schedule="@daily", start_date=pendulum.datetime(2026, 1, 1)):
|
|
94
|
+
pricing = AnakinScrapeOperator(
|
|
95
|
+
task_id="scrape_pricing",
|
|
96
|
+
url="https://example.com/pricing",
|
|
97
|
+
generate_json=True, # also extract structured JSON with AI
|
|
98
|
+
)
|
|
99
|
+
docs = AnakinCrawlOperator(
|
|
100
|
+
task_id="crawl_docs",
|
|
101
|
+
url="https://example.com/docs",
|
|
102
|
+
max_pages=50,
|
|
103
|
+
include_patterns=["/docs/*"],
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`example_dags/` has a runnable DAG for every operator.
|
|
108
|
+
|
|
109
|
+
## Operators
|
|
110
|
+
|
|
111
|
+
All operators live in `anakin_provider.operators.anakin`.
|
|
112
|
+
|
|
113
|
+
### Web data
|
|
114
|
+
|
|
115
|
+
| Operator | What it does |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `AnakinScrapeOperator` | Scrape one URL to markdown, with optional HTML, screenshot or AI-extracted JSON |
|
|
118
|
+
| `AnakinSearchOperator` | Web search: URLs, titles and snippets, returned immediately |
|
|
119
|
+
| `AnakinMapOperator` | List the URLs on a site |
|
|
120
|
+
| `AnakinCrawlOperator` | Crawl a site and return each page as markdown |
|
|
121
|
+
| `AnakinAgenticSearchOperator` | Multi-stage research: search, read sources, return a summary plus structured data |
|
|
122
|
+
|
|
123
|
+
### Wire: pre-built site actions
|
|
124
|
+
|
|
125
|
+
| Operator | What it does |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `AnakinWireDiscoverOperator` | Find actions for a task, e.g. "top phones on walmart" |
|
|
128
|
+
| `AnakinWireCatalogOperator` | List supported sites, or one site's actions and their parameters |
|
|
129
|
+
| `AnakinWireReadActionOperator` | Run an action that reads data |
|
|
130
|
+
| `AnakinWireWriteActionOperator` | Run an action that changes something on the site |
|
|
131
|
+
| `AnakinWireIdentitiesOperator` | List saved site logins and their `credential_id`s |
|
|
132
|
+
| `AnakinWireLoginOperator` | Sign in to a site and get a `credential_id` |
|
|
133
|
+
| `AnakinWireBuildOperator` | Request actions for a site Wire doesn't cover yet |
|
|
134
|
+
| `AnakinWireBuildStatusOperator` | Check a build request |
|
|
135
|
+
|
|
136
|
+
Wire action inputs go in `action_params` (`params` is reserved by Airflow).
|
|
137
|
+
Actions that need a login take `credential_id`.
|
|
138
|
+
|
|
139
|
+
### Website monitoring
|
|
140
|
+
|
|
141
|
+
| Operator | What it does |
|
|
142
|
+
|---|---|
|
|
143
|
+
| `AnakinMonitorCreateOperator` | Watch a page, a site or a Wire action on a schedule |
|
|
144
|
+
| `AnakinMonitorListOperator` | List monitors |
|
|
145
|
+
| `AnakinMonitorChangesOperator` | Get the changes a monitor detected |
|
|
146
|
+
| `AnakinMonitorControlOperator` | Pause, resume, run now or delete a monitor |
|
|
147
|
+
|
|
148
|
+
### AI visibility
|
|
149
|
+
|
|
150
|
+
| Operator | What it does |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `AnakinAiVisibilitySearchOperator` | Ask ChatGPT, Gemini and Google AI Overview the same question and compare answers |
|
|
153
|
+
| `AnakinAiVisibilitySourcesOperator` | List the available answer engines |
|
|
154
|
+
|
|
155
|
+
### Browser
|
|
156
|
+
|
|
157
|
+
| Operator | What it does |
|
|
158
|
+
|---|---|
|
|
159
|
+
| `AnakinSessionListOperator` | List saved browser sessions, for pages behind a login |
|
|
160
|
+
| `AnakinSessionDeleteOperator` | Delete a saved browser session |
|
|
161
|
+
| `AnakinBrowserTaskOperator` | Have an AI agent drive a cloud browser through a multi-step task |
|
|
162
|
+
|
|
163
|
+
### Chaining tasks with XCom
|
|
164
|
+
|
|
165
|
+
Templated fields accept XCom pulls, so one task can feed the next:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
discover = AnakinWireDiscoverOperator(
|
|
169
|
+
task_id="discover", q="search products on walmart", auth_mode="none"
|
|
170
|
+
)
|
|
171
|
+
run = AnakinWireReadActionOperator(
|
|
172
|
+
task_id="run",
|
|
173
|
+
action_id="{{ ti.xcom_pull(task_ids='discover')[0]['action_id'] }}",
|
|
174
|
+
action_params={"query": "wireless headphones"},
|
|
175
|
+
)
|
|
176
|
+
discover >> run
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Long-running jobs
|
|
180
|
+
|
|
181
|
+
Scrape, map, crawl, agentic search, Wire actions and AI-visibility searches
|
|
182
|
+
are asynchronous jobs; the operator submits the job and polls until it
|
|
183
|
+
finishes. `poll_timeout` (seconds) caps the wait. Agentic search usually
|
|
184
|
+
takes 1 to 5 minutes and a browser task up to about 6.
|
|
185
|
+
|
|
186
|
+
## Hook
|
|
187
|
+
|
|
188
|
+
Use `AnakinHook` from your own tasks:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from airflow.sdk import task
|
|
192
|
+
from anakin_provider.hooks.anakin import AnakinHook
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@task
|
|
196
|
+
def headlines() -> str:
|
|
197
|
+
doc = AnakinHook().scrape("https://example.com/news")
|
|
198
|
+
return doc.markdown
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`AnakinHook().get_conn()` returns the configured `anakin.Anakin` client
|
|
202
|
+
for anything else in the SDK.
|
|
203
|
+
|
|
204
|
+
## Errors
|
|
205
|
+
|
|
206
|
+
Failures raise the SDK's exceptions, all subclasses of `anakin.AnakinError`
|
|
207
|
+
(for example `AuthenticationError`, `InsufficientCreditsError`,
|
|
208
|
+
`RateLimitError`, `JobFailedError`, `JobTimeoutError`). Airflow marks the
|
|
209
|
+
task failed and applies its retry policy. Note that Wire write actions,
|
|
210
|
+
monitor and Wire build creation, and browser tasks are not idempotent;
|
|
211
|
+
think before setting `retries` on them.
|
|
212
|
+
|
|
213
|
+
## Development
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
uv venv && source .venv/bin/activate
|
|
217
|
+
uv pip install -e . --group test --group lint
|
|
218
|
+
pytest
|
|
219
|
+
ruff check . && ruff format --check . && mypy anakin_provider
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
Apache-2.0
|