Skip to content

Comments

add pkg_resources import handler#38

Open
tw-yshuang wants to merge 1 commit intowardi:masterfrom
tw-yshuang:dev.importHandler
Open

add pkg_resources import handler#38
tw-yshuang wants to merge 1 commit intowardi:masterfrom
tw-yshuang:dev.importHandler

Conversation

@tw-yshuang
Copy link

Summary

  • Replace deprecated pkg_resources with importlib.metadata for version detection
  • Add fallback to pkg_resources for compatibility with older Python/setuptools versions
  • Fixes compatibility issues with setuptools >= 82.0.0 where pkg_resources is deprecated

Changes

The code now:

  1. First attempts to use importlib.metadata.version() (standard in Python 3.8+)
  2. Falls back to pkg_resources.get_distribution() if importlib.metadata is unavailable
  3. Handles PackageNotFoundError/DistributionNotFound for development environments

Testing

Verified on setuptools 82.0.0 - version detection works correctly.

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.

1 participant