Fix sas.models suppression to not accidentally allow private members into sphinx docs#3954
Conversation
|
@pkienzle to review -- The immediate thought is that it is not a risky merge for 6.2 and it does affect the documentation built into sasview. Thus it is worth considering for that even though it is well past code freeze, though certainly not critical. |
There was a problem hiding this comment.
Mostly ruff formatting changes.
As long as the docs build cleanly the impact will be minimal. The worst case is a broken link if a there is a references to a function or method that will be excluded.
I built the docs with this branch and verified that
- a function with a leading underscore and a docstring in a module without
__all__defined does not appear in the documentation (sasmodels.product._tag_parameterin
build/doc/dev/sasmodels-api/product.html), and that - a documented class whose method has a leading underscore and a docstring is also excluded (
sasmodels.modelinfo.ParameterTable._get_defaultsinbuild/doc/dev/sasmodels-api/modelinfo.html). - references of the form the regex
:`[^`]*\b_(there are a few) only exist in unincluded docstrings.
|
I think this is worth cherry-picking for 6.2.0 - the API documentation is close to unusable in its current form, as sphinx is picking up all manner of dunders that obscure the actually useful documentation. An example picked at random but is typical of the entire API docs currently in 6.2.0a3: There's a lot of noise in that, making the API docs pretty hard to read and navigate. Up until sphinx 3.0, all of the names starting with
For the |
|
Agreed! Exactly what I was thinking. This has been a longtime irritation so really appreciate your fixing it @llimeht |
|
@jellybean2004 see the discussion here about potentially including this PR in the 6.2 release. |
They are internal functions referenced in the docstrings for other internal functions. No need to document them. |
Description
Previous changes had allowed private names (variables, functions, methods starting with
_or__) to leak into the sphinx API docs. The result was that they were full of lots of meaningless items that should be hidden from the user. This patch restores the name (in)visibility in the API docs.How Has This Been Tested?
The file that initially drew this to our attention was
dev/sasview-api/sas.qtgui.Perspectives.ParticleEditor.datamodel.html- it came up because the private functions that were included into the docs had irreproducible signatures.As seen in the CI outputs here, that file no longer contains these private names. This also makes the package reproducible, an important step in software assurance.
This patch also removes from very very old compatibility code for Sphinx 2.x.
Review Checklist:
[if using the editor, use
[x]in place of[ ]to check a box]Documentation (check at least one)
Installers
Licensing (untick if necessary)