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

Provide jupyterlite-sphinx[xeus] and jupyterlite-sphinx[pyodide] extras? #243

Open
agriyakhetarpal opened this issue Dec 31, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@agriyakhetarpal
Copy link
Member

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-core side, but jupyterlite-sphinx as 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.

@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Dec 31, 2024
@Carreau
Copy link
Collaborator

Carreau commented Jan 6, 2025

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...)

@agriyakhetarpal
Copy link
Member Author

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:

"jupyterlite-core >=0.2,<0.5",

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants