$npx -y skills add opendatahub-io/ai-helpers --skill python-packaging-env-finderUse this skill to investigate environment variables that can be set when building Python wheels for a given project. Analyzes setup.py, CMake files, and other build configuration files to discover customizable build environment variables.
| 1 | # Python Build Environment Variables Investigation |
| 2 | |
| 3 | This skill helps you discover all environment variables that can be set when building Python wheels for a project. It performs a comprehensive analysis of build configuration files to identify customizable environment variables used during the wheel building process. |
| 4 | |
| 5 | ## Instructions |
| 6 | |
| 7 | When a user asks about environment variables for building Python wheels, investigating build configuration, or understanding build customization options: |
| 8 | |
| 9 | 1. **Run the Environment Variables Investigation Script**: |
| 10 | ```bash |
| 11 | ./scripts/env_finder.py [project_path] |
| 12 | ``` |
| 13 | |
| 14 | 2. **Analyze and present the findings** focusing on: |
| 15 | |
| 16 | ### Build Configuration Variables |
| 17 | - **Setup.py Variables**: Environment variables used in setup.py for customizing builds |
| 18 | - **CMake Variables**: Variables defined in CMakeLists.txt and related files |
| 19 | - **Build Tool Variables**: Variables used by setuptools, distutils, or other build systems |
| 20 | - **Compiler Variables**: Variables affecting compilation (CC, CXX, CFLAGS, etc.) |
| 21 | |
| 22 | ### Variable Categories |
| 23 | |
| 24 | #### Compiler and Linker Variables |
| 25 | - `CC`, `CXX` - Compiler selection |
| 26 | - `CFLAGS`, `CXXFLAGS` - Compilation flags |
| 27 | - `LDFLAGS` - Linker flags |
| 28 | - `LIBS` - Additional libraries |
| 29 | |
| 30 | #### Path Configuration Variables |
| 31 | - `PREFIX` - Installation prefix |
| 32 | - `LIBRARY_PATH` - Library search paths |
| 33 | - `INCLUDE_PATH` - Header file paths |
| 34 | - `PKG_CONFIG_PATH` - pkg-config search paths |
| 35 | |
| 36 | #### Feature Control Variables |
| 37 | - `ENABLE_*` - Feature enable/disable flags |
| 38 | - `WITH_*` - Optional component inclusion |
| 39 | - `USE_*` - Build option selection |
| 40 | - `DISABLE_*` - Feature disable flags |
| 41 | |
| 42 | #### Python-Specific Variables |
| 43 | - `PYTHON_INCLUDE_DIR` - Python headers location |
| 44 | - `PYTHON_LIBRARY` - Python library path |
| 45 | - `SETUPTOOLS_*` - Setuptools configuration |
| 46 | - `PIP_*` - pip-related build variables |
| 47 | |
| 48 | ### Usage Context |
| 49 | - **When Variables Are Used**: During which build phase each variable takes effect |
| 50 | - **Default Values**: What happens when variables are not set |
| 51 | - **Required vs Optional**: Which variables are mandatory for successful builds |
| 52 | |
| 53 | 3. **Provide actionable guidance**: |
| 54 | - How to set each variable for custom builds |
| 55 | - Common use cases for each variable |
| 56 | - Potential conflicts or compatibility issues |
| 57 | - Recommended values for different scenarios |
| 58 | |
| 59 | ## Output Format |
| 60 | |
| 61 | The skill should provide a structured list of environment variables with: |
| 62 | |
| 63 | 1. **Variable Name**: Exact environment variable name |
| 64 | 2. **Purpose**: Clear description of what the variable controls |
| 65 | 3. **Type**: Expected value type (path, boolean, string, number) |
| 66 | 4. **Default Value**: What happens when not set |
| 67 | 5. **Source File**: Where the variable was discovered |
| 68 | 6. **Usage Context**: When and how the variable is used |
| 69 | |
| 70 | ## Error Handling and Edge Cases |
| 71 | |
| 72 | ### No Build Configuration Found |
| 73 | - Report that no environment variables were found |
| 74 | - Most packages don't have build configuration so it is fine |