Skip to main content

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
  • 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 (Current)

pip install -e .

From PyPI (Coming Soon)

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"
  
  schedule_validation:
    enabled: true
    allow_none: false

Development

# Install development dependencies
./dev.sh install-dev

# Run tests
./dev.sh test

# Run tests with coverage
./dev.sh test-cov

# Format code
./dev.sh format

# Run linting checks
./dev.sh lint

# Run all quality checks
./dev.sh check

# See all available commands
./dev.sh 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

daglint-0.6.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daglint-0.6.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file daglint-0.6.0.tar.gz.

File metadata

  • Download URL: daglint-0.6.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for daglint-0.6.0.tar.gz
Algorithm Hash digest
SHA256 f41648128f7275ed338faf707cf09b79afd210c36735d5124b7a49c7b9179816
MD5 280e38bab2866e70e2689f8917dc5b1e
BLAKE2b-256 e8e16b89a55db4188eb6084ea2a5e2b755b0f624340585731f57d5f4673a5198

See more details on using hashes here.

File details

Details for the file daglint-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: daglint-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for daglint-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1c596c318711c7edc07826bf7c737233672f33b6160290cc0ba4b1df4b2d3e4
MD5 f45c890f337b626094a3a2652f0714cc
BLAKE2b-256 ff019d0dfa86c73b6cbe11156cebce3a1ad82aba6d9a0a23e9264f08cefd97ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page