A linting tool for Apache Airflow DAG files
Project description
DAGLint
A linting tool for Apache Airflow DAG files using Python's AST (Abstract Syntax Tree) to enforce standardization and best practices.
Features
- DAG ID Convention: Ensures DAG IDs follow naming conventions
- Owner Validation: Checks that DAG owners are specified and valid
- Task ID Convention: Validates task IDs follow naming patterns
- Retry Configuration: Ensures retry settings are properly configured
- Tag Requirements: Validates required tags are present
- Max Active Runs Validation: Ensures DAGs explicitly set
max_active_runsto the configured value - Import Validation: Checks for prohibited or required imports
- Schedule Validation: Ensures schedule_interval is properly set
- Documentation Checks: Validates DAG and task documentation
Installation
From Source
pip install -e .
From PyPI
DAGLint is available on PyPI: https://pypi.org/project/daglint/
pip install daglint
Usage
# Lint a single DAG file
daglint check path/to/dag.py
# Lint all DAGs in a directory
daglint check path/to/dags/
# Lint with specific rules
daglint check path/to/dag.py --rules dag_id_convention,owner_validation
# List all available rules
daglint rules
# Generate a configuration file
daglint init
Configuration
Create a .daglint.yaml file in your project root:
rules:
dag_id_convention:
enabled: true
pattern: "^[a-z][a-z0-9_]*$"
owner_validation:
enabled: true
valid_owners:
- "data-team"
- "analytics-team"
task_id_convention:
enabled: true
pattern: "^[a-z][a-z0-9_]*$"
retry_configuration:
enabled: true
min_retries: 1
max_retries: 5
tag_requirements:
enabled: true
required_tags:
- "environment"
- "team"
max_active_runs_validation:
enabled: true
max_active_runs: 1
severity: warning
schedule_validation:
enabled: true
allow_none: false
Development
# Install development dependencies
make install-dev
# Run tests
make test
# Run tests with coverage
make test-cov
# Format code
make format
# Run linting checks
make lint
# Run all quality checks
make check
# See all available commands
make help
Version Management
This project uses bumpver to manage version numbers. See VERSION_MANAGEMENT.md for detailed usage instructions.
# Preview version bump (dry run)
bumpver update --patch --dry --no-fetch
# Bump patch version (0.5.0 -> 0.5.1)
bumpver update --patch --no-fetch
# Bump minor version (0.5.0 -> 0.6.0)
bumpver update --minor --no-fetch
# Bump major version (0.5.0 -> 1.0.0)
bumpver update --major --no-fetch
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daglint-1.0.0.tar.gz.
File metadata
- Download URL: daglint-1.0.0.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea5cb98869323e7b872bbc3541f225ba52ff7efac6734612e6ff5ec68ac4e2fd
|
|
| MD5 |
ea1aac6c7e688546d58991e226a19a40
|
|
| BLAKE2b-256 |
883107d0c6f02a364c555bb34c7ee8fd846866bf5cf631cfd8763c8a77807872
|
File details
Details for the file daglint-1.0.0-py3-none-any.whl.
File metadata
- Download URL: daglint-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99a518eb0ea58a9e09f9d025a4649b2be50710a9d14b1ed5ff16d42a829d79f8
|
|
| MD5 |
1e5b66272185189be989aae4c37e6c62
|
|
| BLAKE2b-256 |
57b91e630a3e7b818edfb85d2c015535945817513d77df5ecf323aac57f7b2ad
|