Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify definitions of rhs expressions, bump dask minimum to 2024.10 #1720

Merged
merged 11 commits into from
Jan 5, 2025

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Jan 4, 2025

This was quite satisfying 😋 I'm tired of reimplementing right-hand-side arithmetic for each backend, I think we can just do it at the narwhals.Expr level

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

  • Related issue #<issue number>
  • Closes #<issue number>

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Comment on lines -25 to +30
def extract_compliant(expr: Expr, other: Any) -> Any:
def extract_compliant(
plx: CompliantNamespace[CompliantSeriesT_co], other: Any
) -> CompliantExpr[CompliantSeriesT_co] | CompliantSeriesT_co | Any:
Copy link
Member Author

Choose a reason for hiding this comment

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

lol the annotations weren't right to begin with here 😄

Comment on lines -1791 to +1809
other = extract_compliant(self, other)
return self.__class__(lambda plx: self._to_compliant_expr(plx).is_in(other))
return self.__class__(
lambda plx: self._to_compliant_expr(plx).is_in(
extract_compliant(plx, other)
)
)
Copy link
Member Author

@MarcoGorelli MarcoGorelli Jan 4, 2025

Choose a reason for hiding this comment

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

this wasn't quite right to begin with (plx should be passed to extract_compliant, not self) - mypy helped detect it 😍

@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 4, 2025 19:48
@MarcoGorelli MarcoGorelli changed the title chore: simplify definitions of rhs expressions chore: simplify definitions of rhs expressions, bump dask minimum to 2024.10 Jan 4, 2025
python-version: ["3.9", "3.11", "3.13"]
python-version: ["3.11", "3.13"]
Copy link
Member Author

Choose a reason for hiding this comment

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

we've already got other jobs testing 3.9 (like the "random versions" one)

Comment on lines -85 to -88
request: pytest.FixtureRequest,
) -> None:
if "dask_lazy_p2" in str(constructor) and "lit_with_agg" in col_name:
request.applymarker(pytest.mark.xfail)
Copy link
Member Author

Choose a reason for hiding this comment

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

feels nice to accidentally fix a bug with a refactor 😎

@MarcoGorelli MarcoGorelli merged commit 1f3cc41 into narwhals-dev:main Jan 5, 2025
23 checks passed
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.

1 participant