Skip to content

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Jul 30, 2025

Rather than take the cachetools dependency, we have an internal LRUCache implementation. I found a few bugs in it and fixed them, and then added all the missing methods so that we can use it as a true drop-in for the cachetools implementation.

Also added a thorough set of unit tests to validate behaviour, and moved it into the "_utils" module as it isn't cloud-specific.

(Once merged, I'll rebase #23809 on this so that PR will work and pass tests).

Copy link

codecov bot commented Jul 30, 2025

Codecov Report

❌ Patch coverage is 91.95402% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.41%. Comparing base (fab59cb) to head (7793d34).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
py-polars/polars/_utils/cache.py 91.46% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #23813   +/-   ##
=======================================
  Coverage   81.41%   81.41%           
=======================================
  Files        1653     1654    +1     
  Lines      224496   224566   +70     
  Branches     2873     2880    +7     
=======================================
+ Hits       182764   182832   +68     
  Misses      41018    41018           
- Partials      714      716    +2     

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

@alexander-beedie alexander-beedie changed the title refactor(python): Improve internal LRUCache implementation and move into "_utils" module refactor(python): Improve/fix internal LRUCache implementation and move into "_utils" module Jul 30, 2025
@alexander-beedie alexander-beedie force-pushed the improve-lrucache branch 2 times, most recently from 8a31aa6 to 8b7f208 Compare July 31, 2025 06:12
@alexander-beedie
Copy link
Collaborator Author

alexander-beedie commented Jul 31, 2025

The new linting errors are unrelated; seem connected to #23825 🤔

Co-authored-by: nameexhaustion <[email protected]>
@alexander-beedie alexander-beedie merged commit 2545497 into pola-rs:main Aug 1, 2025
14 of 16 checks passed
@alexander-beedie alexander-beedie deleted the improve-lrucache branch August 1, 2025 14:06
Washiil pushed a commit to Washiil/polars that referenced this pull request Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants