Skip to content

Enforce 100% public API type coverage in CI - #2565

Closed
jorenham wants to merge 1 commit into
dry-python:masterfrom
jorenham:ci/enforce-100%-coverage
Closed

jorenham wants to merge 1 commit into
dry-python:masterfrom
jorenham:ci/enforce-100%-coverage

Conversation

@jorenham

@jorenham jorenham commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

I have made things!

Since #2563, returns has 100% type coverage ( 🎉 ). This adds a make type-coverage command and runs it in CI to ensure that it stays this way. It runs pyrefly coverage check --public-only, which will fail if there's public API functions, classes, or module attributes, ("typables") that aren't typed.

FWIW; we also use pyrefly coverage in NumPy (here), and it has been smooth sailing so far.

Checklist

  • I have double checked that there are no unrelated changes in this pull request (old patches, accidental config files, etc)
  • I have created at least one test case for the changes I have made
  • I have updated the documentation for the changes I have made
  • I have added my changes to the CHANGELOG.md

Related issues


🙏 Please, if you or your company finds dry-python valuable, help us sustain the project by sponsoring it transparently on https://github.com/sponsors/dry-python. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.

@codspeed

codspeed Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 note

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.

See affected benchmarks

✅ 22 untouched benchmarks


Comparing jorenham:ci/enforce-100%-coverage (910a765) with master (f3a6f54)

Open in CodSpeed

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (82ef3ef) to head (910a765).
⚠️ Report is 656 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##            master     #2565    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           80        82     +2     
  Lines         2485      2697   +212     
  Branches       437        45   -392     
==========================================
+ Hits          2485      2697   +212     

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

@sobolevn sobolevn left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we better enable no-untyped-defs for mypy for returns package?

I don't want to support other type-checkers :)

@jorenham

jorenham commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Mypy's no-untyped-defs isn't aware of what's public API, so enabling it might require us to annotate a lot of other stuff as well. I could take a look if you want?

I don't want to support other type-checkers :)

Fair. But Pyrefly isn't used for type-checking here, so maybe this loophole could convince you 😇 ? Also, I wouldn't call it "support"; it's only used in CI, and doensn't involve anything public-facing or anything.

@sobolevn

Copy link
Copy Markdown
Member

I would prefer to fully type the whole project and keep it mypy-only :)
We can merge this PR (without the pyrefly part) as the first step.

@jorenham

Copy link
Copy Markdown
Contributor Author

We can merge this PR (without the pyrefly part)

Eh I'm not sure what you mean; there won't be much left of this PR without the Pyrefly part :P

@sobolevn

sobolevn commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Oh 😅
Sorry, I've squashed two PRs (this one and #2564) together inside my head.

I've merged the second one! 👍
I don't really want to commit to pyrefly for this project, because returns is way too magical and things can break at any moment :(

@sobolevn sobolevn closed this Oct 27, 2026
@jorenham
jorenham deleted the ci/enforce-100%-coverage branch October 27, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants