Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing JavaScript Dependencies #10070

Closed
2 of 25 tasks
TimKam opened this issue Jan 8, 2022 · 42 comments
Closed
2 of 25 tasks

Removing JavaScript Dependencies #10070

TimKam opened this issue Jan 8, 2022 · 42 comments
Labels
html theme type:enhancement enhance or introduce a new feature
Milestone

Comments

@TimKam
Copy link
Member

TimKam commented Jan 8, 2022

Relates to #10028.
Sphinx plans to remove jQuery and underscore JS dependencies in version 6.0.0 (i.e., eventually, there is plenty of time). This will probably break many extensions and themes and we need to try and find at least the most important ones.

TODOs:

@TimKam TimKam added type:enhancement enhance or introduce a new feature html theme labels Jan 8, 2022
@TimKam TimKam added this to the some future version milestone Jan 8, 2022
@TimKam
Copy link
Member Author

TimKam commented Jan 8, 2022

Looping in some Read the Docs folks: @ericholscher & @nienn: Do you have any advice or can you provide any intel based on RTD usage? For example, we could check the most important extensions and themes, based on RTD usage stats. Thank you.

@AA-Turner
Copy link
Member

AA-Turner commented Jan 8, 2022

From a quick look, the only usage in https://github.com/sphinx-doc I can see 1 is https://github.com/sphinx-doc/sphinxcontrib-websupport/blob/master/sphinxcontrib/websupport/files/websupport.js

Popular/impactful themes -- I'd probably suggest looking at at least:

Actual data would of course be more helpful!

A

Footnotes

  1. This is the link for GitHub's new code search preview -- I also went through for underscore and the $ and $u symbols. https://cs.github.com/?scopeName=All+repos&scope=&q=org%3Asphinx-doc++jQuery

@pradyunsg
Copy link
Contributor

I can confirm that Furo doesn't depend on jQuery or UnderscoreJS.

@TimKam
Copy link
Member Author

TimKam commented Jan 8, 2022

Thanks! I forgot that there is a separate org for many extensions: https://github.com/sphinx-contrib/ (I do not have access to the new GitHub code search feature, yet.)

@pradyunsg
Copy link
Contributor

Doing a search on sphinx-contrib brings up references in findanything and images.

There's a total of 10 results, all in these two. Okay, there's one in zopeext but that's in an HTML file.

@TimKam
Copy link
Member Author

TimKam commented Jan 10, 2022

I now have access to GitHub code search and found these two extensions that use jQuery:

@ericholscher
Copy link
Contributor

@TimKam Sadly we don't have great stats on extension usage across the platform. This is something we hope to figure out eventually, but not something we have currently.

@TimKam
Copy link
Member Author

TimKam commented Jan 12, 2022

Thanks, @ericholscher. Let us know if there's anything we need to consider from RTD's perspective when removing jQuery and underscore. @tk0miya I think many templates will break if we don't announce this carefully. Should we add an info message when building or something similar?

@tk0miya
Copy link
Member

tk0miya commented Jan 13, 2022

I don't have good idea to let developers know the deprecation. But info or message warnings on build would not help it, I think. So it would be better to announce it on CHANGES file and sphinx-users group.

@AA-Turner
Copy link
Member

An idea I had is (attempting to) patch the actual jQuery object itself in JS, and warn on any method access. I don't think it's great though, as it relies on users checking the JS console.

Agree with @tk0miya on adding notes to CHANGES etc -- my initial PR at #10028 does this, although maybe it could be called out more?

A

@Daltz333
Copy link

Daltz333 commented Feb 9, 2022

https://github.com/wpilibsuite provides several popular extensions and we are tracking this change. Not sure when we'll make the change, but we'll get to it.

@marxin
Copy link
Contributor

marxin commented Mar 7, 2022

I've noticed Search results are quite broken, one can see it also on the official website:

https://www.sphinx-doc.org/en/master/search.html?q=--keep-going

Search Results
Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.

Search Results
Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.

[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]

I see the section Search Results twice and the [object Object] seems to be a weird result.

What was displayed before:
https://sphinx--10240.org.readthedocs.build/en/10240/search.html?q=--keep-going

Search Results
Search finished, found 2 page(s) matching the search query.

sphinx-build.--keep-going (program option, in sphinx-build)
sphinx-build.--keep-going (program option, in sphinx-build)

Moreover, the following is also bad:
https://www.sphinx-doc.org/en/master/search.html?q=sphinx-build

...
sphinx-build.11 (program option, in sphinx-build)
sphinx-build.11 (program option, in sphinx-build)
sphinx-build.12 (program option, in sphinx-build)
sphinx-build.12 (program option, in sphinx-build)
sphinx-build.13 (program option, in sphinx-build)
sphinx-build.13 (program option, in sphinx-build)
sphinx-build.14 (program option, in sphinx-build)
sphinx-build.14 (program option, in sphinx-build)
sphinx-build.15 (program option, in sphinx-build)
sphinx-build.15 (program option, in sphinx-build)
...

@AA-Turner
Copy link
Member

@marxin looking at the console output at least part of the problem is that read the docs' overwriting of Sphinx search isn't fixed yet -- does the problem persist on 'pure' Sphinx?

image

A

@marxin
Copy link
Contributor

marxin commented Mar 7, 2022

@marxin looking at the console output at least part of the problem is that read the docs' overwriting of Sphinx search isn't fixed yet -- does the problem persist on 'pure' Sphinx?

Dunno. Is there a bug report about the RTD issue, please?

@marxin
Copy link
Contributor

marxin commented Mar 7, 2022

@stsewd
Copy link
Contributor

stsewd commented Mar 7, 2022

@marxin I'm trying to fix all things related to search on latest sphinx and rtd, I'm tracking the progress at readthedocs/readthedocs.org#8871.

@AA-Turner
Copy link
Member

And I have a project where it fails...

https://splichal.eu/scripts/sphinx/demo/_build/html/search.html?q=-Wno-shift-overflow

In that project, https://splichal.eu/scripts/sphinx/demo/_build/html/searchindex.js doesn't have wno-shift-overflow composited in "terms" so the regex match won't work. Do you have a link to the same project on version 4.y.z?

Sorry to ask for more things, I'm just trying to find where the error is -- the stemmer, the index, searchtools.js itself. etc.

A

@marxin
Copy link
Contributor

marxin commented Mar 7, 2022

In that project, https://splichal.eu/scripts/sphinx/demo/_build/html/searchindex.js doesn't have wno-shift-overflow composited in "terms" so the regex match won't work. Do you have a link to the same project on version 4.y.z?

Sure, there's a version built with 4.x branch:
https://splichal.eu/tmp/_build/html/search.html?q=-Wno-shift-overflow

@AA-Turner
Copy link
Member

@marxin does #10247 fix the issue?

A

@marxin
Copy link
Contributor

marxin commented Mar 8, 2022

@marxin
Copy link
Contributor

marxin commented Mar 8, 2022

Note you can use the following Demo project for testing:
https://github.com/marxin/sphinx-demo

@marxin
Copy link
Contributor

marxin commented Mar 15, 2022

@AA-Turner Can you please take a look at the attached demo project and investigate what's wrong? Thanks.

@AA-Turner AA-Turner added this to the 6.0.0 milestone Jun 30, 2022
@humitos
Copy link
Contributor

humitos commented Jul 4, 2022

@humitos

I'd like to do a __contains together with a __regex for the name, so I can do sphinxcontrib-*, but I think that's not possible. I've tried executing some raw queries using PostgreSQL JSON fields syntax without success sob

I went ahead and did this manually in a dirty way to, at least, have these numbers 😄

  1. get the list of all repositories from sphinx-contrib GH organization
$ gh api --paginate -H "Accept: application/vnd.github+json" /orgs/sphinx-contrib/repos | jq -r '.[].name' | sort > sphinx-crontib.repositories
  1. query the database for each of them prefixing sphinxcontrib-
  2. results: https://gist.github.com/humitos/489b9159b21faffd9ce1d0d2c91ec5ff

Note this data belongs to projects that were built at least once starting in mid-May (when we started collecting this data) and the repository name does not always match the PyPI package name.

I hope this data is useful to make better decisions.

@humitos
Copy link
Contributor

humitos commented Sep 14, 2022

Hi all! I've been working on analyzing some data we have been collecting on Read the Docs after building the "telemetry" database. That data helps us to answer questions like "What are the most used Sphinx extensions in a period?". I wrote a blog about this at https://blog.readthedocs.com/knowing-more-about-ourselves/ and added this particular plot on it.

I think that plot/data could be useful when prioritizing the work required to remove JavaScript dependency and on what extensions work first. Let me know if you find this useful and if you are interested in a particular question that can be answered with the data we have now. Thanks!

@AA-Turner
Copy link
Member

Thanks @humitos! Would it be possible to have the extension popularity data in a tabular format? (Eg just pasted in a table here.)

We can then look through the most popular and open issues or identify JS deps etc.

Thanks,
Adam

@AA-Turner
Copy link
Member

Ping here @humitos!

A

@pradyunsg
Copy link
Contributor

FWIW, I believe @humitos is currently travelling to attend a conference. He might respond during the trip but I figured it can’t hurt to mention this to set expectations. :)

@AA-Turner
Copy link
Member

Ahh, thanks Pradyun. This isn't urgent, of course.

A

@humitos
Copy link
Contributor

humitos commented Sep 24, 2022

I'm at DjangoConEU and that's why I haven't replied yet. However, I should have mentioned this before, tho 🙂

I plan to come back to this issue next week and upload the data requested with more information about the filters used to get it.

@humitos
Copy link
Contributor

humitos commented Sep 27, 2022

Hey @AA-Turner! I'm back to work and I executed the query for the following statement:

Number of projects on Read the Docs with a build between 2022-08-01 and 2022-09-01 that installed Python packages (including transitive dependencies) matching "^(sphinx|sphinxcontrib)-" regex on their name and group by extension's name.

Raw query

SELECT
  COUNT(DISTINCT data->'project'->'id') AS projects,
  item->>'name' AS name
FROM 
  "telemetry_builddata",
  LATERAL jsonb_path_query(data, '$.packages.pip.all ? (@.name like_regex "^(sphinxcontrib|sphinx)-")') item
WHERE
  created BETWEEN '2022-08-01' AND '2022-09-01'
GROUP BY item->>'name'
ORDER BY projects DESC;

and these are the results: sphinx-extensions.csv

Let me know if this is the correct query you were expecting and if it's helpful for you to make better decisions.

@AA-Turner
Copy link
Member

Thank you @humitos, this is really usefull!

Do you track package dependency data at all? I.e. package X has a transitive/direct dependency on Sphinx core but might not have "sphinx" in its name.

If you don't, I could probably build this data myself but I imagine the CSV file of all dependencies downloaded into RTD is substantially larger!

A

@AA-Turner
Copy link
Member

The other (top-down) direction would be if you track the contents of the "extensions" or "html_theme" keys in conf.py, which might be easier!

A

@humitos
Copy link
Contributor

humitos commented Sep 27, 2022

Unfortunately, we don't track the package dependency nor the contents of extensions or html_theme. I have another query that removes the list of extensions from https://github.com/sphinx-doc/sphinx/blob/5.x/pyproject.toml#L59 but I thought I shouldn't filter here to keep the query simple and easy to understand.

@humitos
Copy link
Contributor

humitos commented Oct 17, 2022

Unfortunately, we don't track the package dependency nor the contents of extensions or html_theme

The PR I created to track these got merged already. Hopefully, we will have some data about the extensions starting next week 👍🏼

@AA-Turner
Copy link
Member

From @humitos's first list, the following depend on jQuery implicitly. I have checked the entire list and I believe all the others are fine.

projects name
13026 sphinx-rtd-theme
5106 sphinxcontrib-websupport
130 sphinx-bootstrap-theme
85 sphinx-hoverxref
76 sphinx-version-warning
54 sphinx-thebe
41 sphinxcontrib-needs
37 sphinxcontrib-contentui
32 sphinxcontrib-images
31 sphinx-press-theme
25 sphinx-rtd-dark-mode
19 sphinx-toggleprompt
15 sphinx-bluebrain-theme
12 sphinxcontrib-httpexample
8 sphinx-pdj-theme
8 sphinx-wagtail-theme
6 sphinx-theme
6 sphinx-typlog-theme
6 sphinx-data-viewer
5 sphinx-py3doc-enhanced-theme

A

@AA-Turner
Copy link
Member

Sphinx 6.0.0 has been released.

A

@AA-Turner AA-Turner unpinned this issue Dec 30, 2022
st3iny added a commit to nextcloud/documentation that referenced this issue Jan 11, 2023
JQuery was removed as of Sphinx 6. The maintainers of our theme already
reacted to this but the release is not final yet.
Ref sphinx-doc/sphinx#10070
Ref readthedocs/sphinx_rtd_theme#1385

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
backportbot-nextcloud bot pushed a commit to nextcloud/documentation that referenced this issue Jan 11, 2023
JQuery was removed as of Sphinx 6. The maintainers of our theme already
reacted to this but the release is not final yet.
Ref sphinx-doc/sphinx#10070
Ref readthedocs/sphinx_rtd_theme#1385

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
backportbot-nextcloud bot pushed a commit to nextcloud/documentation that referenced this issue Jan 11, 2023
JQuery was removed as of Sphinx 6. The maintainers of our theme already
reacted to this but the release is not final yet.
Ref sphinx-doc/sphinx#10070
Ref readthedocs/sphinx_rtd_theme#1385

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
backportbot-nextcloud bot pushed a commit to nextcloud/documentation that referenced this issue Jan 11, 2023
JQuery was removed as of Sphinx 6. The maintainers of our theme already
reacted to this but the release is not final yet.
Ref sphinx-doc/sphinx#10070
Ref readthedocs/sphinx_rtd_theme#1385

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
html theme type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

10 participants