chore: migrate project to Python 3.13#116
Merged
JacobCoffee merged 16 commits intomainfrom Nov 23, 2025
Merged
Conversation
|
🚅 Deployed to the byte-pr-116 environment in byte
|
Contributor
Reviewer's GuideMigrates 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 workflowsequenceDiagram
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)"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
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/mainbranch and a sufficiently deep fetch forgit worktreeto work; you may want to ensureactions/checkoutusesfetch-depth: 0and/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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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>
f832e7c to
20c8a9c
Compare
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
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.
Summary
Migrates the entire Byte Bot project from Python 3.12 to Python 3.14.
Changes
Version Control
.python-versionto 3.14.tool-versionsto python 3.14Package Configuration
requires-python = ">=3.14,<4.0"across all pyproject.toml filesbyte-commonpackagetarget-versiontopy314Documentation
packages/byte-common/README.mdservices/api/README.mdservices/bot/README.mdservices/worker/README.mdConfiguration Files
.sourcery.yamlpython_version to 3.14.pre-commit-config.yamldefault_language_version to 3.14sonar-project.propertiessonar.python.version to 3.14Docker Infrastructure
services/api/Dockerfilebase images topython:3.14-slimservices/bot/Dockerfilebase images topython:3.14-slimCI/CD
.github/workflows/docs.ymlto install Python 3.14Testing
Checklist
🤖 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:
CI:
Deployment:
Documentation: