refactor: replace `pkg_resources` with `packaging`
Metadata
Current evaluation
Merged PR #4490 replaced pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin; commit 73afa9dc6 resolves #4407.
Resolution: closed resolved
Reason: PR #4490 was merged as commit 73afa9dc6. The change replaced version and dependency checks, removed the setuptools<66 pin, and resolved issue #4407.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint`?
- [ ] Have you successfully run `pytest tests/unit`?
---
Fixes #4407
This removes the `setuptools<66` pin (which also unblocks python 3.12 support):
- `pkg_resources.parse_version` is replaced with `packaging.version.parse` (which now only accepts PEP 440-compliant version strings. I only made the changes needed to pass the unit tests, but maybe we should be more defensive)
- `pkg_resources.require` is replaced with `importlib.metadata.version` (added in [python 3.8](https://docs.python.org/3/library/importlib.metadata.html))
I've also updated `setup.py` with env markers (see the caveat in the commit message, lmk if that's not ok) and a minimum python (not sure if this should be `3.9` or `3.10`)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #4490 replaced pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin; commit 73afa9dc6 resolves #4407. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #4490 replaced pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin and unblocking Python 3.12 support in commit 73afa9dc6. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #4490 replaced pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin and unblocking Python 3.12 support in commit 73afa9dc6. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged as 73afa9dc6, replacing pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin and unblocking Python 3.12 support. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #4490 as commit 73afa9dc6, replacing pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin, and unblocking Python 3.12 support. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Replaced deprecated pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin and unblocking Python 3.12 support. Updated setup.py with environment markers and a minimum Python version. Approved by reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Replaced pkg_resources with packaging and importlib.metadata, removing the setuptools<66 pin and unblocking Python 3.12 support. Updated setup.py with environment markers and a minimum Python version. Approved and merged after review. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
snapcraft#4407
(confidence 100%)
Issue #4407 was resolved by merged PR #4490 and commit 73afa9dc6.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4407 Replace `pkg_resources.parse_version` | snapcraft | closed | Fixed by merged PR #4490 (commit 73afa9dc6), replacing pkg_resources with packaging/importlib.metadata and removing the setuptools<66 pin. | |
| #1335 fix: replace deprecated pkg_resources with importlib | charmcraft | merged | Merged PR #1335 via commit 37197f53, replacing deprecated pkg_resources with importlib in two files. | |
| #339 meta: remove deprecated pkg_resources usages | craft-providers | merged | Merged PR #339 removed deprecated pkg_resources usages, resolving #317; merge commit df4a147. |