Repository navigation
Deprecate public access to many mathtext internals. - #18378
Merged
Merged
Conversation
anntzer
force-pushed
the
private-mathtext
branch
from
August 30, 2020 20:32
79d539e to
d8025c9
Compare
timhoffm
reviewed
Sep 1, 2020
anntzer
force-pushed
the
private-mathtext
branch
from
September 2, 2020 03:56
90be77c to
5da1c62
Compare
QuLogic
reviewed
Sep 3, 2020
anntzer
force-pushed
the
private-mathtext
branch
3 times, most recently
from
September 3, 2020 08:20
f764aae to
ca81014
Compare
Contributor
Author
|
I decided to also make |
anntzer
force-pushed
the
private-mathtext
branch
2 times, most recently
from
September 4, 2020 08:40
336a702 to
130d7ca
Compare
QuLogic
reviewed
Sep 4, 2020
| "lib/matplotlib/dviread.py:docstring of matplotlib.dviread.DviFont:20" | ||
| ], | ||
| "matplotlib._mathtext.Box": [ | ||
| "doc/api/mathtext_api.rst:11", |
Member
There was a problem hiding this comment.
It makes more sense to update these references, or delete them, rather than start accepting them as missing.
Contributor
Author
There was a problem hiding this comment.
The problem is that (AFAICT) at least they will always show up in the SVG inheritance diagram. I got rid of the other occurrences, though.
anntzer
force-pushed
the
private-mathtext
branch
from
September 5, 2020 12:07
130d7ca to
6d2663b
Compare
QuLogic
reviewed
Sep 16, 2020
anntzer
force-pushed
the
private-mathtext
branch
from
September 16, 2020 18:02
6d2663b to
6cebba5
Compare
For most of these classes, there isn't really a "reasonable" way to use them via public API anyways. - `Fonts` subclasses are looked up via the private `_font_type_mapping` and extending that would require adding new entries for `rcParams["mathtext.fontset"]`. - `FontConstantsBase`\s are looked up via the private `_font_constant_mapping`. - `Node` and its subclasses are clearly internal constructs of the mathtext parser (technically, they are visible to `MathtextBackend` subclasses when their `render` method is called, but one cannot register new `MathtextBackend` subclasses either as that happens via the private `_backend_mapping`). - `Ship` is just an implementation detail for the `ship` callable, which can only be called on a `Node` or in a `MathtextBackend`, neither of which are really public per the above. - `Parser` is set up and driven via the (still public) `MathTextParser`. - `Error`, `SHRINK_FACTOR`, `GROW_FACTOR`, `NUM_SIZE_LEVELS` are helpers for the parser. - `latex_to_*`, `stix_virtual_fonts`, `tex2uni` are helper lookup tables for the fonts. (`tex2uni` stays indirectly accessible via the `get_unicode_index`, which basically performs lookup on it.) Making these private should simplify the implementation of various improvements to mathtext, e.g. better support for math fonts, as well as code cleanups.
anntzer
force-pushed
the
private-mathtext
branch
from
September 16, 2020 23:13
6cebba5 to
75c26f2
Compare
QuLogic
approved these changes
Sep 17, 2020
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For most of these classes, there isn't really a "reasonable" way to use
them via public API anyways.
Fontssubclasses are looked up via the private_font_type_mappingand extending that would require adding new entries for
rcParams["mathtext.fontset"].FontConstantsBase\s are looked up via the private_font_constant_mapping.Nodeand its subclasses are clearly internal constructs of themathtext parser (technically, they are visible to
MathtextBackendsubclasses when their
rendermethod is called, but one cannotregister new
MathtextBackendsubclasses either as that happens viathe private
_backend_mapping).Shipis just an implementation detail for theshipcallable, whichcan only be called on a
Nodeor in aMathtextBackend, neither ofwhich are really public per the above.
Parseris set up and driven via the (still public)MathTextParser.Error,SHRINK_FACTOR,GROW_FACTOR,NUM_SIZE_LEVELSare helpersfor the parser.
latex_to_*,stix_virtual_fonts,tex2uniare helper lookup tablesfor the fonts. (
tex2unistays indirectly accessible via theget_unicode_index, which basically performs lookup on it.)Making these private should simplify the implementation of various
improvements to mathtext, e.g. better support for math fonts, as well as
code cleanups.
We can later decide how to properly expose these internals (e.g. #9165).
See also #16181.
PR Summary
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsandpydocstyle<4and runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).