rok commented on code in PR #49453:
URL: https://github.com/apache/arrow/pull/49453#discussion_r2930239569
##########
python/CMakeLists.txt:
##########
@@ -1025,3 +1025,39 @@ if(PYARROW_BUILD_PARQUET)
target_link_libraries(_parquet_encryption PRIVATE
arrow_python_parquet_encryption)
endif()
endif()
+
+#
+# Type stubs with docstring injection
+#
+# Stubs live in pyarrow-stubs/pyarrow/ during development but are installed
+# alongside the package so type checkers can find them (PEP 561).
+set(PYARROW_STUBS_SOURCE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/pyarrow-stubs/pyarrow")
+if(EXISTS "${PYARROW_STUBS_SOURCE_DIR}")
+ install(DIRECTORY "${PYARROW_STUBS_SOURCE_DIR}/"
+ DESTINATION "."
+ FILES_MATCHING
+ PATTERN "*.pyi")
+
+ if(PYARROW_REQUIRE_STUB_DOCSTRINGS)
+ install(CODE "
+ execute_process(
+ COMMAND \"${Python3_EXECUTABLE}\"
+
\"${CMAKE_CURRENT_SOURCE_DIR}/scripts/update_stub_docstrings.py\"
+ \"${CMAKE_INSTALL_PREFIX}\"
+ \"${CMAKE_CURRENT_SOURCE_DIR}\"
+ RESULT_VARIABLE _pyarrow_stub_docstrings_result
+ )
+ if(NOT _pyarrow_stub_docstrings_result EQUAL 0)
+ message(FATAL_ERROR \"Stub docstring injection failed (exit code:
\${_pyarrow_stub_docstrings_result})\")
+ endif()
+ ")
+ endif()
+else()
+ if(PYARROW_REQUIRE_STUB_DOCSTRINGS)
+ message(FATAL_ERROR "PyArrow stub source directory not found at
${PYARROW_STUBS_SOURCE_DIR}; "
+ "cannot build wheel without .pyi files.")
+ else()
+ message(WARNING "PyArrow stub source directory not found at
${PYARROW_STUBS_SOURCE_DIR}; "
+ "wheel will be built without .pyi files.")
Review Comment:
Good point! I removed the else clause now, so we don't get too much noise.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]