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

Proposal for sphinxcontrib-jquery #9665

Merged
merged 23 commits into from
Nov 8, 2022

Conversation

benjaoming
Copy link
Contributor

@benjaoming benjaoming commented Oct 17, 2022

This is a proposal for a new Sphinx extension, as elaborated in the proposal itself.

Direct comments and suggestions are welcome through GitHub's code review.

A more general discussion or questions are welcome as comments to the Pull Request

Rendered version: https://dev--9665.org.readthedocs.build/en/9665/design/sphinx-jquery.html

Discussions about jQuery removal in Sphinx and extensions:


📚 Documentation previews 📚

@benjaoming benjaoming added Feature New feature Needed: design decision A core team decision is required Community Effort dependencies Pull requests that update a dependency file labels Oct 17, 2022
@benjaoming benjaoming requested a review from humitos October 17, 2022 14:32
@benjaoming benjaoming requested a review from a team as a code owner October 17, 2022 14:32
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is simple enough and it's a good start. I would reduce the scope a little bit and and remove one of the method proposed to avoid handling Sphinx<6 since it's not the target of this extension.

docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
@AA-Turner
Copy link

I've been directed to this discussion by Ben.

As opposed to the method, why not suggest app.setup_extension("sphinxcontrib.jquery")?

A

@benjaoming
Copy link
Contributor Author

benjaoming commented Oct 17, 2022

@AA-Turner [edit: sorry I now remember you don't like the additional @-mention]

That's interesting, I haven't considered that at all. However, one thing that would require an extra configuration value then would be force=True in case an extension needs more control. We consider this case for the "unexpected", i.e. an extension or theme that we haven't considered needs for and that want to load jQuery based on some other set of conditions. I'm not sure how to do that, I'm also not sure how realistic this case is. Would it be possible to register a config value jquery_force_enable and jquery_force_disable so that an additional layer of control is yielded to both other extensions and conf.py?

Maybe having config values is a better approach. It could ultimately mean that someone who wants to load jQuery by themselves (from their own CDN etc) is free to do so.

@AA-Turner
Copy link

Dear Ben,

I am not sure I understand the rationale for the force keyword, please may you briefly explain?

A

@benjaoming
Copy link
Contributor Author

We introduce sphinxcontrib-jquery for other themes and extensions to be able to provide jQuery through the extension. The general case is clear: Themes and extensions should have an easy way to continue using jQuery.

However, do we want an additional layer of control for themes, extensions and projects to specify exactly when they want jQuery loaded?

That's the ultimate question. I think that the proposal might have chosen a wrong mechanism for that.

  • If I write a theme or extension that has its own jQuery and I know that another extension might also load it, should I be able to switch off sphinxcontrib-jquery with a config value or some other mechanism?
  • If I have a project with its own CDN, should I be able to switch off sphinxcontrib-jquery? (config value seems obvious here)
  • If I have a theme or extension that doesn't even want Sphinx 5.x's jQuery but is still compatible with Sphinx 5.x? (not sure about this one, but it also seems unlikely)

@AA-Turner
Copy link

Dear Ben,

Thank you for your explanation; perhaps my understanding was too simple.

I had envisioned the extension as providing a way to pretend Sphinx had never removed jQuery, such that the jQuery library would be included as if it was provided by core Sphinx.

This would mean that extensions providing jQuery themselves would deal with the duplication similar to how they have in the past.

I do see some value in a global disable flag set somehow.

A

@benjaoming
Copy link
Contributor Author

I had envisioned the extension as providing a way to pretend Sphinx had never removed jQuery, such that the jQuery library would be included as if it was provided by core Sphinx.

That's also the main objective. That should be the default behavior.

I think we should throw other scenarios over board as long as no one is weighing in on them... or just do a design that can accommodate for them later. So it's all just pure speculation with potential for over-engineering.

@humitos what do you think about using config values instead of the force=True/False kwarg? I like how it pushes the configuration into a global layer, since it makes very little sense that Extension A wants jQuery and Extension B doesn't and the project owner maybe wants to include it from somewhere else or put a debugging version in place or whatevs... at the end of the day, there should be just 1 jQuery version included, hence the global configuration layer seems the right place, even though we may not know how/if it's going to used.

I'd like to change the proposal to use config values and then I think it's starting to look good 👍

@humitos
Copy link
Member

humitos commented Oct 18, 2022

@benjaoming

@humitos what do you think about using config values instead of the force=True/False kwarg?

I'm 👍🏼 on that. However, I'd use only one config value. Just jquery_force=True/False (default in `False) instead of two variables as mentioned in a previous comment.

@benjaoming
Copy link
Contributor Author

benjaoming commented Oct 18, 2022

I noticed that you already released a 1.0.0, great work. I noticed the Python requirement set to 3.7, and I wanted to add that we aim to have this package perhaps work for 3.6.. I can't tell what is out there building "in the wild", nor how much we are willing to break with an update of sphinx-rtd-theme. At this stage, when there is nothing technically in the way of supporting older Python and Sphinx releases, I think we shouldn't impose minimal version requirements until we know exactly what the aim is.

I don't know exactly what Sphinx and Python versions that we'll remove from sphinx-rtd-theme 2.0. I can imagine that we will remove Python 2.7 and Sphinx<4.

@AA-Turner
Copy link

AA-Turner commented Oct 18, 2022

Dear Ben,

Sphinx 6 -- no earlier than December, though probably before Christmas.

Why support Python 2.7? It has been end of life for nearly 3 years (April 2020). Are you proposing to also support Python 3.5 & 3.6 (EOL 2020, or 3.2 onwards (2.7's original EOL date)

Thanks,
Adam

@benjaoming
Copy link
Contributor Author

Hi AA-Turner

I see our comments have crossed each other. Your question should be answered already in the former comment.

Thanks for clarifying the release!

We need to do this if we want "zero downtime" for users that upgrade to Sphinx 6:

  1. sphinxcontrib-jquery is ready and tested with Sphinx 6 beta releases
  2. sphinx-rtd-theme 2.0 is ready with Sphinx 6 beta releases and sphinxcontrib-jquery
  3. other important extensions with jquery needs are ready with sphinxcontrib-jquery
  4. Sphinx 6.0.0 is released.

@benjaoming
Copy link
Contributor Author

I should add that I think we are in good shape time-wise if Sphinx is coming out in December and sphinxcontrib-jquery is already in the pipeline!

@AA-Turner
Copy link

AA-Turner commented Oct 18, 2022

Dear Ben,

It is too painful to test on pre-3.7 (I tried for around 2 hours to get it to work), but I have declared suppport for 2.7 and later in v2.0.0.

Thanks,
Adam

@AA-Turner
Copy link

I have invited Ben and Manuel to the sphinxcontrib-jquery repo.

Thanks,
Adam

@benjaoming
Copy link
Contributor Author

AA-Turner, thanks for adding us.

It is too painful to test on pre-3.7

I think that the pain of the developer is considerable and that we should not spend too much time on old stacks. My suggestion was to get rid of it if it comes for free.. but when it doesn't, then get rid of it 😄 👍

@benjaoming
Copy link
Contributor Author

benjaoming commented Oct 19, 2022

Dear AA-Turner,

Since you are already starting to implement and release stuff, do you mind if we do work to have the full proposal implemented and would you release that or grant access for us to release updates?

Thanks,
Ben

@AA-Turner
Copy link

Dear Ben,

Sounds good, hopefully I'll have time to review PRs etc.

A

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposal looks good to me. Considering that the repository and code is already done and the package already released, we need to make some adjustments here in the docs. Also, we need to update the code to reflect this document.

I'll approve these changes and ping @ericholscher and @agjohnson who were the other folks discussing this to do a final review, but I think we are good moving forward here.

docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
The most recently bundled jQuery version was v3.5.1 and only two releases have happened since: 3.6.0 and 3.6.1.
The 3.6.0 release had a very small backwards incompatibility which illustrates how harmless these upgrades are for the general purpose Sphinx package.

Therefore, we propose to start 1.0.0 at 3.5.1 (the currently shipped version) and subsequently release 3.6.1 as the first update of jQuery as 1.1.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also makes references to 1.x, but it should be updated.

docs/dev/design/sphinx-jquery.rst Show resolved Hide resolved
Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 This all seems reasonable, it's still pretty close to what we discussed previously.

docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Show resolved Hide resolved
docs/dev/design/sphinx-jquery.rst Outdated Show resolved Hide resolved
@benjaoming
Copy link
Contributor Author

+1 This all seems reasonable, it's still pretty close to what we discussed previously.

@agjohnson yes definitely - the intention was to move an internal effort into a public scope here. Hopefully everything from the previous discussions got reflected and duplicated 😄

@benjaoming
Copy link
Contributor Author

Thanks for all the comments! I'd suggest to keep the PR open for any further commenting, but that we move forwards with implementing the remaining part of the proposal. I'll open issues in https://github.com/sphinx-contrib/jquery

@benjaoming
Copy link
Contributor Author

@AA-Turner I'm slightly "under the weather", but I'll try to get to the freshly added issues in the repo and create tests where meaningful.

If anyone wants to jump in, please feel free to self-assign the issue 👍

@humitos
Copy link
Member

humitos commented Nov 8, 2022

I think we can just merge this PR as-is since it already worked as a canonical place to discuss the proposal implementation and the work is already happening. If anything, you can just add a small paragraph mentioning the repository where this work is happening and then merge it.

@benjaoming
Copy link
Contributor Author

Yes, I think we are also out of time for processing more feedback 👍

@benjaoming benjaoming merged commit 862ec90 into readthedocs:main Nov 8, 2022
@benjaoming benjaoming deleted the sphinxcontrib-jquery branch November 8, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Effort dependencies Pull requests that update a dependency file Feature New feature Needed: design decision A core team decision is required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants