Skip to content

fix(python): Wrap deprecated top-level imports in TYPE_CHECKING#24340

Merged
ritchie46 merged 2 commits into
pola-rs:mainfrom
orlp:getattr-type-checking
Sep 5, 2025
Merged

fix(python): Wrap deprecated top-level imports in TYPE_CHECKING#24340
ritchie46 merged 2 commits into
pola-rs:mainfrom
orlp:getattr-type-checking

Conversation

@orlp
Copy link
Copy Markdown
Member

@orlp orlp commented Sep 3, 2025

Fixes #24334.

@github-actions github-actions Bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 3, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.77%. Comparing base (44567ba) to head (911d414).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
py-polars/polars/__init__.py 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24340      +/-   ##
==========================================
- Coverage   81.79%   81.77%   -0.03%     
==========================================
  Files        1680     1680              
  Lines      227742   227743       +1     
  Branches     2919     2920       +1     
==========================================
- Hits       186291   186235      -56     
- Misses      40721    40777      +56     
- Partials      730      731       +1     

☔ 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.

@orlp orlp force-pushed the getattr-type-checking branch from 335b8a6 to 911d414 Compare September 3, 2025 12:34
Copy link
Copy Markdown
Collaborator

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

nice, i'd say that requiring the extra type: ignore[attr-defined] prove it's working 🙌

@nameexhaustion nameexhaustion changed the title fix: Wrap deprecated top-level imports in TYPE_CHECKING fix(python): Wrap deprecated top-level imports in TYPE_CHECKING Sep 4, 2025
@nameexhaustion nameexhaustion removed the rust Related to Rust Polars label Sep 4, 2025
@ritchie46 ritchie46 merged commit 2557bb2 into pola-rs:main Sep 5, 2025
21 of 22 checks passed
dangotbanned added a commit to narwhals-dev/narwhals that referenced this pull request Sep 18, 2025
Related:
- pola-rs/polars#24334
- pola-rs/polars#24340

```py
narwhals/_polars/utils.py:107:47 - error: "UInt128" is not a known attribute of module "polars" (reportAttributeAccessIssue)
```
MarcoGorelli pushed a commit to narwhals-dev/narwhals that referenced this pull request Oct 3, 2025
* ci(typing): Bump `polars==1.33.1`

Related:
- pola-rs/polars#24334
- pola-rs/polars#24340

```py
narwhals/_polars/utils.py:107:47 - error: "UInt128" is not a known attribute of module "polars" (reportAttributeAccessIssue)
```

* fix: Remove check for non-existent `polars.UInt128`

`polars` only has `pl.Int128`

#1570

* fix: Use a self doc condition w/ the right version

`1.18.0` instead of `1.8.0`

* fix: Partial revert, `pl.UInt128` will soon-exist

#3138 (comment)

* perf: Move `pl.Int128` branch out of `narwhals_to_native_dtype`

* maybe fix coverage?

#3138 (comment)

* ci(typing): Bump `polars==1.34.0`

* fix(typing): Remove ignore fixed by my pr 🥳

pola-rs/polars#24584

* chore: actually integrate `pl.UInt128`

#3138 (comment), #3138 (comment))

* style: Sort version guards in reverse-chrono

* test: Roundtrip coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix python Related to Python Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Polars module non existent attributes are inferred as Any

4 participants