DEP: avoid direct dependency on html5lib as an implementation detail from pandas#19900
DEP: avoid direct dependency on html5lib as an implementation detail from pandas#19900neutrinoceros wants to merge 1 commit into
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
e93e2fc to
1c90206
Compare
1c90206 to
1d71e6f
Compare
| # Special case: pandas defaults to HTML lxml for reading, but does not attempt | ||
| # to fall back to bs4 + html5lib. So do that now for convenience if user has | ||
| # not specifically selected a flavor. If things go wrong the pandas exception | ||
| # with instruction to install a library will come up. | ||
| if pandas_fmt == "html" and "flavor" not in kwargs: | ||
| if not HAS_LXML and HAS_HTML5LIB and HAS_BS4: | ||
| read_kwargs["flavor"] = "bs4" |
There was a problem hiding this comment.
As it turns out, this hack is actually obsolete with pandas>=2.2 (and we don't support older versions):
The default of
Nonetries to uselxmlto parse and if that fails it falls back onbs4+html5lib.
source:
https://pandas.pydata.org/pandas-docs/version/2.2/reference/api/pandas.read_html.html
mhvk
left a comment
There was a problem hiding this comment.
Yes, seems nice to make the dependency implicit! Comment in-line is minor, so approving, but might be good to get some further opinion.
| ipython = [ | ||
| "ipython>=8.1.0", | ||
| ] | ||
| pandas = [ |
There was a problem hiding this comment.
I slightly wonder why make an explicit option astropy[pandas] rather than just list pandas[html]>=2.2.2 where needed. Is it so that users can do it too?
There was a problem hiding this comment.
It's for deduplication of the lower boundary.
Description
ref #14316