Skip to content

Support prompts indicate freethreaded build status #3554

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

oddbookworm
Copy link
Member

@oddbookworm oddbookworm commented Aug 9, 2025

Summary by CodeRabbit

  • New Features
    • Support prompt now shows the Python version with the interpreter’s GIL status on supported environments (CPython 3.13+ with configurable GIL, non-WASM platforms).
    • Prompt indicates whether the GIL is enabled or disabled to improve runtime visibility for users.
    • Existing behavior—conditional display via environment variable and SDL version output—remains unchanged.

@oddbookworm oddbookworm force-pushed the update-prompt-with-freethreading-info branch from 799358f to 3d892c1 Compare August 9, 2025 14:08
@oddbookworm
Copy link
Member Author

Python 3.9
image

Python 3.12
image

Python 3.13 (not a freethreaded build)
image

Python 3.13 free-threaded (GIL Enabled)
image

Python 3.13 free-threaded (GIL Disabled)
image

@Starbuck5 Starbuck5 marked this pull request as draft August 17, 2025 06:22
Copy link

coderabbitai bot commented Aug 17, 2025

Walkthrough

Adds conditional logic in src_py/__init__.py to compute a GIL-aware Python version suffix for the support prompt on non-wasi/wasm platforms when running Python ≥ 3.13 with Py_GIL_DISABLED. It prints "Python {python_version}" with the appended ", GIL" or ", No GIL" and then removes temporary variables; other behavior unchanged.

Changes

Cohort / File(s) Summary of Changes
Support prompt GIL-aware version
src_py/__init__.py
When the support prompt is shown, import sysconfig on eligible platforms and compute python_version from platform.python_version() plus a suffix of ", GIL" or ", No GIL" depending on sys._is_gil_enabled(). Use the computed version in the printed prompt and delete temporary variables after printing. No public API changes.

Sequence Diagram(s)

sequenceDiagram
    participant Importer
    participant Init as src_py/__init__.py
    participant Env as Environment
    participant Sys as sys/sysconfig

    Importer->>Init: import module
    Init->>Env: check PYGAME_HIDE_SUPPORT_PROMPT
    alt prompt visible
        Init->>Init: check platform and Python >= 3.13
        alt Py_GIL_DISABLED available
            Init->>Sys: import sysconfig
            Init->>Sys: call platform.python_version() and sys._is_gil_enabled()
            Init->>Init: build python_version + ", GIL"/", No GIL"
            Init->>Importer: print support prompt with Python {python_version}
            Init->>Init: delete temp vars
        else not eligible
            Init->>Importer: print support prompt with platform.python_version()
        end
    else prompt hidden
        Init-->>Importer: no prompt printed
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble bytes beneath the sill,
A tiny tag to mark the GIL.
Whether bound or running free,
The prompt now hums its parity.
Hopping logs with joyful thrill. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bf33556 and 621260e.

📒 Files selected for processing (1)
  • src_py/__init__.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src_py/init.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: i686
  • GitHub Check: aarch64
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.9.23)
  • GitHub Check: AMD64
  • GitHub Check: x86
  • GitHub Check: Debian (Bookworm - 12) [armv7]
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: build (windows-latest)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: dev-check
  • GitHub Check: build (ubuntu-22.04)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@oddbookworm oddbookworm marked this pull request as ready for review August 17, 2025 13:55
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src_py/__init__.py (1)

411-411: Nit: use “GIL Enabled/Disabled” instead of “GIL/No GIL” for clarity and consistency.

Matches the wording shown in the PR screenshots and reads clearer.

-        python_version += f"t, {'' if sys._is_gil_enabled() else 'No '}GIL"
+        python_version += f"t, GIL {'Enabled' if sys._is_gil_enabled() else 'Disabled'}"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a88e23b and bf33556.

📒 Files selected for processing (1)
  • src_py/__init__.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src_py/__init__.py (1)
buildconfig/stubs/pygame/base.pyi (1)
  • get_sdl_version (17-17)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: i686
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: aarch64
  • GitHub Check: x86_64
  • GitHub Check: Debian (Bookworm - 12) [armv7]
🔇 Additional comments (2)
src_py/__init__.py (2)

402-405: LGTM: scoped import and cleanup.

Importing sysconfig only when the prompt is shown and cleaning it up afterward keeps the module namespace tidy. The temporary python_version variable is also correctly deleted.

Also applies to: 417-417


415-415: LGTM: switched to the computed python_version.

Printing the dynamically annotated Python version is correct and keeps the rest of the prompt unchanged.

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants