GH-49273: [Python] Move stub docstring script to _build_utils with gr…#49357
GH-49273: [Python] Move stub docstring script to _build_utils with gr…#49357vanshaj2023 wants to merge 8 commits intoapache:mainfrom
Conversation
…ith graceful degradation
…docstrings-build-utils
|
Thanks for working on this @vanshaj2023. I've kicked off a CI-workflow to see if it works on our CI. |
…docstrings-build-utils
…vanshaj2023/arrow into fix-stub-docstrings-build-utils
…docstrings-build-utils
…-core backend - Add build_wheel wrapper to _build_backend/__init__.py that copies .pyi stubs into the wheel and injects docstrings from the built pyarrow runtime - Make libcst optional (graceful degradation when not installed) - Add wheel.exclude to prevent pyarrow/_build_utils from being packaged - Support PYARROW_SKIP_STUB_DOCSTRINGS=1 env var to skip injection
|
Hey @vanshaj2023, thanks for the update. Meanwhile we refactored the build system #49259 and docstring injection script is getting refactored as well #49453, let's revisit #49273 (and this PR) once #49453 is merged. Sorry for the uncertainty here, but this is a rapidly evolving part of the project. |
Rationale for this change
Follow-up to #49235 and #49273. The
update_stub_docstrings.pyscript was added toMANIFEST.into fix nightly sdist builds, but it used a fragileimportlib.util.spec_from_file_locationpattern and forcedlibcstas a hard build dependency. This gives the script a proper home and makes builds more robust for users on exotic platforms who may not havelibcst.What changes are included in this PR?
scripts/update_stub_docstrings.pytopyarrow/_build_utils/update_stub_docstrings.py_build_utilsis auto-included in sdist via existinggraft pyarrow, excluded from wheels viasetuptools.packages.find.excludeimportlib.util.spec_from_file_locationinsetup.pywith a normal import wrapped intry/except ImportErrorlibcsta soft build dependency inpyproject.toml(CI still installs it viarequirements-build.txt)PYARROW_SKIP_STUB_DOCSTRINGSenv var for explicit opt-outscripts/update_stub_docstrings.pyas a thin CLI wrapperAre these changes tested?
No new tests. Verified that all modified files pass flake8, graceful degradation catches ImportError cleanly, and CI requirements files still include
libcstso official wheels get docstrings.Are there any user-facing changes?
No. Users building from sdist without
libcstwill now get stubs without docstrings instead of a build failure.