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

pip install -e .

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.5.0.tar.gz (16.9 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.5.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for daglint-0.5.0.tar.gz
Algorithm Hash digest
SHA256 3737b9567781fe23534a168d72fcd75721064e4a49a9c59228657d87aa9f63f9
MD5 54980616c701238c6c81dee7ed76df0c
BLAKE2b-256 004719f99500bab4b4deeb014e1bb3911581d83a6c86a50d36f7be3ef4c455a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: daglint-0.5.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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2807c209a135042c44157590dc38222b560a85b001b198142e300dc3d9f966d7
MD5 9f1538d6c39ed1700318e62d00f4f18a
BLAKE2b-256 b0ec19ff20b00d5b3baa5ee28e82c91b22927be7f82a9eb6a80063228ce9b40c

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