Skip to content

Replace pkg_resources with importlib.metadata in docs config#564

Merged
dfm merged 2 commits intomainfrom
copilot/debug-readthedocs-build-failure
Mar 15, 2026
Merged

Replace pkg_resources with importlib.metadata in docs config#564
dfm merged 2 commits intomainfrom
copilot/debug-readthedocs-build-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

ReadTheDocs builds fail because pkg_resources is unavailable in newer Python environments where setuptools no longer bundles it by default.

  • docs/conf.py: Switch from pkg_resources.get_distribution() to importlib.metadata.version() (stdlib since Python 3.8)
  • docs/requirements.txt: Drop setuptools dependency, no longer needed for docs build
# Before
from pkg_resources import DistributionNotFound, get_distribution
__version__ = get_distribution("emcee").version

# After
from importlib.metadata import PackageNotFoundError, version
__version__ = version("emcee")

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: dfm <350282+dfm@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build failure on Read the Docs due to missing pkg_resources Replace pkg_resources with importlib.metadata in docs config Mar 15, 2026
Copilot AI requested a review from dfm March 15, 2026 14:49
Copilot finished work on behalf of dfm March 15, 2026 14:49
@dfm dfm marked this pull request as ready for review March 15, 2026 14:53
@dfm dfm merged commit 65c4d96 into main Mar 15, 2026
10 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