raulcd commented on code in PR #49453:
URL: https://github.com/apache/arrow/pull/49453#discussion_r2930091610
##########
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:
This will happen for everything not only for wheels, I am wondering whether
we want this warning at all we already have the checks for the wheels and we
are setting `PYARROW_REQUIRE_STUB_DOCSTRINGS` on those. The validation of the
wheel will fail if files are not present and this warning will appear every
time we build locally now. Probably we can just remove the `else` case here?
```suggestion
message(WARNING "PyArrow stub source directory not found at
${PYARROW_STUBS_SOURCE_DIR}; "
"PyArrow will be built without .pyi files.")
```
--
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]