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

CI: Fix circular import error for Airflow 2.2.5 #1396

Merged
merged 1 commit into from
Dec 8, 2022
Merged

Conversation

kaxil
Copy link
Collaborator

@kaxil kaxil commented Dec 8, 2022

This should fix the following in CI:

File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/custom_backend/astro_custom_backend.py", line 6, in <module>
    from astro.custom_backend.serializer import deserialize, serialize
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/custom_backend/serializer.py", line 17, in <module>
    from astro.files import File
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/files/__init__.py", line 6, in <module>
    from astro.files.operators.files import get_file_list_func  # noqa: F401 # skipcq: PY-W2000
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/files/operators/files.py", line 5, in <module>
    from airflow.decorators.base import get_unique_task_id
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/__init__.py", line 20, in <module>
    from airflow.decorators.python import PythonDecoratorMixin, python_task  # noqa
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/python.py", line 20, in <module>
    from airflow.decorators.base import DecoratedOperator, task_decorator_factory
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/base.py", line 26, in <module>
    from airflow.models import BaseOperator
ImportError: cannot import name 'BaseOperator' from partially initialized module 'airflow.models' (most likely due to a circular import)

This should fix the following in CI:

```
File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/custom_backend/astro_custom_backend.py", line 6, in <module>
    from astro.custom_backend.serializer import deserialize, serialize
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/custom_backend/serializer.py", line 17, in <module>
    from astro.files import File
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/files/__init__.py", line 6, in <module>
    from astro.files.operators.files import get_file_list_func  # noqa: F401 # skipcq: PY-W2000
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/src/astro/files/operators/files.py", line 5, in <module>
    from airflow.decorators.base import get_unique_task_id
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/__init__.py", line 20, in <module>
    from airflow.decorators.python import PythonDecoratorMixin, python_task  # noqa
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/python.py", line 20, in <module>
    from airflow.decorators.base import DecoratedOperator, task_decorator_factory
  File "/home/runner/work/astro-sdk/astro-sdk/python-sdk/.nox/test-3-8-airflow-2-2-5/lib/python3.8/site-packages/airflow/decorators/base.py", line 26, in <module>
    from airflow.models import BaseOperator
ImportError: cannot import name 'BaseOperator' from partially initialized module 'airflow.models' (most likely due to a circular import)
```
Copy link
Contributor

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

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

With this it means we are exposing now get_file_list_func as
from astro.files.operators.files import get_file_list_func, instead of the previous
from astro.files import get_file_list_func from
PR #1380 and that should not be an issue, right?

@kaxil
Copy link
Collaborator Author

kaxil commented Dec 8, 2022

With this it means we are exposing now get_file_list_func as from astro.files.operators.files import get_file_list_func, instead of the previous from astro.files import get_file_list_func from PR #1380 and that should not be an issue, right?

yup

@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Base: 93.95% // Head: 93.13% // Decreases project coverage by -0.81% ⚠️

Coverage data is based on head (a6a2013) compared to base (f9db91a).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
- Coverage   93.95%   93.13%   -0.82%     
==========================================
  Files          73       54      -19     
  Lines        3538     2854     -684     
  Branches      337      337              
==========================================
- Hits         3324     2658     -666     
+ Misses        148      130      -18     
  Partials       66       66              
Impacted Files Coverage Δ
python-sdk/src/astro/files/__init__.py 81.81% <ø> (-1.52%) ⬇️
sql-cli/sql_cli/__init__.py
sql-cli/sql_cli/astro/utils.py
sql-cli/sql_cli/templates/render_dag.py.jinja2
sql-cli/sql_cli/operators/load_file.py
sql-cli/sql_cli/workflow_directory_parser.py
sql-cli/sql_cli/run_dag.py
sql-cli/sql_cli/utils/airflow.py
sql-cli/sql_cli/connections.py
sql-cli/sql_cli/astro/group.py
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kaxil kaxil merged commit 34e7e21 into main Dec 8, 2022
@kaxil kaxil deleted the circular-imp-error branch December 8, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants