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

Remove providers imports from core examples #12252

Merged

Conversation

turbaszek
Copy link
Member

@turbaszek turbaszek commented Nov 10, 2020

Core example DAGs should not depend on any non-core dependency
like providers packages.

I also added a pre-commit check to avoid regression:

➜ pre-commit run no-providers-in-core-examples --all-files
No providers imports in core example DAGs................................Failed
- hook id: no-providers-in-core-examples
- exit code: 1

airflow/example_dags/example_dag_decorator.py:25:from airflow.providers.http.operators.http import SimpleHttpOperator

closes: #12247


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

entry: ./scripts/ci/pre_commit/pre_commit_check_pre_commits.sh
language: system
files: ^.pre-commit-config.yaml$|^STATIC_CODE_CHECKS.rst|^breeze-complete$
require_serial: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this as it was duplicated:

- id: pre-commit-descriptions
name: Check if pre-commits are described
entry: ./scripts/ci/pre_commit/pre_commit_check_pre_commits.sh
language: system
files: ^.pre-commit-config.yaml$|^STATIC_CODE_CHECKS.rst|^breeze-complete$
require_serial: true

- id: pre-commit-descriptions
name: Check if pre-commits are described
entry: ./scripts/ci/pre_commit/pre_commit_check_pre_commits.sh
language: system
files: ^.pre-commit-config.yaml$|^STATIC_CODE_CHECKS.rst|^breeze-complete$
require_serial: true

@turbaszek
Copy link
Member Author

@mik-laj @potiuk is there any particular reason why http package is released as provider? It uses only

import requests
import tenacity

which are always installed with Airflow 🤔

@turbaszek turbaszek force-pushed the remove-providers-from-examples branch 3 times, most recently from 6153fa9 to 342c905 Compare November 10, 2020 17:09
@@ -145,6 +146,8 @@ class _PythonDecoratedOperator(BaseOperator):
"""

template_fields = ('op_args', 'op_kwargs')
template_fields_renderers = {"op_args": "py", "op_kwargs": "py"}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope no one will be angry that I added this in this PR 😄

Screenshot 2020-11-10 at 18 10 38

@mik-laj
Copy link
Member

mik-laj commented Nov 10, 2020

@turbaszek There is no reason. I've tried to move providers as many as possible, but we can move it back to the core.

@github-actions
Copy link

The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 10, 2020
Core example DAGs should not depend on any non-core dependency
like providers packages.

closes: apache#12247
@turbaszek turbaszek force-pushed the remove-providers-from-examples branch from 342c905 to 264e1bb Compare November 10, 2020 17:30
.pre-commit-config.yaml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
Co-authored-by: Xiaodong DENG <[email protected]>
@turbaszek turbaszek merged commit 0cd1c84 into apache:master Nov 10, 2020
@turbaszek turbaszek deleted the remove-providers-from-examples branch November 10, 2020 21:49
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one @turbaszek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example DAGs import error
5 participants