Skip to content

Conversation

@wdconinc
Copy link
Contributor

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

  • Move Pythonizations detail implementations to separate source file

ENDRELEASENOTES

Copilot AI review requested due to automatic review settings December 22, 2025 17:42
Copy link
Contributor

Copilot AI left a 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 inline in 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.

@tmadlener tmadlener enabled auto-merge (squash) December 22, 2025 19:19
@tmadlener tmadlener merged commit 7187c36 into AIDASoft:master Dec 22, 2025
26 checks passed
@wdconinc wdconinc deleted the pythonizations-impl-in-lib branch December 22, 2025 19:40

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)
Copy link
Contributor Author

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

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:
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}

Copy link
Contributor Author

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...

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)

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