Skip to content

API: Deprecate show_in_browser and remove related JSViewer code #16067

Closed

Description

@MridulS

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.

Activity

  1. eerovaher commented on Feb 19, 2024

    @eerovaher
    Member

    I am in favor of removing bundled JavaScript from astropy, but can the HTML output be written without it?

  2. MridulS commented on Feb 19, 2024

    @MridulS
    ContributorAuthor

    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)

  3. taldcroft commented on Feb 20, 2024

    @taldcroft
    Member

    About HTML output, Table has several options for HTML output:

    • Table._repr_html_ - used in Jupyter (effectively uses Table.pformat). Output is at the <table> level.
    • Table.pformat(html=True, tableid=..., tableclass=...). Output <table> level.
    • 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)?

  4. added
    API changePRs and issues that change an existing API, possibly requiring a deprecation period
    on Feb 23, 2024
  5. Max1mus7 commented on Apr 9, 2024

    @Max1mus7
    Contributor

    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.

  6. hamogu commented on Apr 11, 2024

    @hamogu
    Member

    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.

  7. Max1mus7 commented on Apr 12, 2024

    @Max1mus7
    Contributor

    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.

  8. richardgmcmahon commented on Aug 8, 2025

    @richardgmcmahon

    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.

  9. pllim commented on Aug 8, 2025

    @pllim
    Member

    Hmm isn't this issue resolved by #17521 already? The PR was merged in Dec 2024.

  10. added
    Close?Tell stale bot that this issue/PR is stale
    on Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API changePRs and issues that change an existing API, possibly requiring a deprecation periodClose?Tell stale bot that this issue/PR is staletable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions