Skip to content

Docs: Test presence of optional extensions with importlib #130445

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

Merged
merged 1 commit into from
Feb 22, 2025

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Feb 22, 2025

We don't need to import the extensions, and this is more compact if we add more optional extensions.

A


📚 Documentation preview 📚: https://cpython-previews--130445.org.readthedocs.build/

@AA-Turner AA-Turner added docs Documentation in the Doc dir skip issue skip news needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Feb 22, 2025
@AA-Turner AA-Turner requested a review from hugovk as a code owner February 22, 2025 06:02
extensions.append(optional_ext)
except (ImportError, ValueError):
pass
del _OPTIONAL_EXTENSIONS
Copy link
Member

Choose a reason for hiding this comment

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

Does this make much difference?

Suggested change
del _OPTIONAL_EXTENSIONS

Copy link
Member Author

Choose a reason for hiding this comment

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

We should avoid polluting the conf.py namespace, as it is read for Sphinx configuration. The underscore and del may be overkill, but just being explicit.

@AA-Turner AA-Turner merged commit 3cc9e86 into python:main Feb 22, 2025
41 checks passed
@miss-islington-app
Copy link

Thanks @AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 22, 2025
@bedevere-app
Copy link

bedevere-app bot commented Feb 22, 2025

GH-130464 is a backport of this pull request to the 3.13 branch.

@miss-islington-app
Copy link

Sorry, @AA-Turner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3cc9e867eba1ed139cf28c74b4a788bcc4801394 3.12

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 22, 2025
AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Feb 22, 2025
@bedevere-app
Copy link

bedevere-app bot commented Feb 22, 2025

GH-130466 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 22, 2025
@AA-Turner AA-Turner deleted the docs/conf-py-importlib branch February 22, 2025 18:00
AA-Turner added a commit that referenced this pull request Feb 22, 2025
AA-Turner added a commit that referenced this pull request Feb 22, 2025
…130445) (#130466)

* [3.12] Docs: Test presence of optional extensions with importlib (GH-130445)
(cherry picked from commit 3cc9e86)

Co-authored-by: Adam Turner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants