fix: require explicit pure-Python source builds - #995
Conversation
Fail source builds when Cython preparation or extension compilation fails. Keep CLICKHOUSE_CONNECT_SKIP_CYTHON=1 as the explicit pure-Python opt-out and document the behavior.
|
|
|
I did not check, but tests should check all the functionality in both cases. I guess, there should be an option to choose implementation at runtime (at least for tests). |
There was a problem hiding this comment.
I think, this file is extra. doesn't need to be tested.
There was a problem hiding this comment.
This file is the regression boundary for #994 rather than a duplicate runtime-implementation test. It proves the removed broad fallback cannot return, that unrelated packaging errors propagate, and that the explicit source-build opt-out still produces no extensions. Runtime C/Python parity is already covered separately in tests/unit_tests/test_driver/test_c_parity.py, with CLICKHOUSE_CONNECT_USE_C=0 providing runtime selection.
|
I checked this against the current package paths.
I also rebuilt the PR source archive in clean Python 3.12 environments. A normal install loaded |
|
Hi @vsolano9 & @socketpair thanks for putting this together the discussion. I agree that the blanket However, I'm not comfortable with successful C extension compilation becoming a default requirement. The pure Python fallback is existing documented behavior and changing a source install from success to failure would be a breaking change. Normal wheel installs already contain the compiled extensions and are unaffected. My preference would be to:
This will allows us to preserve compatibility while still giving deployments that require the optimized path a reliable way to ensure it does work. |
|
@joe-clickhouse thanks — agreed on the broad Nothing that works today breaks. Wheels are unaffected; source builds with a working toolchain are unaffected. The only builds that flip to failure are the ones already producing a silently degraded artifact the user never asked for. That's not breaking a working setup — it's surfacing a broken one, with a one-line documented fix printed in the error message. "Warn and fall back" == "silently fall back". Opt-in safety protects the wrong people. Downstream. I package clickhouse-connect as an RPM for Fedora and currently carry a local patch that makes the build fail hard on Cython/extension failure, because a distro package silently missing its C extensions is a defect shipped to every user. I'd rather not carry that patch — and neither would Debian, Arch, conda-forge, or anyone building internal wheels. So: fail by default (this PR), |
Summary
Fixes #994.
Source builds now stop when Cython preparation or extension compilation fails instead of silently retrying
setup()without extensions.CLICKHOUSE_CONNECT_SKIP_CYTHON=1remains the explicit opt-out for a pure-Python source build, and the installation documentation and changelog describe that behavior.Regression tests cover missing Cython, Cython preparation failure, propagation of setup/compiler failures without a retry, and the explicit pure-Python opt-out.
Validation:
SELECT 13smoke test; the compiled wheel contains the expected extensions and the pure wheel does not.Checklist