-
Notifications
You must be signed in to change notification settings - Fork 61
feat: move Pythonizations implementations to source files #908
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
feat: move Pythonizations implementations to source files #908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the Pythonizations implementation by moving function definitions from inline functions in the header file to a separate source file. This change enables the headers to be included in C++20 modules while maintaining the same functionality.
- Function implementations moved from
static inlinein header to regular definitions in source file - Added
target_link_libraries(podio PRIVATE Python3::Python)to CMakeLists.txt - Header file now contains only forward declarations
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Pythonizations.cc |
New source file containing implementations of subscript and pythonize_subscript functions |
include/podio/detail/Pythonizations.h |
Refactored to contain only function declarations, removed inline implementations and <stdexcept> include |
src/CMakeLists.txt |
Added Pythonizations.cc to core_sources and linked Python3 library |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
|
||
| PODIO_ADD_LIB_AND_DICT(podio "${core_headers}" "${core_sources}" selection.xml) | ||
| target_compile_options(podio PRIVATE -pthread) | ||
| target_link_libraries(podio PRIVATE Python3::Python) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this probably should have been in the Python:: namespace since that's what is added as a dependency in the config
podio/cmake/podioConfig.cmake.in
Lines 28 to 32 in 5d82748
| if(NOT "@REQUIRE_PYTHON_VERSION@" STREQUAL "") | |
| find_dependency(Python @REQUIRE_PYTHON_VERSION@ COMPONENTS Interpreter Development) | |
| else() | |
| find_dependency(Python COMPONENTS Interpreter Development) | |
| endif() |
and in the
PODIO_GENERATE_DATAMODEL module:Line 158 in 5d82748
| COMMAND ${Python_EXECUTABLE} ${podio_PYTHON_DIR}/podio_class_generator.py ${CLANG_FORMAT_ARG} ${SCHEMA_EVOLUTION_ARG} ${UPSTREAM_EDM_ARG} ${YAML_FILE} ${ARG_OUTPUT_FOLDER} ${datamodel} ${ARG_IO_BACKEND_HANDLERS} ${LANGUAGE_ARG} ${VERSION_ARG} ${OLD_DESCRIPTION_ARG} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then again, the package that is found is Python3...
Lines 197 to 200 in 5d82748
| if(NOT PODIO_RELAX_PYVER) | |
| find_package(Python3 ${REQUIRE_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Development Interpreter) | |
| else() | |
| find_package(Python3 ${REQUIRE_PYTHON_VERSION} REQUIRED COMPONENTS Development Interpreter) |
This PR moves the implementation of Pythonizations detail functions into a source file. This allows the headers to be included in C++20 modules (#907).
BEGINRELEASENOTES
ENDRELEASENOTES