Skip to content

Conversation

@danparizher
Copy link
Contributor

@danparizher danparizher commented Oct 27, 2025

Summary

Fixed the Python 3.14 crash in ruff-ecosystem by updating event loop handling.

Fixes #20965

Changes Made

1. python/ruff-ecosystem/ruff_ecosystem/cli.py (line 90-91)

  • Replaced asyncio.get_event_loop() with asyncio.new_event_loop() and asyncio.set_event_loop(loop)

2. scripts/check_ecosystem.py (line 531-532)

  • Applied the same update

Why This Works

In Python 3.14, asyncio.get_event_loop() raises when no loop exists. Creating the loop explicitly ensures:

  • Python 3.10+ support
  • Signal handler behavior preserved
  • Loop is closed in the finally block

@charliermarsh charliermarsh requested a review from zanieb October 27, 2025 01:42
@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@AlexWaygood AlexWaygood added the internal An internal refactor or improvement label Oct 27, 2025
@MichaReiser MichaReiser requested a review from amyreese October 27, 2025 07:38
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Please can you also make this change to our workflow file, if this fixes the crash:

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index c57773078f..131f76acad 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -531,8 +531,7 @@ jobs:
           persist-credentials: false
       - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
         with:
-          # TODO: figure out why `ruff-ecosystem` crashes on Python 3.14
-          python-version: "3.13"
+          python-version: ${{ env.PYTHON_VERSION }}
           activate-environment: true
 
       - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0

Replaces the hardcoded Python version with the PYTHON_VERSION environment variable in the setup-uv step for improved flexibility and configurability.
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you.

@MichaReiser MichaReiser merged commit 980b4c5 into astral-sh:main Oct 29, 2025
38 checks passed
@danparizher danparizher deleted the fix-20965 branch October 29, 2025 21:53
dcreager added a commit that referenced this pull request Oct 30, 2025
* origin/main: (21 commits)
  [ty] Update "constraint implication" relation to work on constraints between two typevars (#21068)
  [`flake8-type-checking`] Fix `TC003` false positive with `future-annotations` (#21125)
  [ty] Fix lookup of `__new__` on instances (#21147)
  Fix syntax error false positive on nested alternative patterns (#21104)
  [`pyupgrade`] Fix false positive for `TypeVar` with default on Python <3.13 (`UP046`,`UP047`) (#21045)
  [ty] Reachability and narrowing for enum methods (#21130)
  [ty] Use `range` instead of custom `IntIterable` (#21138)
  [`ruff`] Add support for additional eager conversion patterns (`RUF065`) (#20657)
  [`ruff-ecosystem`] Fix CLI crash on Python 3.14 (#21092)
  [ty] Infer type of `self` for decorated methods and properties (#21123)
  [`flake8-bandit`] Fix correct example for `S308` (#21128)
  [ty] Dont provide goto definition for definitions which are not reexported in builtins (#21127)
  [`airflow`] warning `airflow....DAG.create_dagrun` has been removed (`AIR301`) (#21093)
  [ty] follow the breaking API changes made in salsa-rs/salsa#1015 (#21117)
  [ty] Rename `Type::into_nominal_instance` (#21124)
  [ty] Filter out "unimported" from the current module
  [ty] Add evaluation test for auto-import including symbols in current module
  [ty] Refactor `ty_ide` completion tests
  [ty] Render `import <...>` in completions when "label details" isn't supported
  [`refurb`] Preserve digit separators in `Decimal` constructor (`FURB157`) (#20588)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruff-ecosystem CLI crashes on Python 3.14

3 participants