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

Fix pickled doctrees cache. #11939

Merged
merged 8 commits into from
Mar 14, 2024

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Feb 4, 2024

Closes #11474.
Closes #11908.

Note that this fix may increased build time for very large projects since we need to revert back to reading at least twice the pickled files.

Alternatively, we could add the possibility to mark which document should be 'refreshed' from its file if needed? though I don't know which ones we should actually target. Maybe @AA-Turner has some solution for this?

@picnixz picnixz mentioned this pull request Feb 11, 2024
@picnixz
Copy link
Member Author

picnixz commented Mar 14, 2024

For now, I'll merge this since I don't see any other simple solution. It will increase the build time of all projects, yet it will not cause any issues with rebuilds. However, I assume that it should not be too stressing to read 70ks pickled doctrees on modern systems (I could have been concerned 30 years ago but I think the performance drop is marginal).

@picnixz picnixz merged commit f3087e8 into sphinx-doc:master Mar 14, 2024
22 checks passed
@picnixz picnixz deleted the fix/11474-pickled-doctree branch March 14, 2024 09:22
@aakhavanQC
Copy link

Is there an ETA on the release for this? TIA

@picnixz
Copy link
Member Author

picnixz commented Mar 28, 2024

Err... technically, it's fixed on master. However, I don't know when we'll be able to release 7.3 so.. I cannot give an ETA on the 7.3 release, sorry :(

@aakhavanQC
Copy link

Err... technically, it's fixed on master. However, I don't know when we'll be able to release 7.3 so.. I cannot give an ETA on the 7.3 release, sorry :(

No worries. Do you think I could patch this in to 7.2.6 without any other issues? Seems simple enough...

@picnixz
Copy link
Member Author

picnixz commented Mar 28, 2024

No worries. Do you think I could patch this in to 7.2.6 without any other issues? Seems simple enough...

Mmh. I don't think it would affect other stuff in the code. At least it shouldn't. So technically, you could patch your local installation. However, I'd recommend just installing Sphinx 7.3 using pip with git+ syntax (in a virtual environment for instance or in a local folder, not system-widely otherwise you could mess up your system installation).

@aakhavanQC
Copy link

No worries. Do you think I could patch this in to 7.2.6 without any other issues? Seems simple enough...

Mmh. I don't think it would affect other stuff in the code. At least it shouldn't. So technically, you could patch your local installation. However, I'd recommend just installing Sphinx 7.3 using pip with git+ syntax (in a virtual environment for instance or in a local folder, not system-widely otherwise you could mess up your system installation).

Unfortunately it breaks one of my extensions (autodoc_pydantic), because it looks like it's trying to import py_sig_re from sphinx.domains.python but it's not in the module anymore because it was refactored: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/domains/python/__init__.py

Is this a deliberate API change? I can report it upstream or make a new issue here.

Extension error:
Could not import extension sphinxcontrib.autodoc_pydantic (exception: cannot import name 'py_sig_re' from 'sphinx.domains.python' (/prj/iceng/pdk/work_aakhavan/devicedata/.venv/lib/python3.11/site-packages/sphinx/domains/python/__init__.py))

Used here: https://github.com/mansenfranzen/autodoc_pydantic/blob/c07d1f2223897d2fa5983423bbe73ac73a624fee/sphinxcontrib/autodoc_pydantic/directives/directives.py#L14

@picnixz
Copy link
Member Author

picnixz commented Mar 31, 2024

Ah, yes. I see that we really need to be on the same page on what is public API and what's not. So here's an example of something that we think as private API (non-capitalized module-level constant) however users as using it as if it were public (although not documented in the RST documentation).

Most of those public/private API issues stem from 10y.o. code base where people had different conventions and where we did not expect things to be used if not explicitly documented. Personally, I don't expect users to use non-capitalized module-level constants as if they were public API.

(long story short, the rationale behind the refactorization is that the Python domain was too big of a file so many things were moved into 'private' API because we did not expect them to be used directly by extensions but it appears we are breaking things, so maybe we should re-export them normally but deprecate them).

I'm not sure you should report this upstream since it's our fault I would say. We did not clarify what is public/private so we should somewhat fix that before releasing 7.3

@chrisjsewell
Copy link
Member

I don't expect users to use non-capitalized module-level constants as if they were public API.

Not heard that one before 😅
as far as I was aware, the only globally agreed on convention is that if it starts with _ then it's private

@picnixz
Copy link
Member Author

picnixz commented Mar 31, 2024

as far as I was aware, the only globally agreed on convention is that if it starts with _ then it's private

Well.. technically, PEP 8 tells you that:

Documented interfaces are considered public, unless the documentation explicitly declares them to be provisional or internal interfaces exempt from the usual backwards compatibility guarantees. All undocumented interfaces should be assumed to be internal.

However, they also say that you should use underscored names. For constants, they recommend you to use capital letters. So I would assume that non-capitalized constants are not meant to be publicly used. Anyway, I think we should create a separate issue to make anything that could have introduced breaking changes and make them explicitly deprecated (and after that, we'll be good and won't have problems anymore I think).

@riccardomanfrin

This comment was marked as off-topic.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no rebuild after file changes are detected Latex file is not updated when using the option numfig = True
5 participants