Skip to content

Update CI template to use setup-python@v6#23

Merged
thorwhalen merged 3 commits intomasterfrom
claude/fix-ci-setup-python-017U7dyxosJxXAv68aYJLr6V
Nov 20, 2025
Merged

Update CI template to use setup-python@v6#23
thorwhalen merged 3 commits intomasterfrom
claude/fix-ci-setup-python-017U7dyxosJxXAv68aYJLr6V

Conversation

@thorwhalen
Copy link
Member

No description provided.

This commit addresses multiple improvements to CI configuration and project templates:

CI Updates:
- Updated setup-python action from v5 to v6 in both CI template and workflow
- Env variables from old CI were already properly migrated (PROJECT_NAME)

Testing Enhancements:
- Added pytest conftest.py with error summary hook for better test reporting
- Provides grouped error counts to make CI logs more readable

Template Improvements:
- Enhanced pyproject.toml template with commented standard entries:
  * [project.scripts] for CLI tools
  * [project.gui-scripts] for GUI applications
  * [project.entry-points] for plugin systems
- Added commented URL fields: Repository, Documentation, Changelog, Issues

Populate Function Enhancements:
- Auto-generates Documentation URL for GitHub projects (github.io pattern)
- Adds Repository URL field (defaults to homepage if not specified)
- Allows explicit override via 'documentation' or 'repository' parameters
This commit implements a comprehensive system for defining all CI-specific
configuration in pyproject.toml, eliminating hardcoded project settings in
CI workflow files.

NEW FEATURES:

[tool.wads.ci] Configuration Structure:
- Comprehensive CI config in pyproject.toml under [tool.wads.ci]
- Supports execution flow, environment variables, quality tools, testing,
  build settings, and documentation configuration
- All settings have sensible defaults and are optional

Core Components:

1. wads/ci_config.py - CI Configuration Parser
   - CIConfig class for reading and validating CI config from pyproject.toml
   - Properties for accessing all configuration sections
   - Methods to generate YAML sections for CI workflows
   - Template substitution system for dynamic CI generation

2. wads/data/github_ci_publish_2025_dynamic.yml - Dynamic CI Template
   - Enhanced CI template with placeholders for dynamic content
   - Supports: env vars, Python versions, pre-test steps, pytest args,
     coverage settings, exclude paths, Windows testing, docs generation
   - Falls back to static template if no CI config present

3. wads/scripts/validate_ci_env.py - Environment Validation
   - Standalone script to validate required environment variables
   - Can be integrated into CI workflows
   - Reads requirements from [tool.wads.ci.env.required]

4. wads/populate.py Enhancements
   - Modified _add_ci_def() to support dynamic CI generation
   - Automatically detects [tool.wads.ci] config in pyproject.toml
   - Generates customized CI workflows based on project configuration
   - Seamless fallback to static templates for backward compatibility

5. wads/data/pyproject_toml_tpl.toml - Template Updates
   - Added comprehensive [tool.wads.ci] section with examples
   - Documented all configuration options with comments
   - Organized into logical sections: commands, env, quality, testing,
     build, publish, docs

6. CI_CONFIG_GUIDE.md - Complete Documentation
   - Quick start guide
   - Full configuration reference
   - Migration guide from hardcoded CI
   - Examples for common use cases
   - Troubleshooting section

Configuration Capabilities:

⚙️ Execution Flow and Commands:
   - pre_test: Setup commands before testing
   - test: Custom test commands
   - post_test: Cleanup/reporting after tests
   - lint/format: Custom quality check commands

🌍 Environment Variables:
   - required: List of required env vars (validated)
   - defaults: Default values for optional vars

✅ Code Quality:
   - Ruff, Black, Mypy configuration
   - Enable/disable tools per project

🧪 Testing:
   - Python version matrix
   - Pytest arguments
   - Coverage thresholds
   - Exclude paths
   - Windows testing toggle

📦 Build & Publish:
   - Control sdist/wheel creation
   - Publication settings

📄 Documentation:
   - Enable/disable docs generation
   - Configure builder (epythet/sphinx/mkdocs)
   - Ignore paths

Benefits:
- ✅ Single source of truth for all CI configuration
- ✅ No need to edit YAML files directly
- ✅ Type-safe TOML configuration
- ✅ Discoverable and well-documented
- ✅ Backward compatible (falls back to defaults)
- ✅ Eliminates duplication across projects
- ✅ Enables programmatic access to CI config

Example Usage:
    # In pyproject.toml
    [tool.wads.ci.commands]
    pre_test = ["python scripts/setup_db.py"]

    [tool.wads.ci.testing]
    python_versions = ["3.10", "3.11", "3.12"]
    pytest_args = ["-v", "--cov=myproject"]
    coverage_threshold = 80

    # Regenerate CI workflow
    $ python -m wads.populate .
    # → Generates .github/workflows/ci.yml with custom settings
TOML doesn't allow comments inside inline tables. Changed env.defaults
from an inline table with commented entries to an empty inline table
with example in comment above.

This fixes the tomllib.TOMLDecodeError at line 165 that was causing
all tests to fail.
@thorwhalen thorwhalen merged commit b593865 into master Nov 20, 2025
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants