A comprehensive linter for healthy Kubeflow Pipelines with advanced analysis and auto-fix capabilities
Project description
๐ฉบ kfp-doctor
A comprehensive linter for healthy Kubeflow Pipelines with advanced analysis and auto-fix capabilities.
๐ Key Features in v1.0.0
- ๐ง Auto-fix capabilities - Automatically fix common pipeline issues
- ๐ Advanced analysis - Performance, cost, and complexity analysis
- ๐ฏ Smart config generation - Environment-specific configurations
- ๐ฐ Cost estimation - Per-component cost analysis and optimization
- โก Performance insights - Bottleneck detection and runtime estimation
- ๐จ Rich UI enhancements - Progress indicators, detailed reporting
๐ Features
Core Linting (10 Comprehensive Checks)
- โ Resource validation - Missing/excessive CPU and memory requests
- ๐ Security checks - Privileged containers, root users, hardcoded secrets
- ๐ท๏ธ Image best practices - Latest tags, registry validation
- ๐ก๏ธ Reliability - Retry policies, resource limits
- ๐ Pipeline structure - Unused components, dependency analysis
Advanced Analysis
- ๐ฐ Cost Analysis - Hourly/daily/monthly cost estimation with optimization suggestions
- โก Performance Insights - Bottleneck detection, resource imbalance identification
- ๐ Complexity Metrics - Pipeline complexity scoring and dependency analysis
- ๐ฏ Runtime Estimation - Predicted execution time based on resource allocation
Automation Features
- ๐ง Auto-fix - Automatically resolve common issues like missing resources, security contexts
- ๐ฏ Smart Config Generation - Environment-specific configurations (dev/staging/prod)
- ๐ Template System - Pre-built configurations for different use cases
- ๐ Pipeline Analysis - Intelligent config recommendations based on your pipeline
Developer Experience
- ๐จ Rich Console UI - Beautiful tables, progress indicators, color-coded output
- ๐ Multiple Output Formats - Console, JSON, YAML for CI/CD integration
- ๐ Verbose Mode - Real-time check execution visibility
- ๐ก Comprehensive Help - Built-in documentation and examples
๐ฆ Installation
pip install kfp-doctor
๐ฏ Quick Start
1. Basic Pipeline Check
# Check your pipeline
kfp-doctor check my-pipeline.yaml
# Verbose mode with real-time progress
kfp-doctor check my-pipeline.yaml --verbose
2. Generate Optimal Configuration
# Generate config for your environment
kfp-doctor generate-config --template production
# Smart config based on your pipeline
kfp-doctor generate-config --analyze-pipeline my-pipeline.yaml
3. Auto-fix Common Issues
# Preview what would be fixed
kfp-doctor fix my-pipeline.yaml --dry-run
# Apply fixes with backup
kfp-doctor fix my-pipeline.yaml --backup
4. Advanced Analysis
# Performance and cost analysis
kfp-doctor analyze my-pipeline.yaml --include-cost --include-performance
# Export analysis results
kfp-doctor analyze my-pipeline.yaml --output json --output-file analysis.json
๐ ๏ธ Commands
check - Pipeline Linting
Comprehensive pipeline validation with 10 built-in checks.
kfp-doctor check pipeline.yaml [OPTIONS]
Options:
--config, -c PATH Custom configuration file
--output, -o FORMAT Output format: console, json, yaml
--output-file PATH Save results to file
--fail-on LEVEL When to exit with error: error, warning, never
--verbose, -v Show detailed check execution
--dry-run Preview what would be checked
analyze - Advanced Analysis
Performance, cost, and complexity analysis with optimization insights.
kfp-doctor analyze pipeline.yaml [OPTIONS]
Options:
--include-cost Include detailed cost analysis
--include-performance Include performance insights
--output FORMAT Output format: console, json, yaml
--output-file PATH Save analysis to file
Sample Output:
๐ Pipeline Complexity Analysis
โโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโณโโโโโโโโโโโโโ
โ Metric โ Value โ Assessment โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Components โ 3 โ โ
โ Dependency Depth โ 3 โ โ
โ Max Parallelism โ 3 โ โ
โ Complexity Score โ 3.0 โ Simple โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโ
๐ฐ Cost Analysis
โโ Cost Summary โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ต Estimated Cost per Hour: $0.1495 โ
โ ๐
Estimated Cost per Day: $3.59 โ
โ ๐
Estimated Cost per Month: $107.64 โ
โ ๐ฏ Optimization Potential: $0.0299/hour โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
fix - Auto-fix Issues
Automatically resolve common pipeline issues.
kfp-doctor fix pipeline.yaml [OPTIONS]
Options:
--output-file, -o PATH Write fixed pipeline to file
--dry-run Show what would be fixed
--backup Create backup of original file
Auto-fix Capabilities:
- โ Add missing resource requests and limits
- โ Fix security contexts (disable privileged, set runAsUser)
- โ
Update image tags from
:latestto specific versions - โ Add retry policies for reliability
- โ Convert hardcoded secrets to secretKeyRef
generate-config - Configuration Generator
Create optimal configurations for different environments.
kfp-doctor generate-config [OPTIONS]
Options:
--template, -t NAME Template: development, staging, production, security-focused, cost-optimized
--output-file, -o PATH Output file (default: .kfp-doctor.yaml)
--analyze-pipeline PATH Analyze pipeline to suggest optimal config
--list-templates Show available templates
Available Templates:
- ๐ง development - Relaxed settings for development
- โ๏ธ staging - Balanced settings for staging
- ๐ญ production - Strict settings for production
- ๐ security-focused - Maximum security settings
- ๐ฐ cost-optimized - Resource efficiency focused
list-checks - Check Documentation
View all available checks with descriptions and configuration.
kfp-doctor list-checks
help - Comprehensive Help
Feature overview, examples, and quick start guide.
kfp-doctor help --examples
โ๏ธ Configuration
Basic Configuration
Create .kfp-doctor.yaml in your project root:
checks:
MISSING_RESOURCES:
enabled: true
severity: ERROR
LATEST_IMAGE_TAG:
enabled: true
severity: ERROR
EXCESSIVE_RESOURCES:
enabled: true
severity: WARNING
max_cpu: "8"
max_memory: "16Gi"
INSECURE_IMAGE_REGISTRY:
enabled: true
severity: ERROR
allowed_registries:
- "gcr.io/your-project"
- "docker.io/library"
Environment-Specific Configs
Generate optimized configurations for different environments:
# Development environment (relaxed)
kfp-doctor generate-config --template development
# Production environment (strict)
kfp-doctor generate-config --template production
# Security-focused environment
kfp-doctor generate-config --template security-focused
๐ CI/CD Integration
GitHub Actions
- name: Lint Kubeflow Pipeline
run: |
pip install kfp-doctor
kfp-doctor check compiled-pipeline.yaml --output json --fail-on error
GitLab CI
lint-pipeline:
script:
- pip install kfp-doctor
- kfp-doctor check compiled-pipeline.yaml --fail-on error
artifacts:
reports:
junit: pipeline-report.xml
๐ All Available Checks
| Check | Description | Configurable |
|---|---|---|
MISSING_RESOURCES |
Ensures all components have CPU and memory requests | โ |
MISSING_LIMITS |
Ensures components have resource limits | โ |
EXCESSIVE_RESOURCES |
Warns about over-provisioned resources | โ |
LATEST_IMAGE_TAG |
Warns against using :latest image tags |
โ |
NO_RETRY_POLICY |
Checks for retry policies | โ |
PRIVILEGED_CONTAINER |
Detects privileged containers | โ |
RUN_AS_ROOT |
Warns about root user execution | โ |
HARDCODED_SECRET |
Identifies hardcoded secrets | โ |
UNUSED_COMPONENT |
Finds unused pipeline components | โ |
INSECURE_IMAGE_REGISTRY |
Validates image registries | โ |
๐ Example Workflows
Development Workflow
# 1. Generate development config
kfp-doctor generate-config --template development
# 2. Check pipeline during development
kfp-doctor check pipeline.yaml --verbose
# 3. Auto-fix common issues
kfp-doctor fix pipeline.yaml --backup
# 4. Analyze performance
kfp-doctor analyze pipeline.yaml --include-performance
Production Deployment
# 1. Generate production config
kfp-doctor generate-config --template production
# 2. Strict production check
kfp-doctor check pipeline.yaml --config .kfp-doctor.yaml --fail-on error
# 3. Cost analysis before deployment
kfp-doctor analyze pipeline.yaml --include-cost --output-file cost-report.json
๐ค Contributing
We welcome contributions! Please see our contributing guidelines.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built for the Kubeflow community
- Inspired by pipeline best practices and production experience
- Designed for developer productivity and operational excellence
Project details
Release history Release notifications | RSS feed
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 kfp_doctor-1.0.0.tar.gz.
File metadata
- Download URL: kfp_doctor-1.0.0.tar.gz
- Upload date:
- Size: 71.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45eab2b77d49881b74b0a1f6b3cef0cd465a96026bf2baaf102f27761b8ed2f7
|
|
| MD5 |
36bbb17958d48fc09e6cd2d080957097
|
|
| BLAKE2b-256 |
b6eb2f1074911d2e2c46dd96120c9886534278885b054987fa343aed6503dffe
|
File details
Details for the file kfp_doctor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kfp_doctor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e4646cccbb8bdfb6df1ac9b6136e8b05e85ad077014e8675439e1ac1ce5f5e
|
|
| MD5 |
7e43d18f41271c202b7f67ff7d253274
|
|
| BLAKE2b-256 |
2941992f48c84d30713cf52f15059682d3d38ec93573cf4001ee5f4951f3a63e
|