Update CI template to use setup-python@v6#23
Merged
thorwhalen merged 3 commits intomasterfrom Nov 20, 2025
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.