Skip to content

chore: migrate project to Python 3.13#116

Merged
JacobCoffee merged 16 commits intomainfrom
feature/migrate-to-python3.14
Nov 23, 2025
Merged

chore: migrate project to Python 3.13#116
JacobCoffee merged 16 commits intomainfrom
feature/migrate-to-python3.14

Conversation

@JacobCoffee
Copy link
Owner

@JacobCoffee JacobCoffee commented Nov 23, 2025

Summary

Migrates the entire Byte Bot project from Python 3.12 to Python 3.14.

Changes

Version Control

  • ✅ Updated .python-version to 3.14
  • ✅ Updated .tool-versions to python 3.14

Package Configuration

  • ✅ Updated requires-python = ">=3.14,<4.0" across all pyproject.toml files
    • Root workspace (including Python 3.14 classifier and ruff target-version)
    • byte-common package
    • API service
    • Bot service
  • ✅ Updated ruff target-version to py314

Documentation

  • ✅ Updated all README files to reference Python 3.14+
    • packages/byte-common/README.md
    • services/api/README.md
    • services/bot/README.md
    • services/worker/README.md

Configuration Files

  • ✅ Updated .sourcery.yaml python_version to 3.14
  • ✅ Updated .pre-commit-config.yaml default_language_version to 3.14
  • ✅ Updated sonar-project.properties sonar.python.version to 3.14

Docker Infrastructure

  • ✅ Updated services/api/Dockerfile base images to python:3.14-slim
  • ✅ Updated services/bot/Dockerfile base images to python:3.14-slim

CI/CD

  • ✅ Updated .github/workflows/docs.yml to install Python 3.14

Testing

  • Python 3.14.0 detected and virtual environment created successfully
  • All commits follow conventional commit format
  • Pre-commit hooks passed on all commits

Checklist

  • Changes are atomic and focused
  • Conventional commit messages used
  • All configuration files updated
  • Documentation updated
  • Dockerfiles updated
  • CI workflows updated

🤖 Generated with Claude Code

Summary by Sourcery

Migrate the project and tooling to Python 3.14 and refine CI/CD workflows for changelog generation and static checks.

Enhancements:

  • Update runtime, packaging, linting, and analysis configuration to require and target Python 3.14 across all services and shared packages.
  • Refresh Docker images, documentation, and pre-commit tooling to reflect Python 3.14 as the baseline environment.
  • Simplify CI prek integration by using a dedicated GitHub Action instead of manual installation and cache management.
  • Improve changelog generation in the CD workflow using a worktree-based process that safely updates docs on main only when changes are present and supports tag- and release-based triggers.

CI:

  • Adjust CI workflow to run prek checks via j178/prek-action for more streamlined static analysis.

Deployment:

  • Extend CD workflow triggers to run on version tags and published releases and grant required permissions to update changelog documentation via a separate worktree.

Documentation:

  • Update README files and changelog generation to consistently reference Python 3.14+ as the required version.

@railway-app
Copy link

railway-app bot commented Nov 23, 2025

🚅 Deployed to the byte-pr-116 environment in byte

Service Status Web Updated (UTC)
byte ◻️ Removed (View Logs) Nov 23, 2025 at 6:04 am

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 23, 2025

Reviewer's Guide

Migrates the project ecosystem from Python 3.12 to 3.14, updates tooling/CI to match, and refines the CD workflow to generate and push changelog updates from a git worktree with safer permissions and tagging triggers, while simplifying prek execution in CI.

Sequence diagram for the updated CD changelog generation workflow

sequenceDiagram
    actor "Developer" as Dev
    participant "GitHub" as GH
    participant "CD Workflow (cd.yml)" as CD
    participant "git-cliff Action" as Cliff
    participant "Git Repository" as Repo

    Dev->>GH: "Push tag 'v*' or publish release"
    GH-->>CD: "Trigger 'Continuous Deployment' workflow"

    CD->>Repo: "Checkout current ref"
    CD->>Cliff: "Run git-cliff in main workspace (latest, no header)"
    Cliff-->>CD: "Changelog content (output only)"

    CD->>Repo: "Fetch latest 'main' from origin"
    CD->>Repo: "Create worktree 'worktree-changelog' at 'origin/main'"

    CD->>Cliff: "Run git-cliff in worktree (output docs/changelog.rst)"
    Cliff-->>CD: "Updated 'docs/changelog.rst' in worktree"

    CD->>Repo: "Configure git user as 'github-actions[bot]'"
    CD->>Repo: "Stage 'docs/changelog.rst' in worktree"
    CD->>Repo: "Check if staged diff is empty"
    alt "Changelog has changes"
        CD->>Repo: "Commit with message 'docs: update changelog [skip ci]'"
        CD->>Repo: "Push 'HEAD' of worktree to 'origin/main'"
    else "No changes to changelog"
        CD-->>CD: "Skip commit and push"
    end

    CD->>Repo: "Remove worktree 'worktree-changelog' (cleanup)"
Loading

File-Level Changes

Change Details Files
Update Python runtime, tooling targets, and documentation from 3.12 to 3.14 across the workspace.
  • Bump requires-python constraints in all pyproject.toml files to require Python 3.14 and update the classifier to Python 3.14 in the root project metadata.
  • Retarget Ruff configuration from py311/py312 to py314 to align linting and typing assumptions with Python 3.14.
  • Update .pre-commit, .sourcery.yaml, sonar-project.properties, .python-version, .tool-versions, and all service/package README files to reference Python 3.14+.
  • Switch API and Bot service Dockerfiles to use python:3.14-slim for both builder and runtime stages.
  • Update docs CI workflow to install Python 3.14 via uv.
pyproject.toml
packages/byte-common/pyproject.toml
services/api/pyproject.toml
services/bot/pyproject.toml
services/api/Dockerfile
services/bot/Dockerfile
services/api/README.md
services/bot/README.md
services/worker/README.md
packages/byte-common/README.md
.pre-commit-config.yaml
.sourcery.yaml
sonar-project.properties
.python-version
.tool-versions
.github/workflows/docs.yml
Refine CD workflow to generate and push changelog updates on tagged releases using a separate git worktree with explicit permissions and safe no-op handling.
  • Extend CD workflow triggers to run on version tags and published releases in addition to manual dispatch.
  • Grant contents: write permissions to the changelog job to allow committing from the workflow.
  • Fetch latest main, create a git worktree pointing at origin/main, and run git-cliff there to generate docs/changelog.rst.
  • Commit and push changelog changes from the worktree only when there are staged diffs, using a [skip ci] marker and pushing HEAD:main instead of using a raw token URL.
  • Ensure the worktree is removed in a cleanup step that always runs.
.github/workflows/cd.yml
Simplify prek integration in CI by replacing inline installation and cache management with a dedicated GitHub Action.
  • Remove manual uv-based prek installation, cache configuration, and direct command invocation in CI.
  • Use j178/prek-action@v1 to run prek checks in a single workflow step.
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 04:52 Destroyed
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The updated cd.yml now triggers on all tags matching v* and published releases, which may be broader than intended; consider scoping this (e.g., exclude pre-releases or specific tag patterns) if you only want deployments on certain release types.
  • The changelog generation job assumes an origin/main branch and a sufficiently deep fetch for git worktree to work; you may want to ensure actions/checkout uses fetch-depth: 0 and/or parameterize the base branch in case the default branch changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The updated cd.yml now triggers on all tags matching `v*` and published releases, which may be broader than intended; consider scoping this (e.g., exclude pre-releases or specific tag patterns) if you only want deployments on certain release types.
- The changelog generation job assumes an `origin/main` branch and a sufficiently deep fetch for `git worktree` to work; you may want to ensure `actions/checkout` uses `fetch-depth: 0` and/or parameterize the base branch in case the default branch changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:00 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:10 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:14 Destroyed
Base automatically changed from feature/phase1-4-cleanup-monolith to main November 23, 2025 05:18
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:23 Destroyed
@JacobCoffee JacobCoffee changed the title chore: migrate project to Python 3.14 chore: migrate project to Python 3.13 Nov 23, 2025
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:30 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:36 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:37 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:38 Destroyed
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:43 Destroyed
JacobCoffee and others added 15 commits November 22, 2025 23:44
Update default Python version in .pre-commit-config.yaml to 3.14.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update requires-python to >=3.14,<4.0 across all package configurations:
- Root pyproject.toml (Python 3.14 classifier and ruff target)
- byte-common package
- API service
- Bot service

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update all README files to reference Python 3.14+ instead of 3.12+:
- byte-common package
- API service
- Bot service
- Worker service

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update Python version configuration for quality analysis tools:
- Sourcery: python_version to 3.14
- SonarQube: sonar.python.version to 3.14

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update base images from python:3.12-slim to python:3.14-slim:
- API service Dockerfile (builder and runtime stages)
- Bot service Dockerfile (builder and runtime stages)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update docs.yml workflow to install Python 3.14 via uv.

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

Co-Authored-By: Claude <noreply@anthropic.com>
uv was looking for byte_bot_service/ based on project name but the
actual module is byte_bot/. Configure build backend to use src/ as
module root.
Change name from 'byte-bot-service' to 'byte-bot' to match the actual
module name 'byte_bot' (uv converts hyphens to underscores).
Set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 in CI workflows to allow
building Python packages that use PyO3 (Rust bindings) with Python 3.14.

PyO3 0.24.1 officially supports up to Python 3.13, but the ABI3 forward
compatibility mode allows building with Python 3.14 using the stable ABI.

This resolves build failures for dependencies like watchfiles (used by
sphinx-autobuild) that haven't yet updated their PyO3 version.

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

Co-Authored-By: Claude <noreply@anthropic.com>
While Python 3.14 was released, core dependencies like Litestar and
pydantic-core don't yet support it. Downgrading to Python 3.13 which
has full ecosystem support.

Changes:
- Update version control files (.python-version, .tool-versions)
- Update all pyproject.toml requires-python to >=3.13
- Update ruff target-version to py313
- Update Dockerfiles to python:3.13-slim
- Update CI workflows to install Python 3.13
- Update all README documentation
- Update quality tool configurations (sourcery, sonar)
- Remove PyO3 forward compatibility workaround (not needed for 3.13)

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

Co-Authored-By: Claude <noreply@anthropic.com>
The CI was using python-version-file: "pyproject.toml" which expects
a requires-python field. However, the root pyproject.toml is now a
workspace-only configuration (after Phase 1.4 cleanup) and doesn't
have a [project] section or requires-python field.

Changed all jobs to use .python-version file instead, which is
correctly set to 3.13.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Changed Python version requirement from 3.14+ to 3.13+ in the bot
service README to match the rest of the migration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@JacobCoffee JacobCoffee force-pushed the feature/migrate-to-python3.14 branch from f832e7c to 20c8a9c Compare November 23, 2025 05:57
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 05:57 Destroyed
Update code to use Python 3.13 features:
- Use `type` keyword for type aliases (PEP 695)
- Use generic function syntax with type parameters
- Remove unnecessary default type arguments
- Remove unused TypeVar in favor of PEP 695 syntax
@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-116) November 23, 2025 06:03 Destroyed
@JacobCoffee JacobCoffee merged commit 6da403d into main Nov 23, 2025
4 of 5 checks passed
@JacobCoffee JacobCoffee deleted the feature/migrate-to-python3.14 branch November 23, 2025 06:04
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.

1 participant