Skip to content

build(rust): Bump up numpy and pyo3 to 0.28#26743

Open
florianvazelle wants to merge 5 commits intopola-rs:mainfrom
florianvazelle:pyo3
Open

build(rust): Bump up numpy and pyo3 to 0.28#26743
florianvazelle wants to merge 5 commits intopola-rs:mainfrom
florianvazelle:pyo3

Conversation

@florianvazelle
Copy link

@florianvazelle florianvazelle commented Feb 27, 2026

Hi 👋

I submit this PR to bump pyo3 and numpy dependencies from 0.27 to 0.28.

pyo3 deprecates the automatic implementation of FromPyObject for Clone pyclasses, so I tried to preserve the current behavior (this is the main change made).

Feedback and suggestions are very welcome 🙂

@github-actions github-actions bot added A-interop-numpy Area: interoperability with NumPy build Changes that affect the build system or external dependencies rust Related to Rust Polars labels Feb 27, 2026
@florianvazelle florianvazelle marked this pull request as draft February 27, 2026 10:44
Preserve existing behavior and silence PyO3 deprecation warning
about automatic FromPyObject implementation for Clone pyclasses.
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.67%. Comparing base (3ea81c4) to head (ab656cc).

Files with missing lines Patch % Lines
.../polars-python/src/lazyframe/visitor/expr_nodes.rs 0.00% 5 Missing ⚠️
crates/polars-python/src/lazyframe/mod.rs 0.00% 2 Missing ⚠️
crates/polars-python/src/conversion/categorical.rs 0.00% 1 Missing ⚠️
crates/polars-python/src/dataframe/mod.rs 0.00% 1 Missing ⚠️
crates/polars-python/src/expr/datatype.rs 0.00% 1 Missing ⚠️
crates/polars-python/src/expr/selector.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26743      +/-   ##
==========================================
+ Coverage   80.94%   81.67%   +0.73%     
==========================================
  Files        1805     1805              
  Lines      248090   248098       +8     
  Branches     3131     3131              
==========================================
+ Hits       200825   202643    +1818     
+ Misses      46460    44650    -1810     
  Partials      805      805              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@florianvazelle florianvazelle marked this pull request as ready for review February 27, 2026 14:44
@orlp
Copy link
Member

orlp commented Mar 2, 2026

Does the test suite pass if we skip the FromPyObject implementation for all our pyclasses? I honestly don't see why we'd want any implicit FromPyObject implementations.

@florianvazelle
Copy link
Author

Hi @orlp, if we skip the FromPyObject implementation for some pyclasses, the crate don't build.

It's seems to implicitly implement the trait pyo3::impl_::pyclass::ExtractPyClassWithClone that is required for some pyclasses, to implement pyo3::FromPyObject<'_, '_>.
This allow to call PyDataFrame::extract (or pydf.extract::<PyDataFrame>) for example.

Copy link
Member

@orlp orlp left a comment

Choose a reason for hiding this comment

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

Could you do one more pass over everything, aggressively removing from_py_object in favor of the skip, unless it really doesn't compile without?

@florianvazelle
Copy link
Author

Yes, that's how I proceeded initially

pyclasses with the from_py_object: PyLazyFrame, PyOptFlags, PySeries, PySampler, PyCategories, PyDataFrame, PyDataTypeExpr, PyExpr, PySelector
And pyclasses with the skip_from_py_object: PyWhen, PyThen, PyChainedWhen, PyChainedThen, PyOperator, PyStringFunction, PyBooleanFunction, PyTemporalFunction, PyStructFunction, PyFileOptions, PyInProcessQuery, PyExprIR, PySQLContext

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

Labels

A-interop-numpy Area: interoperability with NumPy build Changes that affect the build system or external dependencies rust Related to Rust Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants