Skip to content

Conversation

Copy link

Copilot AI commented Sep 23, 2025

This PR adds complete support for Python 3.14 free-threaded builds (python3.14t) to fix installation and build issues where the package would fail to build wheels or generate config files for free-threaded Python interpreters.

Changes Made

Core Implementation

  • Free-threaded Detection: Added is_free_threaded_python() function that correctly identifies free-threaded Python by checking if the executable name ends with 't' or 't.exe'
  • Dynamic Config File Naming: Enhanced the build system to generate config-3t.py for free-threaded builds versus config-3.py for standard builds, with fallback logic for compatibility
  • Build System Integration: CMake arguments now properly handle free-threaded executables through -DPYTHON3_EXECUTABLE and -DPYTHON_DEFAULT_EXECUTABLE parameters

Bug Fixes

  • Fixed scripts/init.py: Added missing imports (import os, import sys) and properly defined LOADER_DIR variable that was causing import errors
  • Updated Documentation: Added Python 3.14 to the supported versions list in README.md

Metadata Updates

  • Setup.py Classifiers: Added "Programming Language :: Python :: 3.14" classifier for proper PyPI metadata

Example Usage

The implementation automatically detects free-threaded Python builds:

# Standard Python 3.14
$ python3.14 setup.py bdist_wheel
# → Uses config-3.py

# Free-threaded Python 3.14
$ python3.14t setup.py bdist_wheel  
# → Uses config-3t.py, detects free-threaded mode

Testing

All functionality has been validated to ensure:

  • ✅ Free-threaded detection works for various executable patterns (python3.14t, python3.14t.exe)
  • ✅ Config file naming generates correct filenames based on Python type
  • ✅ CMake arguments properly pass free-threaded executable paths
  • ✅ Build system works for both standard and free-threaded Python 3.14
  • ✅ No regression in existing functionality

This resolves build failures when attempting to create wheels with free-threaded Python 3.14 interpreters and ensures the package works correctly with Python's new free-threading feature.

This pull request was created as a result of the following prompt from Copilot chat.

Adds support for Python 3.14 free-threaded builds (python3.14t) in setup.py. This fixes an installation/build issue where the package would fail to build wheels or generate config files for free-threaded Python 3.14. Key changes: setup.py now detects the free-threaded executable, handles config file naming, and ensures build scripts and config files work for both standard and free-threaded Python 3.14.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@mohsinkhan85090 mohsinkhan85090 marked this pull request as ready for review September 23, 2025 04:32
@mohsinkhan85090 mohsinkhan85090 merged commit f67f07c into fix-python314-support Sep 23, 2025
1 check passed
Copilot AI changed the title [WIP] Support Python 3.14 free-threaded (python3.14t) build and config in setup.py Add support for Python 3.14 free-threaded builds (python3.14t) in setup.py Sep 23, 2025
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.

2 participants