Skip to content

support py313 and drop py38 and py37#2

Merged
shenxianpeng merged 14 commits intomasterfrom
support-py313
Jun 8, 2025
Merged

support py313 and drop py38 and py37#2
shenxianpeng merged 14 commits intomasterfrom
support-py313

Conversation

@shenxianpeng
Copy link
Copy Markdown
Owner

@shenxianpeng shenxianpeng commented Jun 7, 2025

Change Summary

  • Added support for Python 3.13
  • Dropped support for Python 3.7 and 3.8
  • Removed usage of the deprecated imghdr module
  • Replaced pkg_resources, which was removed in Python 3.13

This patch fixes the following issues and pull request from the original repository:

@shenxianpeng shenxianpeng added the enhancement New feature or request label Jun 7, 2025
@shenxianpeng shenxianpeng added bug Something isn't working and removed enhancement New feature or request labels Jun 8, 2025
@shenxianpeng shenxianpeng requested a review from Copilot June 8, 2025 07:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.py to require ≥3.9, drop old classifiers, add filetype dependency, and include Python 3.13 classifier
  • Replace pkg_resources with importlib.resources in resource-loading modules and add error handling
  • Refresh development tooling: bump Pillow in noxfile.py, update build_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 .xz and .json resource-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 tests module and pass it to importlib.resources.files() instead of a string literal.
with importlib.resources.as_file(importlib.resources.files('tests') / 'test-badges.json') as test_badges_path:

Comment thread setup.py Outdated
Comment thread pybadges/precalculated_text_measurer.py
Comment thread noxfile.py Outdated
shenxianpeng and others added 3 commits June 8, 2025 10:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@shenxianpeng shenxianpeng merged commit 90b20d8 into master Jun 8, 2025
9 checks passed
@shenxianpeng shenxianpeng deleted the support-py313 branch June 8, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants