jupyterlite-sphinx
jupyterlite-sphinx copied to clipboard
Provide `jupyterlite-sphinx[xeus]` and `jupyterlite-sphinx[pyodide]` extras?
Problem
Users need to install both jupyterlite-xeus and jupyterlite-pyodide-kernel separately with jupyterlite-sphinx as a part of their docs requirements/lockfiles or with their [docs] (or sometimes [doc]) optional dependencies.
Proposed solution
As mentioned in the issue title, we could provide the jupyterlite-sphinx[xeus] and jupyterlite-sphinx[pyodide] extras, because using jupyterlite-sphinx (and in-turn, JupyterLite), probably doesn't make sense without at least one of them installed?
Additional context
- This could also be done on the
jupyterlite-coreside, butjupyterlite-sphinxas a dependency is more user-facing in comparison. - Our dependents, such as
sphinx-gallery, can provide their own extras using our extras
N.B. If someone would need a specific version of the jupyterlite-pyodide-kernel or jupyterlite-xeus, they will need to list it as a separate requirement.
That seem reasonable; if you believe it is also necessary on jupyterlite-core, maybe we could have jupyterlite-sphinx[xeus] depends on jupyterlite-core[xeus] (and so on...)
I think we will have to think about this a bit. In most cases, it shouldn't be a problem, but if someone needs a specific version of any of the kernels, the resolver may not be able to solve and proceed further. Unfortunately, there isn't a [extra+constraint] syntax for optional dependencies, where extras would also be considered during resolution (that would sort of defeat the point of them being extras as well, so it probably doesn't make sense).
For example, with jupyterlite-sphinx 0.17.1, i.e., the stable version at the time of writing on 10/01/2025, we pin jupyterlite-core >=0.2,<0.5: https://github.com/jupyterlite/jupyterlite-sphinx/blob/eaaa12f8057b559f4fb269363885dbfe7d3060d3/pyproject.toml#L19
which means jupyterlite-pyodide-kernel version 0.5.0 which was released on 09/01/2025, cannot be installed unless we relax that constraint. Quoting the traceback below from https://github.com/sympy/sympy/actions/runs/12689176534/job/35368211630?pr=27419 where I encountered it today:
INFO: pip is looking at multiple versions of jupyterlite-sphinx to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r doc/requirements.txt (line 3) and -r doc/requirements.txt (line 8) because these package versions have conflicting dependencies.
The conflict is caused by:
jupyterlite-pyodide-kernel 0.5.0 depends on jupyterlite-core<0.6.0 and >=0.5.0
jupyterlite-sphinx 0.17.1 depends on jupyterlite-core<0.5 and >=0.2
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip to attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
which means that an unsuspecting user would face an error if they were to assume that the below requirement would work:
jupyterlite-sphinx[pyodide]
jupyterlite-pyodide-kernel>=0.5.0
So, we can proceed with adding these extras only if we can keep up jupyterlite-sphinx releases that relax jupyterlite-core as soon as the latter is released, or we'll need to drop the upper pin completely for jupyterlite-core that is present on both jupyterlite-pyodide-kernel's side and on our side.
maybe we could have jupyterlite-sphinx[xeus] depends on jupyterlite-core[xeus]
I think this could work, as it would at least allow testing the installation in CI.
Maybe you would have some thoughts about this, @jtpio?
jupyterlite-core[xeus]
jupyterlite-core currently does provide some extras: https://github.com/jupyterlite/jupyterlite/blob/14037562a335beffd43d53a38d42434e9a963102/py/jupyterlite-core/pyproject.toml#L55-L92
Most have a real purpose, for example jupyter_server is used for indexing contents, jupyterlab_server for picking up translation bundles.
For kernels, not sure we should go down the path of having these extras for xeus and pyodide in jupyterlite-core. Originally jupyterlite used to ship the pyodide kernel by default, but this was changed to allow installing other kernels more easily (with the creation of jupyterlite-core).