-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[package] CPython: Misc recipe improvements #23151
Comments
Regarding conf info and environment variables: Currently, we have the following defined: Env:
Conf:
I'm unsure of the use of the |
Regarding transparent FindPython integration, I've played with a few ideas:
I think (1) is the ideal route, but I need to figure out why Debug mode on Windows isn't working. Maybe it's a bug in CMake, unsure. |
For |
That seems to work with Release mode on Windows, but not Debug (seems to really want to pick any other version on the system). I suppose it's less of an issue if it's in the build context, since that will usually be release mode, but I would like it to work without issue. |
Update on the find_package issue regarding Windows Debug mode: I don't think it will be possible to just do nothing on our side and have it work, but I can get it to work in the test package (and consequently in other recipes) by defining just |
Regarding options that might not work: All of these options default to on, so I tried disabling all of them, then reverted the ones that caused test failures. For Windows: 3 options are removed for Windows: No notably changes were made to the build system at any point, so I only tested 3.10.14. For non-Windows platforms: (Tested on Ubuntu 22.04) The build system for modules changed significantly between 3.10 and 3.12, with 3.11 being in a transition state, so I tested all 3. Pre-3.10 not much changed. (Also to note, so far I don't see much change between 3.12 and 3.13.) All options work in all versions. Some options, however, will not correctly apply if the respective system package is installed, for example Honorable mention to Edit: After removing |
I'm making this issue to serve as a TODO list of things that I believe need to be done in the CPython recipe:
Emulate CMake's built-in
find_package(Python)
: Currently this is justfind_package(cpython)
, but we need to manually pass in a bunch of extra variables to make sure we find the Conan one. We should be able to usefind_package(Python)
without this extra setup. We would need to include Python_add_library, which is implemented in CMake here: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindPython/Support.cmake?ref_type=heads#L4016. Potentially we could have this as an option. Details in comments.Check which options are actually usable: Many of the options (like with_lzma) imply that there is a way to not include certain dependencies/packages, but I suspect with recent changes that many of these no longer work (or maybe never did). For each of these we should determine if it is actually possible to implement it properly, and remove it if it is either impossible or highly unfeasible.
Add 3.13 (once released): I expect this to not have too many breaking changes regarding the build system, but I at least know that some standard library modules have been removed: https://peps.python.org/pep-0594/. The main ones of note are
nis
,msilib
, andcrypt
, which I believe are the only ones that would affect the recipe (mainly just disabling things in 3.13+)Enabling the
optimizations
andlto
options, and ideally turn it on by default, at least in Release mode: This would ensure the Conan Python packages are on par speed-wise with the official binaries.Setting shared by default: Windows static mode has not worked since about 3.10, and seems to only be supported on a best-effort basis (Are static library builds on Windows still supported? python/cpython#110234). Linux/Mac static builds work and are fully functional, but on all OSs shared seems to be the preferred distribution method. For Windows specifically, it's a bit annoying for the default configuration to be invalid.
Simplifying/fixing defined conf info and environment variables (detail in comments).
Moving Windows' install up one directory: There is a lot of conditional logic for Windows installs/package info, since it puts everything in
self.package_folder/bin
, rather thanself.package_folder
directly. I believe this was a workaround in the original PR due to limitations in Conan at the time, I'm fairly sure it could be moved now. My only possible concern is regarding linters, it might not like that layout.Model Python C Module dependencies(expat, bz2, xz_utils, etc) in package: Right now, they are propagated through the
_hidden
component, but they can still get linked. It seems the only reason the_hidden
component exists is to stop the "Required package not in component requires" error, but perhaps there is a better way.transitive_libs=False
?visible=False
? Not sure.Fix Windows all-shared build: This is currently skipped in CI due to mpdecimal not supporting shared mode by default (with additional c++ things). At minimum, it should work with all other dependencies in shared mode, ideally we should get CI to also run this config, either by tweaking the mpdecimal or cpython recipes.
Add options to enable GIL-less Python and for the experimental JIT.
Fix mpdecimal 2.5.1 on Mac. I believe this is caused by CPython using a fork of mpdecimal with some extra configuration settings, on Mac it builds universal binaries (Or so I think, it defines a UNIVERSAL macro which in turn defines other config macros). Will need to analyze a diff.
Fix using the Python Limited API on Windows. Adding this triggers a
#pragma(comment lib ...)
, which fails because the link directories aren't available.Test the latest CMake: PR https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9482 introduces some changes to Windows/Debug mode, perhaps it could simplify some handling in the test package.
Other notes:
The text was updated successfully, but these errors were encountered: