support py313 and drop py38 and py37#2
Merged
shenxianpeng merged 14 commits intomasterfrom Jun 8, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Python 3.13 support, removes legacy Python 3.7/3.8 compatibility, and migrates resource loading and image type detection to modern stdlib APIs and the filetype library.
- Update
setup.pyto require ≥3.9, drop old classifiers, addfiletypedependency, and include Python 3.13 classifier - Replace
pkg_resourceswithimportlib.resourcesin resource-loading modules and add error handling - Refresh development tooling: bump Pillow in
noxfile.py, updatebuild_golden_images.py, and add a Python 3.13 job in CI
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Drop Py 3.7/3.8 support, require ≥3.9, add Python 3.13 classifier and filetype dependency |
| pybadges/precalculated_text_measurer.py | Swap pkg_resources for importlib.resources, handle .xz/.json assets, catch errors |
| pybadges/init.py | Replace imghdr usage with filetype.guess() |
| noxfile.py | Bump Pillow to 11.2.1 for new Python versions |
| build_golden_images.py | Use importlib.resources.as_file() for test data and golden images |
| .github/workflows/ci.yml | Add a compatibility job for Python 3.13 |
Comments suppressed due to low confidence (2)
pybadges/precalculated_text_measurer.py:78
- Add unit tests to exercise both the
.xzand.jsonresource-loading branches to verify fallback behavior.
if importlib.resources.is_resource(__package__, 'default-widths.json.xz'):
build_golden_images.py:49
- [nitpick] For clearer intent and reliability, import the
testsmodule and pass it toimportlib.resources.files()instead of a string literal.
with importlib.resources.as_file(importlib.resources.files('tests') / 'test-badges.json') as test_badges_path:
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
imghdrmodulepkg_resources, which was removed in Python 3.13This patch fixes the following issues and pull request from the original repository: