Skip to content

Replace deprecated pkg_resources and distutils.spawn with stdlib equivalents#348

Merged
cokelaer merged 2 commits intomainfrom
copilot/fix-readthedocs-deprecation-issue
Mar 6, 2026
Merged

Replace deprecated pkg_resources and distutils.spawn with stdlib equivalents#348
cokelaer merged 2 commits intomainfrom
copilot/fix-readthedocs-deprecation-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

pkg_resources (setuptools) and distutils.spawn are deprecated and removed in newer Python versions, causing ReadTheDocs builds to fail.

Changes

  • bioconvert/__init__.pypkg_resources.require()[0].versionimportlib.metadata.version(), catching PackageNotFoundError instead of broad Exception
  • doc/conf.py — same pkg_resourcesimportlib.metadata.version() replacement for Sphinx version retrieval
  • bioconvert/core/decorators.py:
    • distutils.spawn.find_executableshutil.which
    • [p.project_name for p in pkg_resources.working_set][dist.metadata['Name'] for dist in importlib.metadata.distributions()]

All replacements use stdlib modules available since Python 3.8+, eliminating the setuptools/distutils runtime dependency for these code paths.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…etadata and shutil.which

Co-authored-by: cokelaer <778821+cokelaer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failure in ReadTheDocs due to deprecated pkg_resources Replace deprecated pkg_resources and distutils.spawn with stdlib equivalents Mar 6, 2026
@cokelaer cokelaer marked this pull request as ready for review March 6, 2026 14:01
@cokelaer cokelaer merged commit 9bbf415 into main Mar 6, 2026
1 of 4 checks passed
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.

2 participants