-
Notifications
You must be signed in to change notification settings - Fork 2k
chore(deps): upgrade to Python 3.13 #39566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
webjunkie
wants to merge
8
commits into
master
Choose a base branch
from
chore/upgrade-python-313
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+843
−758
Conversation
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
Update numpy from 1.26.4 to ~=2.1.0 (resolved to 2.1.3) Update pandas from 2.2.0 to ~=2.2.2 (resolved to 2.2.3) - required for numpy 2.x compatibility Update scikit-learn to use ~=1.5.0 specifier for consistency Numpy 2.0+ is required for Python 3.13 support. Verified all breaking changes: - No deprecated functions used in codebase (checked np.tostring, np.alltrue, etc.) - Ruff NPY201 checks passed - All experiment statistics tests (41 tests) passed - Basic numpy operations verified working Pandas 2.2.2+ required for numpy 2.x support per upstream compatibility matrix.
Upgrade Python from 3.12.11 to 3.13.7 across all environments. Includes uv upgrade from 0.7.8 to 0.8.19 to enable Python 3.13.7 downloads. As documented in uv Python versions guide: "The available Python versions are frozen for each uv release. To install new Python versions, you may need upgrade uv." Python 3.13.7 chosen over 3.13.8 because uv 0.8.19 (latest in flox) was released Sept 19, 2025, before python-build-standalone added 3.13.8 on Oct 7, 2025. Changes: - Update pyproject.toml requires-python to 3.13.7 - Update Dockerfiles to python:3.13.7-slim-bookworm - Update all GitHub workflows to Python 3.13.7 and uv 0.8.19 - Update flox manifest to uv 0.8.19 - Update mypy cache key to 3.13 - Update test snapshots for Python 3.13 paths Breaking changes will be addressed in follow-up PRs as needed.
It looks like the code of |
ast.Num is deprecated as of Python 3.8 and will be removed in Python 3.14. Use ast.Constant instead, which is the unified node type for all constants.
Replace datetime.utcfromtimestamp() with datetime.fromtimestamp(, datetime.UTC). The utc* methods are deprecated in Python 3.12+ and will be removed in a future version. Partial fix - more datetime deprecations remain in other files.
Replace deprecated UTC datetime methods with Python 3.13-compatible equivalents: - datetime.utcnow() → datetime.now(datetime.UTC) - datetime.utcfromtimestamp(ts) → datetime.fromtimestamp(ts, datetime.UTC) These methods are deprecated in Python 3.12+ and will be removed in a future version. Affected files: - common/hogvm/python/stl/__init__.py (5 occurrences) - ee/api/sentry_stats.py - ee/tasks/auto_rollback_feature_flag.py - ee/tasks/subscriptions/__init__.py - posthog/temporal/subscriptions/subscription_scheduling_workflow.py - posthog/session_recordings/queries/test/session_replay_sql.py - posthog/session_recordings/queries/test/listing_recordings/test_session_recording_list_from_query.py - posthog/session_recordings/queries/sub_queries/person_ids_subquery.py - posthog/management/commands/analyze_behavioral_cohorts.py
pyodbc 5.1.0 fails to build on Python 3.13 due to a setup.py issue. Upgrade to 5.2.0 which has Python 3.13 support.
Remove packages declaration for hogql_parser-stubs and rely on MANIFEST.in for including stub files. Add Python 3.13 classifier. Note: Building still requires --no-build-isolation-package flag with uv until all dependency build issues are resolved.
0c88272
to
df1971e
Compare
It looks like the code of |
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
Upgrade from Python 3.12.11 to Python 3.13.7, including deprecation fixes and dependency updates.
Analysis of 83 pinned dependencies found 42 released before Python 3.13.0 (Oct 7, 2024). These have been prioritized into 4 upgrade batches based on criticality and Python 3.13 compatibility.
Progress
Core Python Changes
Batch 1: Critical Blockers (Must Upgrade Now)
Criteria: Confirmed/likely build failures on 3.13, missing 3.13 wheels/classifiers, or known ecosystem pivots.
KeyError: '__version__'
on 3.13. Pillow 11 is first line with official 3.13 support.Risk: Medium (ClickHouse component is the only "spicy" one)
Testing: 1-2 days total CI + smoke (API I/O, data export paths, Celery flows, XML/HTML parsing, image ops)
Notes: Keep Celery + Kombu aligned; confirm normal 3.13 (not free-threaded) in prod until stack is ready.
Batch 2: High Priority (Native Deps / Security / Infra)
Criteria: Native code or transitive Rust/C; should be modern before/with the Python jump.
paramiko[invoke]
deprecated). Re-run SSH key auth flows.Risk: Low-Medium (crypto/SSH are sensitive)
Testing: 1 day - SSH (Paramiko), TLS handshakes (requests/boto), Excel export/import regressions
Batch 3: Test First (Pure Python, Likely Fine)
Criteria: Pure Python libs that typically "just work" on new CPython.
Risk: Low
Testing: 1 day - app smoke tests; focus on integrations (AWS, Redis, DRF CSV, admin impersonation)
Batch 4: Defer (Ancient but Stable / Niche)
Criteria: Old but low-surface or internal-only; upgrade if tests reveal issues.
Risk: Very low
Testing: Ad hoc only when choose to bump
Build & Deploy
Dependency Relationships & Coupling
Breaking Changes to Watch (High Level)
Recommended Execution Order
Blockers & Concerns
Estimated Testing Effort
Key Python 3.13 Changes
Reference: https://docs.python.org/3/whatsnew/3.13.html
Final Sanity Checks Before Merge