Skip to content

fix: remove deprecated pkg_resources usage ahead of planned removal in Setuptools ≥81#1058

Merged
bgruening merged 7 commits intobioconda:masterfrom
menoldmt:deprecated_pkg_resources
Jan 9, 2026
Merged

fix: remove deprecated pkg_resources usage ahead of planned removal in Setuptools ≥81#1058
bgruening merged 7 commits intobioconda:masterfrom
menoldmt:deprecated_pkg_resources

Conversation

@menoldmt
Copy link
Contributor

@menoldmt menoldmt commented Aug 9, 2025

Replaces all uses of the deprecated pkg_resources API in utils.py, docker_utils.py, and autobump.py with importlib.resources and packaging.version equivalents.

Adds a smoke test for validate_config to ensure schema validation works without pkg_resources.

Closes #1056

@menoldmt menoldmt changed the title Remove deprecated pkg_resources usage fix: remove deprecated pkg_resources usage ahead of planned removal in Setuptools ≥81 Aug 9, 2025
Copy link
Contributor

@aliciaaevans aliciaaevans left a comment

Choose a reason for hiding this comment

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

One minor comment, but otherwise looks good.

vers_version, vers_is_legacy = _parse_or_legacy(vers)
# allow prerelease only if current is prerelease
if vers_version.is_prerelease and not current_version.is_prerelease:
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

Even thought Python allows it, I think it'd be preferable to have _parse_or_legacy return None rather than trying to getattr from an ambiguous str|Version. The string isn't actually needed anyway since vers is there. Maybe rearrange some ifs here.

'bioconda_utils',
'bioconda_utils-requirements.txt')
).read())
# pkg_resources (deprecated) is replaced with importlib.resources
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this comment is really needed.

)
schema = yaml.safe_load(open(fn))

# Load packaged schema without pkg_resources (deprecated)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, it doesn't hurt, but not really needed to refer to the old way of doing things.

Copy link
Contributor

@aliciaaevans aliciaaevans left a comment

Choose a reason for hiding this comment

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

I'm going to go ahead and approve this since my comments were optional and we probably should get it in.

@bgruening bgruening enabled auto-merge (squash) January 9, 2026 08:41
@bgruening bgruening disabled auto-merge January 9, 2026 08:48
@bgruening bgruening merged commit 0ef2df1 into bioconda:master Jan 9, 2026
9 checks passed
@bgruening
Copy link
Member

Thanks everyone!

bgruening pushed a commit that referenced this pull request Jan 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.9.2](v3.9.1...v3.9.2)
(2026-01-09)


### Bug Fixes

* remove deprecated pkg_resources usage ahead of planned removal in
Setuptools ≥81
([#1058](#1058))
([0ef2df1](0ef2df1))
* unexpected arg 'label'
([#1065](#1065))
([16f2ab9](16f2ab9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bgruening pushed a commit to bioconda/bioconda-common that referenced this pull request Feb 9, 2026
## Summary
- Bump `BIOCONDA_UTILS_TAG` from `v3.9.1` to `v3.9.2`

## Problem
`setuptools 82.0.0` (now on conda-forge) removed the `pkg_resources`
module. `bioconda-utils v3.9.1` imports `pkg_resources` in
`utils.py:43`, causing all fresh CircleCI ARM builds to fail with:

```
ModuleNotFoundError: No module named 'pkg_resources'
```

## Fix
`v3.9.2` (released 2026-01-09) includes PR bioconda/bioconda-utils#1058
which removes the deprecated `pkg_resources` usage.
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.

pkg_resources is deprecated as an API

4 participants