This release is a pre-release and may not be stable for production use.
airflint
Enforce Best Practices for all your Airflow DAGs. ⭐
⚠️ 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, thank you. 🙏
🧑🏫 Rules
- Use function-level imports instead of top-level imports12 (see Top level Python Code)
- Use jinja template syntax instead of
Variable.get(see Airflow Variables)
based on official Best Practices
Requirements
airflint is tested with:
| Main version (dev) | Released version (0.3.1-alpha) | |
|---|---|---|
| Python | 3.9, 3.10, 3.11.0-alpha - 3.11.0 | 3.9, 3.10 |
| Apache Airflow | >= 2.0.0 | >= 2.3.0 |
🚀 Get started
To install it from PyPI run:
pip install airflint
NOTE: It is recommended to install airflint into your existing airflow environment with all your providers included. This way
UseJinjaVariableGetrule can detect alltemplate_fieldsand airflint works as expected.
Then just call it like this:
pre-commit
Alternatively you can add the following repo to your pre-commit-config.yaml:
- repo: https://github.com/feluelle/airflint
rev: v0.3.1-alpha
hooks:
- id: airflint
args: ["-a"] # Use -a to apply the suggestions
additional_dependencies: # Add all package dependencies you have in your dags, preferable with version spec
- apache-airflow
- apache-airflow-providers-cncf-kubernetes
To complete the UseFunctionlevelImports rule, please add the autoflake hook after the airflint hook, as below:
- repo: https://github.com/pycqa/autoflake
rev: v1.4
hooks:
- id: autoflake
args: ["--remove-all-unused-imports", "--in-place"]
This will remove unused imports.
❤️ Contributing
I am looking for contributors who are interested in..
- testing airflint with real world Airflow DAGs and reporting issues as soon as they face them
- optimizing the ast traversing for existing rules
- adding new rules based on best practices or bottlenecks you have experienced during Airflow DAGs authoring
- documenting about what is being supported in particular by each rule
- defining supported airflow versions i.e. some rules are bound to specific Airflow features and version
For questions, please don't hesitate to open a GitHub issue.
-
There is a PEP for Lazy Imports targeted to arrive in Python 3.12 which would supersede this rule. ↩
-
To remove top-level imports after running
UseFunctionLevelImportsrule, use a tool such as autoflake. ↩
Metadata
Release files for airflint 0.3.2a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| airflint-0.3.2a0.tar.gz | 10.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| airflint-0.3.2a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / airflint-0.3.2a0.tar.gz
| Download URL | airflint-0.3.2a0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89f84564dc8169ac05838a121905c521a9a52088baf9f37f06dd2649c0d18411
|
|
BLAKE2b-256 checksum How to use checksums |
c7e2a1ff24bdacc0c8446bb0fd78322336f3c2417ae7f520b7290eeb2703a367
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.13 Linux/5.13.0-1031-azure
|
Release files / airflint-0.3.2a0-py3-none-any.whl
| Download URL | airflint-0.3.2a0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6856ec403f1b053645b76fb4ce594239707c7e22179316eeabc73a335129135b
|
|
BLAKE2b-256 checksum How to use checksums |
fc06669a5abc62b585dc8404a63ff917a936ca7f8d6531fb55195d7e8dd63445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.13 Linux/5.13.0-1031-azure
|
Security for airflint 0.3.2a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.