Skip to content

feat(typing): improve type coverage in stats.* - #1148

Open
jorenham wants to merge 33 commits into
has2k1:mainfrom
jorenham:typing/stats/coverage
Open

jorenham wants to merge 33 commits into
has2k1:mainfrom
jorenham:typing/stats/coverage

Conversation

@jorenham

@jorenham jorenham commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Like #1146 and #1147, this improves public type coverage to 100% for all submodules of plotnine.stats.

To avoid a bunch of false positive Pyright errors, I also added scipy-stubs as a typing dev dependency; hope that's ok.

And in case you care; I wrote everything here myself, and I had AI review everything before making this PR.

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.95%. Comparing base (2431ef4) to head (f1621c0).

Files with missing lines Patch % Lines
plotnine/stats/smoothers.py 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
+ Coverage   88.92%   88.95%   +0.03%     
==========================================
  Files         229      229              
  Lines       17320    17354      +34     
  Branches     2204     2202       -2     
==========================================
+ Hits        15402    15438      +36     
+ Misses       1289     1288       -1     
+ Partials      629      628       -1     

☔ View full report in Codecov by Harness.
📢 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.

@has2k1

has2k1 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

@jorenham a heads up. I will merge #1145 before the typing PRs and that will create a bunch of conflicts!

@jorenham

jorenham commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Ah fun :P Thanks for letting me known.

meta-codesync Bot pushed a commit to pyrefly-org/pyrefly that referenced this pull request Nov 3, 2026
…e` (#5492)

Summary:
While working on has2k1/plotnine#1148, I noticed that calling `pyrefly coverage check` twice gave different outcomes. This turned out to be caused by abbributes whose type typable status was inherited from a base class. This used to be done by traversing the answers MRO. But at that point, the base's field answers from another module may or may not have been evicted, which made this non-deterministic. The fix is to go through the solver instead, whiich still works after the module's data is gone.

I verified that this will not cause any issues (or any different outcomes) for several projects that are using `pyrefly coverage` in CI, namely rawpy, returns, omegaconf, polars, structlog, sh, Levenshtein, argcomplete, and numpy.

- [x] I am a human, and I fully understand the code I am submitting.

Pull Request resolved: #5492

Test Plan: There are tests

Reviewed By: stroxler

Differential Revision: D129104598

fbshipit-source-id: 759de0643e326dc9a48963c4e1f7dfd705d00f50
meta-codesync Bot pushed a commit to pyrefly-org/pyrefly that referenced this pull request Nov 5, 2026
…e` (#5492)

Summary:
While working on has2k1/plotnine#1148, I noticed that calling `pyrefly coverage check` twice gave different outcomes. This turned out to be caused by abbributes whose type typable status was inherited from a base class. This used to be done by traversing the answers MRO. But at that point, the base's field answers from another module may or may not have been evicted, which made this non-deterministic. The fix is to go through the solver instead, whiich still works after the module's data is gone.

I verified that this will not cause any issues (or any different outcomes) for several projects that are using `pyrefly coverage` in CI, namely rawpy, returns, omegaconf, polars, structlog, sh, Levenshtein, argcomplete, and numpy.

- [x] I am a human, and I fully understand the code I am submitting.

Pull Request resolved: #5492

Test Plan: There are tests

Reviewed By: stroxler

Differential Revision: D129104598

fbshipit-source-id: 5b0c233389939f7ade24d462905cb201c067e080

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants