$npx -y skills add opendatahub-io/ai-helpers --skill python-packaging-complexityUse this skill to analyze Python package build complexity by inspecting PyPI metadata. Evaluates compilation requirements, dependencies, distribution types, and provides recommendations for wheel building strategies.
| 1 | # Python Package Build Complexity Analysis |
| 2 | |
| 3 | This skill helps you evaluate the build complexity of Python packages by analyzing their PyPI metadata. It determines whether a package likely requires compilation, assesses build complexity, and provides recommendations for wheel building strategies. |
| 4 | |
| 5 | ## Instructions |
| 6 | |
| 7 | When a user asks about Python package build complexity, building wheels, or evaluating PyPI packages for compilation requirements: |
| 8 | |
| 9 | 1. **Run the PyPI inspection script** using the package name and optional version: |
| 10 | ```bash |
| 11 | ./scripts/pypi_inspect.py <package_name> [version] |
| 12 | ``` |
| 13 | |
| 14 | 2. **Analyze the output** and provide interpretation focusing on: |
| 15 | |
| 16 | ### Build Complexity Assessment |
| 17 | - **Compilation Requirements**: Whether the package needs C/C++/Rust/Fortran compilation |
| 18 | - **Complexity Score**: Numerical score indicating build difficulty (0-10+ scale) |
| 19 | - **Key Indicators**: Specific classifiers, keywords, or dependencies that suggest complexity |
| 20 | |
| 21 | ### Distribution Analysis |
| 22 | - **Source Distribution Availability**: Whether sdist is available for building |
| 23 | - **Existing Wheels**: What wheel types already exist (platform-specific, universal) |
| 24 | - **Wheel Coverage**: Gaps in wheel availability that might need custom builds |
| 25 | |
| 26 | ### Dependency Analysis |
| 27 | - **Complex Dependencies**: Dependencies that themselves require compilation |
| 28 | - **Version Constraints**: Python version requirements and compatibility |
| 29 | - **Transitive Complexity**: How dependencies affect overall build complexity |
| 30 | |
| 31 | 3. **Provide actionable recommendations**: |
| 32 | - Whether to build from source or use existing wheels |
| 33 | - Required build tools and dependencies |
| 34 | - Platform-specific considerations |
| 35 | - Estimated build time and resource requirements |
| 36 | |
| 37 | ## Key Complexity Indicators |
| 38 | |
| 39 | ### High Complexity (Score 5+) |
| 40 | - Native extensions (C/C++/Rust/Fortran classifiers) |
| 41 | - CUDA/GPU acceleration keywords |
| 42 | - Known complex packages (torch, tensorflow, numpy, scipy) |
| 43 | - Missing or limited wheel availability |
| 44 | - Many compiled dependencies |
| 45 | |
| 46 | ### Medium Complexity (Score 2-4) |
| 47 | - Some compilation indicators in description/keywords |
| 48 | - Platform-specific wheels only |
| 49 | - Mixed dependency complexity |
| 50 | - Moderate build requirements |
| 51 | |
| 52 | ### Low Complexity (Score 0-1) |
| 53 | - Pure Python packages |
| 54 | - Universal wheels available |
| 55 | - Simple dependencies |
| 56 | - No compilation requirements |
| 57 | |
| 58 | ## Usage Examples |
| 59 | |
| 60 | ### Basic Package Analysis |
| 61 | ```bash |
| 62 | ./scripts/pypi_inspect.py torch |
| 63 | ``` |
| 64 | **Interpretation**: Analyze latest PyTorch version for build complexity, focusing on CUDA dependencies and compilation requirements. |
| 65 | |
| 66 | ### Specific Version Analysis |
| 67 | ```bash |
| 68 | ./scripts/pypi_inspect.py numpy 1.24.3 |
| 69 | ``` |
| 70 | **Interpretation**: Evaluate specific numpy version, explaining why numpy requires compilation and what build tools are needed. |
| 71 | |
| 72 | ### JSON Output for Processing |
| 73 | ```bash |
| 74 | ./scripts/pypi_inspect.py tensorflow --json |
| 75 | ``` |
| 76 | **Interpretation**: Get structured data for programmatic analysis, then explain the complexity factors in plain language. |
| 77 | |
| 78 | ## Providing Recommendations |
| 79 | |
| 80 | Based on the analysis, provide specific guidance: |
| 81 | |
| 82 | ### For High Complexity Packages |
| 83 | - "This package requires significant compilation infrastructure" |
| 84 | - "Building from source with customizations is recommended" |
| 85 | - "Building from source will need: [specific tools]" |
| 86 | - "Use pre-built wheels only when: source unavailable (proprietary) AND wheels exist on PyPI" |
| 87 | |
| 88 | ### For Wheel Building Strategies |
| 89 | - "Always build from source with customizations for maximum control" |
| 90 | - "Platform-specific wheels needed for: [platforms]" |
| 91 | - "Use pre-built wheels only when: source unavailable (proprietary) AND wheels exist on PyPI" |
| 92 | - "Dependencies that complicate building: [list]" |
| 93 | |
| 94 | ### For Development Planning |
| 95 | - "Budget [time] for build environment setup" |
| 96 | - "Consider containerized builds for reproducibility" |
| 97 | - "Test on target platforms before production deployment" |
| 98 | - "Monitor for new wheel releases that might eliminate build needs" |
| 99 | |
| 100 | ## Error Handling |
| 101 | |
| 102 | If the script fails or package is not found: |
| 103 | - Verify package name spelling and availability on PyPI |
| 104 | - Check if the package exists under a different name |
| 105 | - Suggest alternative analysis approaches |
| 106 | - Provide general guidance for unknown packages |
| 107 | |
| 108 | ## Integration Notes |
| 109 | |
| 110 | This skill works best when combined with: |
| 111 | - **python-packaging-license-finder** - License information helps assess redistribution requirements |
| 112 | - Package dependency analysis |
| 113 | - Build environment setup |
| 114 | - Continuous integration planning |
| 115 | - Container build strategies |