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

doc: add social cards generation support in sphinxext-opengraph #129085

Merged
merged 6 commits into from
Jan 20, 2025

Conversation

FFY00
Copy link
Member

@FFY00 FFY00 commented Jan 20, 2025

@FFY00 FFY00 merged commit 382340d into python:main Jan 20, 2025
24 checks passed
@hugovk
Copy link
Member

hugovk commented Jan 20, 2025

I don't quite the IS_PYTHON_BUILD logic here, is this only meant to generate the social images when the Python is built from source, and not for actual docs deploys to the website?

See also python/docsbuild-scripts#147 where I considered this two years ago, where I had concerns about it generating (at the time) 482 images and 41 MB, multiplied by all the languages and versions.

cc @AA-Turner

@AA-Turner AA-Turner added the docs Documentation in the Doc dir label Jan 20, 2025
@hugovk
Copy link
Member

hugovk commented Jan 20, 2025

And also --only-binary means matplotlib isn't installed for main because there's no 3.14 wheels at https://pypi.org/project/matplotlib/#files

@AA-Turner
Copy link
Member

Thanks for the tag Hugo, I missed this PR as it didn't have the docs tag.

I'm likewise unsure about what this is meant to achieve, if we want to generate the opengraph preview images then we should enable it via docsbuild-scripts rather than here. I'd perhaps suggest reverting this PR?

A

@AA-Turner
Copy link
Member

See also #101639, #101642, and #125264 where we tried only-binary for a different package, but went with python/docsbuild-scripts#217 instead.

A

AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Jan 20, 2025
@AA-Turner
Copy link
Member

I've opened #129106 as a proposal for a clean revert, and I've been working with Hugo to try and set up preview images through docs.python.org.

A

@FFY00
Copy link
Member Author

FFY00 commented Jan 20, 2025

I don't quite the IS_PYTHON_BUILD logic here, is this only meant to generate the social images when the Python is built from source, and not for actual docs deploys to the website?

No, the opposite.

We don't want to try to install matplotlib on source builds since it's a native extension, and it wouldn't be a good idea to try to build it against a development CPython version.

We don't use the Python build from source to deploy the website, so the missing optional dependency doesn't really matter there. This patch makes the dependency available on our docs deployment job, which is what we really care about.

@FFY00
Copy link
Member Author

FFY00 commented Jan 20, 2025

I'm likewise unsure about what this is meant to achieve, if we want to generate the opengraph preview images then we should enable it via docsbuild-scripts rather than here. I'd perhaps suggest reverting this PR?

Ah, gotcha, I guess I was under the incorrect impression.

@hugovk
Copy link
Member

hugovk commented Jan 21, 2025

I don't quite the IS_PYTHON_BUILD logic here, is this only meant to generate the social images when the Python is built from source, and not for actual docs deploys to the website?

No, the opposite.

We don't want to try to install matplotlib on source builds since it's a native extension, and it wouldn't be a good idea to try to build it against a development CPython version.

We don't use the Python build from source to deploy the website, so the missing optional dependency doesn't really matter there. This patch makes the dependency available on our docs deployment job, which is what we really care about.

Ah sorry, the logic is indeed the right way around. I'd tested it locally and wondered why images weren't created, and it's because they're not generated when ogp_image is defined in conf.py.

Anyway, thanks for picking this up, python/docsbuild-scripts#147 had been sitting idle for too long!

We've made python/docsbuild-scripts#242 and #129120 to trial it on 3.14, and we can check the performance and space used is okay.

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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants