fix(download_lt): emit a warning when no checksum available#216
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the UX and safety signaling of LanguageTool ZIP downloads by warning users when an integrity checksum is unavailable, and adjusts warning attribution so it points to the external caller rather than internal library frames.
Changes:
- Emit a
RuntimeWarningfrom_get_zip_hash()when no SHA-256 checksum is available for the requested LanguageTool version. - Add
_external_stacklevel()to dynamically computewarnings.warn(..., stacklevel=...)based on the call chain. - Update docs/tests and add a changelog entry for the new warning behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
tests/unit/test_download_unit.py |
Adds/updates unit tests to assert warning behavior for missing vs known checksums. |
src/language_tool_python/download_lt.py |
Implements missing-checksum warning and dynamic warning stacklevel computation. |
docs/source/references/env_vars.rst |
Documents that missing checksums now produce a RuntimeWarning and how to configure per-version checksums. |
CHANGELOG.md |
Records the user-visible warning behavior change for downloads without checksums. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #216 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 13
Lines 1696 1713 +17
=========================================
+ Hits 1696 1713 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c33b39a to
0aa4221
Compare
0aa4221 to
3a0ba5e
Compare
fix(download_lt): emit a warning when no checksum available
Why the pull request was made
To ensure that users are warned when they download a LanguageTool zip for which there isn't any available checksum.
Summary of changes
language_tool_python.download_lt._get_zip_hashwhen no checksum is found.language_tool_python.download_lt._external_stacklevelto adaptstacklevelof warnings inlanguage_tool_python.download_lt._get_zip_hash, according to which class the user is using.Screenshots (if appropriate):
Not applicable.
How has this been tested?
Applied local tests, looked at the warning issued.
Resources
Not applicable.
Types of changes
Checklist