Skip to content

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

Open
pratyushadk wants to merge 1 commit into
apache:mainfrom
pratyushadk:GH-50702-fix-cython-byproducts
Open

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

Conversation

@pratyushadk

@pratyushadk pratyushadk commented Jul 29, 2026

Copy link
Copy Markdown

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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants