Skip to content

[FR] Add support for building exes using C source files. #5135

@AraHaan

Description

@AraHaan

What's the problem this feature will solve?

I would like to have setuptools be used to build exes for my package that are built as follows:

  • 1 that embeds python and defines Py_LIMITED_API for version 3.9 as the API baseline.
  • 1 exe that does not embed python but acts as an SFX exe for the embedded python interpreter.

I basically then have to later on take this setup.py and use it to build the exe's with 3.14.2-32, 3.14.2-64, and 3.14.2-arm64 via github actions (the versions listed use the python install manager version formatting).

I could then use meson-python for the main project (after using setuptools) on a job after building the exes which downloads the built exe artifacts and packs all of them into the x86, x64, and the arm64 wheels. This is because the user could request my package to build an embedded python for those specific CPU architectures for which I must support even if their CPU is not arm64 (even if it is x64 or even x86).

Having this support built in would make deployment much easier for me as well.

Describe the solution you'd like

The solution is for a module that is meant to build exe's similar to the Extension class that exists in setuptools.extension except it allows one to build the exe using a C/C++ compiler, provide macros, provide the libraries to target, as well as the include & library directories.

The type could default also add the python include and library directories for the user just like with Extension.

Alternative Solutions

I currently use meson-python for this as well, but it does not let me to directly write the exe files to my dist\ folder without it deleting the temp build directory with the build output folder where the exe's are output into without simply extracting them from the wheels.

Additional context

I am not sure this needs any additional context as I tried to provide as much context as possible above. Let me know if more information is actually needed.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions