{"id":21404750,"url":"https://github.com/feluelle/airflint","last_synced_at":"2025-04-05T00:04:39.972Z","repository":{"id":36964169,"uuid":"477715097","full_name":"feluelle/airflint","owner":"feluelle","description":"Enforce Best Practices for all your Airflow DAGs. ⭐","archived":false,"fork":false,"pushed_at":"2025-03-24T17:45:10.000Z","size":339,"stargazers_count":98,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T23:02:59.364Z","etag":null,"topics":["airflow","best-practices","dag","formatter","linter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/feluelle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-04T13:33:06.000Z","updated_at":"2025-03-28T04:35:49.000Z","dependencies_parsed_at":"2023-12-13T20:11:51.979Z","dependency_job_id":"80450fa4-4eb3-4f2c-b1f8-75303f03567a","html_url":"https://github.com/feluelle/airflint","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feluelle%2Fairflint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feluelle%2Fairflint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feluelle%2Fairflint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feluelle%2Fairflint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feluelle","download_url":"https://codeload.github.com/feluelle/airflint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airflow","best-practices","dag","formatter","linter"],"created_at":"2024-11-22T16:17:54.766Z","updated_at":"2025-04-05T00:04:39.943Z","avatar_url":"https://github.com/feluelle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# airflint\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/feluelle/airflint/main.svg)](https://results.pre-commit.ci/latest/github/feluelle/airflint/main)\n![test workflow](https://github.com/feluelle/airflint/actions/workflows/test.yml/badge.svg)\n![codeql-analysis workflow](https://github.com/feluelle/airflint/actions/workflows/codeql-analysis.yml/badge.svg)\n[![codecov](https://codecov.io/gh/feluelle/airflint/branch/main/graph/badge.svg?token=J8UEP8IVY4)](https://codecov.io/gh/feluelle/airflint)\n[![PyPI version](https://img.shields.io/pypi/v/airflint)](https://pypi.org/project/airflint/)\n[![License](https://img.shields.io/pypi/l/airflint)](https://github.com/feluelle/airflint/blob/main/LICENSE)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/airflint)](https://pypi.org/project/airflint/)\n[![PyPI version](https://img.shields.io/pypi/dm/airflint)](https://pypi.org/project/airflint/)\n\n\u003e Enforce Best Practices for all your Airflow DAGs. ⭐\n\n⚠️ **airflint is still in alpha stage and has not been tested with real world Airflow DAGs. Please report any issues you face via [GitHub Issues](https://github.com/feluelle/airflint/issues), thank you. 🙏**\n\n## 🧑‍🏫 Rules\n\n- [x] Use function-level imports instead of top-level imports[^1][^2] (see [Top level Python Code](https://airflow.apache.org/docs/apache-airflow/stable/best-practices.html#top-level-python-code))\n- [x] Use jinja template syntax instead of `Variable.get` (see [Airflow Variables](https://airflow.apache.org/docs/apache-airflow/stable/best-practices.html#airflow-variables))\n\n[^1]: There is a PEP for [Lazy Imports](https://peps.python.org/pep-0690/) targeted to arrive in Python 3.12 which would supersede this rule.\n\n[^2]: To remove top-level imports after running `UseFunctionLevelImports` rule, use a tool such as [autoflake](https://github.com/PyCQA/autoflake).\n\n_based on official [Best Practices](https://airflow.apache.org/docs/apache-airflow/stable/best-practices.html)_\n\n## Requirements\n\nairflint is tested with:\n\n|                | Main version (dev)                     | Released version (0.3.2-alpha) |\n|----------------|----------------------------------------|--------------------------------|\n| Python         | 3.9, 3.10, 3.11, 3.12.0-alpha - 3.12.0 | 3.9, 3.10                      |\n| Apache Airflow | \u003e= 2.0.0                               | \u003e= 2.0.0                       |\n\n## 🚀 Get started\n\nTo install it from [PyPI](https://pypi.org/) run:\n\n```console\npip install airflint\n```\n\n\u003e **_NOTE:_** It is recommended to install airflint into your existing airflow environment with all your providers included. This way `UseJinjaVariableGet` rule can detect all `template_fields` and airflint works as expected.\n\nThen just call it like this:\n\n![usage](assets/images/usage.png)\n\n### pre-commit\n\nAlternatively you can add the following repo to your `pre-commit-config.yaml`:\n\n```yaml\n  - repo: https://github.com/feluelle/airflint\n    rev: v0.3.2-alpha\n    hooks:\n      - id: airflint\n        args: [\"-a\"]  # Use -a to apply the suggestions\n        additional_dependencies:  # Add all package dependencies you have in your dags, preferable with version spec\n          - apache-airflow\n          - apache-airflow-providers-cncf-kubernetes\n```\n\nTo complete the `UseFunctionlevelImports` rule, please add the `autoflake` hook after the `airflint` hook, as below:\n\n```yaml\n  - repo: https://github.com/pycqa/autoflake\n    rev: v1.4\n    hooks:\n      - id: autoflake\n        args: [\"--remove-all-unused-imports\", \"--in-place\"]\n```\n\nThis will remove unused imports.\n\n## ❤️ Contributing\n\nI am looking for contributors who are interested in..\n\n- testing airflint with real world Airflow DAGs and reporting issues as soon as they face them\n- optimizing the ast traversing for existing rules\n- adding new rules based on best practices or bottlenecks you have experienced during Airflow DAGs authoring\n- documenting about what is being supported in particular by each rule\n- defining supported airflow versions i.e. some rules are bound to specific Airflow features and version\n\nFor questions, please don't hesitate to open a GitHub issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeluelle%2Fairflint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeluelle%2Fairflint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeluelle%2Fairflint/lists"}