Skip to content

Example DAG from astro dev init does not pass ruff check for Airflow 2.x #1908

@leestro

Description

@leestro

Describe the bug
When you run astro dev init --airflow-version 2.10.0, it creates dags/exampledag.py. If you run ruff check on this file, it fails with an error:

❯ uvx ruff check
dags/exampledag.py:56:9: E722 Do not use bare `except`
   |
54 |             number_of_people_in_space = r.json()["number"]
55 |             list_of_people_in_space = r.json()["people"]
56 |         except:
   |         ^^^^^^ E722
57 |             print("API currently not available, using hardcoded data instead.")
58 |             number_of_people_in_space = 12
   |

Found 1 error.

This does not seem to occur with Airflow 3.x:

 /tmp/foo ❯ astro dev init
Initialized empty Astro project in /tmp/foo

 /tmp/foo ❯ uvx ruff check
All checks passed!

 /tmp/foo ❯ cat Dockerfile
FROM astrocrpublic.azurecr.io/runtime:3.0-6

What CLI Version did you experience this bug?

Astro CLI Version: 1.35.1

This CLI bug is related to which Astronomer Platform?

  • Astro
  • Software
  • None/Unknown

What Operating System is the above CLI installed on?

macOS

🪜 Steps To Reproduce

  1. run astro dev init --airflow-version 2.10.0
  2. run uvx ruff check

📸 Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions