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

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"
  
  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.2.tar.gz (20.1 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.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: daglint-0.6.2.tar.gz
  • Upload date:
  • Size: 20.1 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.2.tar.gz
Algorithm Hash digest
SHA256 49249bc2c830ad7fc2bf8eda9bbe0df813bdab8f4fffd003df7b037a657ef493
MD5 479aff320bcacd34a6400a2e63ea3c1a
BLAKE2b-256 7ae9f08894226e9fe702606f224d492e06a562d3f62e6e921b23a65712622e8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: daglint-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26f698f1e9204dbc739d236b0ddb54660a631c235f8085c058cc35cac7e53b3a
MD5 beab82fbd19ebf430b6679be28ac5dec
BLAKE2b-256 800255a5580df08fa5c6657f08c06301cb3253e06762997abfc5b448927df975

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