A Python application that generates Microsoft Project (.MPP) files from Aliyun DevOps platform workitems, creating professional Gantt charts for project management.
- β Chrome Cookie Extraction: Automatically extracts authentication cookies from Chrome browser
- β DevOps API Integration: Fetches workitems, projects, and hierarchies from Aliyun DevOps platform
- β MS Project File Generation: Creates professional .XML files that can be imported into MS Project
- β Open Source Solution: Uses lxml for XML generation instead of proprietary libraries
- β Bulk Project Processing: Process all accessible projects or selected project lists
- β Interactive Mode: User-friendly command-line interface with bulk operations support
- β Project Filtering: Advanced filtering by project IDs, names, codes, keywords, and admin privileges
- β Comprehensive Configuration: YAML-based configuration management
- β Logging & Error Handling: Detailed logging for troubleshooting
project1 #----------------------------------- API "List projects"
| |- version1-SS_yy.mm.XXYY.ZZ #------------ API "Project versions"
| | |- workitem (εΌειζ±) #---------------- API "Project workitems", $workitemtypeid is the id of type εΌειζ±
| | |- related workitems (PARENT_SUB) #- API "Query related workitems"
| | |- worktime records #------------ API "Workitem workload"
| |- version2-...
| | |- workitem (εΌειζ±)
| | |- related workitems (PARENT_SUB)
| | |- worktime records
project2
| |- version1-SS_yy.mm.XXYY.ZZ
| |- workitem (εΌειζ±)
| |- related workitems (PARENT_SUB)
| |- worktime records
project3..
- Python 3.8+
- Chrome browser (for cookie extraction)
- Access to Aliyun DevOps platform
-
Clone and navigate to the project:
git clone <repository-url> cd devgan
-
Install dependencies:
pip install -r requirements.txt
-
Create configuration file:
python devgan.py --create-config
-
Edit
config.yamland set your DevOps user ID:devops: user_id: "your-devops-user-id-here"
Run DevGan in interactive mode for easy project selection:
python devgan.py --interactive# Test cookie extraction
python devgan.py --test-cookies
# Test DevOps API connection
python devgan.py --test-connection
# List available projects
python devgan.py --list-projects
# Generate project file for specific project
python devgan.py --project-id PROJECT_ID --output output.xml
# Generate with specific version
python devgan.py --project-id PROJECT_ID --version-id VERSION_ID
# Use custom configuration
python devgan.py --config custom_config.yaml --interactiveDevGan supports powerful bulk operations to process multiple projects at once:
# Generate consolidated MS Project XML file for ALL accessible projects
python devgan.py --all-projects
# Generate consolidated MS Project XML file for specific projects
python devgan.py --selected-projects "proj1" "proj2" "proj3"
# Get workitems summary for all accessible projects
python devgan.py --workitems-summary
# Get workitems summary for specific projects
python devgan.py --summary-projects "proj1" "proj2"
# Bulk operations with custom output
python devgan.py --all-projects --output "consolidated_all_projects.xml"
python devgan.py --selected-projects "proj1" "proj2" --output "selected_projects.xml"# Help and all options
python devgan.py --help
# Run with custom user ID
python devgan.py --user-id YOUR_USER_ID --interactive
# Generate for specific project with custom output
python devgan.py \
--project-id "5a1295737102f79a8ddd1383ad" \
--version-id "ad33bc8ce45b0ed7dd6d3350ea" \
--output "my_project.xml"
# Project filtering examples
python devgan.py --filter-project-ids "proj1" "proj2" --list-projects
python devgan.py --filter-project-names "MITD" "DevOps" --interactive
python devgan.py --filter-custom-codes "ADCS" "R2R" --list-projects
python devgan.py --filter-keywords "control" "automation" --interactive
python devgan.py --exclude-project-ids "old_proj1" --admin-only --list-projects
python devgan.py --no-filter --list-projects # Disable all filtering
# Bulk operations with filtering
python devgan.py --filter-custom-codes "ADCS" "R2R" --all-projects
python devgan.py --admin-only --workitems-summary
python devgan.py --filter-keywords "automation" --selected-projects "proj1" "proj2"DevGan supports comprehensive project filtering to process only specific projects that match your criteria. This is useful when you have access to many projects but only want to work with a subset.
Edit config.yaml to set up persistent filtering:
project:
filter:
enabled: true
project_ids: ["proj1", "proj2"] # Specific project IDs
project_names: ["MITD", "Control"] # Partial name matching
custom_codes: ["ADCS", "R2R"] # Custom project codes
keywords: ["automation", "control"] # Keywords in name/description
exclude_project_ids: ["old_proj"] # Projects to exclude
admin_only: false # Only projects where user is adminOverride configuration with command-line options:
# Filter by specific project IDs
python devgan.py --filter-project-ids "proj1" "proj2" --list-projects
# Filter by project names (partial matching)
python devgan.py --filter-project-names "MITD" "Control" --interactive
# Filter by custom codes
python devgan.py --filter-custom-codes "ADCS" "R2R" --list-projects
# Filter by keywords in project name or description
python devgan.py --filter-keywords "automation" "control" --interactive
# Exclude specific projects
python devgan.py --exclude-project-ids "old_proj1" "test_proj" --list-projects
# Only projects where user is admin
python devgan.py --admin-only --list-projects
# Disable all filtering (show all accessible projects)
python devgan.py --no-filter --list-projects
# Combine multiple filters
python devgan.py --filter-custom-codes "ADCS" --admin-only --exclude-project-ids "old_proj" --interactive- Include filters (project_ids, project_names, custom_codes, keywords): If any include filter is specified, projects must match at least one criteria
- Exclude filters (exclude_project_ids): Projects matching exclude criteria are always filtered out
- Admin filter (admin_only): Only includes projects where the user has admin privileges
- Filter precedence: Exclude filters take priority over include filters
Edit config.yaml to customize DevGan behavior:
# DevOps platform settings
devops:
base_url: "https://devops.aliyun.com"
domain: "devops.aliyun.com"
user_id: "your-user-id" # β οΈ REQUIRED: Set your DevOps user ID
timeout: 30
# Chrome browser settings
chrome:
profile_path: "" # Auto-detect if empty
cookie_db: "Cookies"
# Project generation settings
project:
output_dir: "output"
default_work_hours_per_day: 8
include_weekends: false
# Project filtering settings
filter:
enabled: true
# Filter by project IDs (empty list means include all projects)
project_ids: []
# Filter by project names (supports partial matching)
project_names: []
# Filter by custom codes
custom_codes: []
# Filter by keywords in project name or description
keywords: []
# Exclude projects by IDs
exclude_project_ids: []
# Only include projects where user is admin
admin_only: false
# Logging configuration
logging:
level: "INFO" # DEBUG, INFO, WARNING, ERRORdevgan/
βββ src/
β βββ __init__.py # Package initialization
β βββ main.py # Main application entry point
β βββ config.py # Configuration management
β βββ cookie_extractor.py # Chrome cookie extraction
β βββ devops_client.py # DevOps API client
β βββ project_generator.py # MS Project file generator
βββ tests/
β βββ test_devgan.py # Test cases
βββ output/ # Generated project files
βββ config.yaml # Configuration file
βββ requirements.txt # Python dependencies
βββ devgan.py # Main entry script
βββ README.md # This file
-
Cookie Extraction: Automatically extracts authentication cookies from Chrome browser to authenticate with DevOps platform
-
Data Fetching: Uses DevOps REST APIs to fetch:
- User information
- Project lists
- Project versions
- Workitems and their hierarchies
- Workitem relations (PARENT_SUB, ASSOCIATED)
- Time tracking data
-
MS Project Generation: Creates professional .XML files with:
- Task hierarchies based on workitem relations
- Task dependencies (Finish-to-Start)
- Duration and work hours from workitem data
- Priority levels and status mapping
- Assignee information
- Rich task notes with descriptions
- Can be imported directly into Microsoft Project
- Task Structure: Hierarchical tasks based on workitem relations
- Dependencies: Automatic dependency creation from PARENT_SUB and ASSOCIATED relations
- Scheduling: Duration and work hours from DevOps workitem data
- Status Mapping: DevOps status mapped to MS Project percent complete
- Priority Levels: Chinese/English priority levels mapped to MS Project priorities
- Resource Assignment: Assignee information from DevOps
- Rich Information: Task notes with descriptions, types, and categories
Run the test suite:
python -m pytest tests/ -vOr run specific tests:
# Test configuration
python tests/test_devgan.py TestConfig
# Test cookie extraction
python tests/test_devgan.py TestCookieExtractor
# Test project generation
python tests/test_devgan.py TestProjectGenerator-
Cookie Extraction Fails
- Ensure Chrome browser is installed
- Login to DevOps platform using Chrome
- Try running Chrome as the same user
-
DevOps API Connection Fails
- Check your user ID in
config.yaml - Verify network connection
- Ensure cookies are valid (try
--test-cookies)
- Check your user ID in
-
No Projects Listed
- Verify your user has access to projects
- Check user permissions in DevOps platform
-
Project File Generation Fails
- Ensure output directory exists and is writable
- Check that workitems exist for the project/version
- Verify lxml is installed properly
Enable debug logging for detailed troubleshooting:
logging:
level: "DEBUG"Or run with verbose output:
python devgan.py --interactive 2>&1 | tee devgan_debug.log- requests: HTTP client for DevOps API calls
- lxml: XML generation for MS Project files
- browser-cookie3: Chrome cookie extraction
- pyyaml: Configuration file parsing
- pandas: Data processing
- python-dateutil: Date/time handling
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
For issues and questions:
- Check the troubleshooting section
- Review the debug logs
- Create an issue on GitHub with detailed information