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

Uploaded Python 3

File details

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

File metadata

  • Download URL: daglint-0.6.1.tar.gz
  • Upload date:
  • Size: 17.4 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.1.tar.gz
Algorithm Hash digest
SHA256 0a17b23f9167db90cc69b485d7698cb4ae0fa909e873bd3ace7aef0aad14b45d
MD5 25e90defaa90cb7b2a5ef22247793ea0
BLAKE2b-256 f9877a240b620ef7522c12d6639eac6333322efa41b8be81dc8ddb2eb3b31dd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: daglint-0.6.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d50e76b00b485e2979929695d318782bcdf1e0b5c837af83ddb13d24c59c6d0
MD5 19816f43b8cb9d390b3345a69a2bd0a0
BLAKE2b-256 907258da83bcc1e6b93413dede1cb15c854f2911177ddd86540c8afe748d4982

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