You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API: Deprecate show_in_browser and remove related JSViewer code #16067
Currently astropy exposes a way to create interactive HTML tables using datatables.net with the show_in_browser function. Astropy doesn't expose everything in the datatables API and it can be a bit hard to maintain JS specific code inside the astropy repository. We don't have any quantitative metrics about the usage of show_in_browser so maybe we can deprecate the function with a PendingDeprecationWarning and see if there are users how are actively using it? With a PendingDeprecationWarning we can reverse the deprecation too in the future if there is enough interest from the community to keep the function.
There is also an option to just remove the jsviewer function argument and keep the show_in_browser function with just the HTML output.
I want to say yes, removing the JSViewer bits and using show_in_browser with jsviewer=False should just print out the table in HTML. (Just a hunch on some quick tests)
Table.write(outfile, format="ascii.html") (uses io.ascii HTML writer). Full HTML doc <html>.
Table.show_in_browser (uses Table.write(..., format='ascii.html')). Full HTML doc.
I've always been a bit bothered by the completely different code bases. io.ascii.html is more sophisticated and uses XMLWriter to allow sanitizing the output etc. Somehow a common code base would be nice but I haven't really looked into what sort of issues would come out.
At the very least maybe our docs don't adequately convey these options (@eerovaher)?
Is there a timeline for this removal? I admittedly did not check the issues before jumping the gun and putting in a security report for a CVE related to the version of dataTables.js being used. For a "quick and dirty" fix, I have a PR that I can put in that simply updates the version of datatables to a non-vulnerable version. However, if the intent is to fully remove JS from astropy, I can certainly wait until that is implemented.
I would say that proposal to remove it all is "under discussion". We're trying to figure out how many people actually use this feature, so what is the impact of just plainly removing it. We've discussed that in our developer telecons and decided to try to develop docs that point to alternatives ("We removed show_in_browser, instead we now recommend XXX and YYY"). Basically, we're waiting to see if someone comes up with a good suggestion for that. Then, we could deprecate it and remove it in the next major release.
Got it. In that case, I'll go ahead and submit my PR for upgrading the version used, which could be a temporary solution depending on whether JS functionality gets deprecated or removed from the package.
Maybe this is too late to be useful. Just to say that as a user, I use show_in_browser(jsviewer=True) since it provides very helpful sortable tables for data exploration. I have a separate issue that I cannot embed html links in the the show in browser tables e.g. to external resourecs like NED but I need to explore this more. This also impacts the native show_in_browser. I will open a separate issue about this.
Activity
eerovaher commentedon Feb 19, 2024
I am in favor of removing bundled JavaScript from
astropy, but can the HTML output be written without it?MridulS commentedon Feb 19, 2024
I want to say yes, removing the JSViewer bits and using
show_in_browserwithjsviewer=Falseshould just print out the table in HTML. (Just a hunch on some quick tests)taldcroft commentedon Feb 20, 2024
About HTML output,
Tablehas several options for HTML output:Table._repr_html_- used in Jupyter (effectively usesTable.pformat). Output is at the<table>level.Table.pformat(html=True, tableid=..., tableclass=...). Output<table>level.Table.write(outfile, format="ascii.html")(usesio.asciiHTML writer). Full HTML doc<html>.Table.show_in_browser(usesTable.write(..., format='ascii.html')). Full HTML doc.I've always been a bit bothered by the completely different code bases.
io.ascii.htmlis more sophisticated and usesXMLWriterto allow sanitizing the output etc. Somehow a common code base would be nice but I haven't really looked into what sort of issues would come out.At the very least maybe our docs don't adequately convey these options (@eerovaher)?
Max1mus7 commentedon Apr 9, 2024
Is there a timeline for this removal? I admittedly did not check the issues before jumping the gun and putting in a security report for a CVE related to the version of dataTables.js being used. For a "quick and dirty" fix, I have a PR that I can put in that simply updates the version of datatables to a non-vulnerable version. However, if the intent is to fully remove JS from astropy, I can certainly wait until that is implemented.
hamogu commentedon Apr 11, 2024
I would say that proposal to remove it all is "under discussion". We're trying to figure out how many people actually use this feature, so what is the impact of just plainly removing it. We've discussed that in our developer telecons and decided to try to develop docs that point to alternatives ("We removed
show_in_browser, instead we now recommend XXX and YYY"). Basically, we're waiting to see if someone comes up with a good suggestion for that. Then, we could deprecate it and remove it in the next major release.Max1mus7 commentedon Apr 12, 2024
Got it. In that case, I'll go ahead and submit my PR for upgrading the version used, which could be a temporary solution depending on whether JS functionality gets deprecated or removed from the package.
richardgmcmahon commentedon Aug 8, 2025
Maybe this is too late to be useful. Just to say that as a user, I use show_in_browser(jsviewer=True) since it provides very helpful sortable tables for data exploration. I have a separate issue that I cannot embed html links in the the show in browser tables e.g. to external resourecs like NED but I need to explore this more. This also impacts the native show_in_browser. I will open a separate issue about this.
pllim commentedon Aug 8, 2025
Hmm isn't this issue resolved by #17521 already? The PR was merged in Dec 2024.