Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch importlib error when building docs with sphinx-build manually #182

Merged
merged 2 commits into from
May 27, 2024

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented May 27, 2024

In some cases, where a local source for a package (e.g. in the PYTHONPATH) is used instead of a pip install package, the get_version() in the docs/conf.py fails with importlib.metadata.PackageNotFoundError: No package metadata was found for PACKAGE when using sphinx-build directly (instead of going via tox -e docs).

These changes allows one to use sphinx-build directly, which is sometimes needed for debugging purposes.

@nvaytet nvaytet requested a review from MridulS May 27, 2024 11:24
release = get_version("{{projectname}}")
version = ".".join(release.split('.')[:3]) # CalVer
except PackageNotFoundError:
release = version = "0.0.0-dev"
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a print or log to make it easier to trace if something breaks in CI? Otherwise 👍

@nvaytet nvaytet merged commit 102b1ec into main May 27, 2024
2 checks passed
@nvaytet nvaytet deleted the fix-docs-manual-build branch May 27, 2024 13:01
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