Skip to content

GH-50702: [Python] Fix .pyx changes requiring two builds to take effect - #50719

Merged
pitrou merged 1 commit into
apache:mainfrom
pratyushadk:GH-50702-fix-cython-byproducts
Jul 30, 2026
Merged

GH-50702: [Python] Fix .pyx changes requiring two builds to take effect#50719
pitrou merged 1 commit into
apache:mainfrom
pratyushadk:GH-50702-fix-cython-byproducts

Conversation

@pratyushadk

@pratyushadk pratyushadk commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

I noticed while editing a .pyx file that my changes weren't
showing up after a rebuild — I had to build twice. Traced it
to BYPRODUCTS being commented out in UseCython.cmake.

What changes are included in this PR?

I uncommented BYPRODUCTS ${_generated_files} in
cpp/cmake_modules/UseCython.cmake. Without it, CMake doesn't
realize the .cpp was updated in the same build pass, so it
skips recompiling the .so until the next build.

The line was commented out for older CMake compatibility — but
the project requires CMake >= 3.25 now, and BYPRODUCTS has
worked since 3.2, so that's no longer a concern.

Are these changes tested?

This is a build system fix so there's no unit test for it.
The CI builds pyarrow from source and runs the full test suite,
which will validate the build still works correctly.

Are there any user-facing changes?

No — this only improves the dev experience when iterating on
.pyx files. One build instead of two.

Copilot AI review requested due to automatic review settings July 29, 2026 16:58
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50702 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes incremental rebuild behavior for PyArrow Cython extensions by teaching CMake that the generated C/C++ sources (and related headers) are build byproducts of the Cython custom target, so downstream compilation can re-trigger in the same build pass.

Changes:

  • Re-enabled BYPRODUCTS ${_generated_files} on the Cython add_custom_target(...) invocation to ensure build tools (e.g., Ninja) correctly track generated outputs.

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, let's check that CI is happy

@pitrou

pitrou commented Jul 30, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g python

@pitrou

pitrou commented Jul 30, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit wheelcp314t*

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Revision: 425963c

Submitted crossbow builds: ursacomputing/crossbow @ actions-687b996793

Task Status
wheel-macos-monterey-cp314-cp314t-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-arm64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-amd64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-arm64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-amd64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-arm64 GitHub Actions
wheel-windows-cp314-cp314t-amd64 GitHub Actions

@github-actions

Copy link
Copy Markdown

Revision: 425963c

Submitted crossbow builds: ursacomputing/crossbow @ actions-a6bb2ad842

Task Status
example-python-minimal-build-fedora-conda GitHub Actions
example-python-minimal-build-ubuntu-venv GitHub Actions
test-conda-python-3.11 GitHub Actions
test-conda-python-3.11-dask-latest GitHub Actions
test-conda-python-3.11-dask-upstream_devel GitHub Actions
test-conda-python-3.11-hdfs-2.9.2 GitHub Actions
test-conda-python-3.11-hdfs-3.2.1 GitHub Actions
test-conda-python-3.11-hypothesis GitHub Actions
test-conda-python-3.11-pandas-2.0.3-numpy-1.23.2 GitHub Actions
test-conda-python-3.11-spark-master GitHub Actions
test-conda-python-3.12 GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.13 GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-1.26.2 GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.14 GitHub Actions
test-conda-python-3.14-cpython-debug GitHub Actions
test-conda-python-3.14-pandas-nightly-numpy-nightly GitHub Actions
test-conda-python-3.14-pandas-upstream_devel-numpy-nightly GitHub Actions
test-conda-python-emscripten GitHub Actions
test-debian-13-python-3-amd64 GitHub Actions
test-debian-13-python-3-i386 GitHub Actions
test-fedora-42-python-3 GitHub Actions
test-ubuntu-24.04-python-3 GitHub Actions

@pitrou

pitrou commented Jul 30, 2026

Copy link
Copy Markdown
Member

CI failures are unrelated, I'll merge.

@pitrou
pitrou merged commit b8e2df4 into apache:main Jul 30, 2026
53 of 57 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jul 30, 2026
@pratyushadk
pratyushadk deleted the GH-50702-fix-cython-byproducts branch July 30, 2026 11:21
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit b8e2df4.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 12 possible false positives for unstable benchmarks that are known to sometimes produce them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants