jupyterlite / jupyterlite/pyodide-kernel
Support constraints in piplite
- Dominant language
- Python
- Stars
- 90
- Forks
- 47
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
### Problem
`micropip 0.9.0` was just released, which support [constraints](https://pip.pypa.io/en/stable/user_guide/#constraints-files) (e.g. iff package _x_ is installed it must be version _y_ or from URL _z_). This will be very helpful for jupyterlite site builders as the (likely filtered) output of `pip list --format=freeze` would get us a step closer to reproducible envs. These _won't_ somehow magically participate in auto-import, as top-level names would still not be available.
When a version of `pyodide` is released which contains this (or a user builds a custom pyodide distribution containing it), `piplite` and the `%pip` magic won't yet support them, and as a "major" version upgrade containing other significant changes (such as vendoring `packaging`), might just break.
### Proposed Solution
- [ ] add `constraints` to various wrapper signatures around `micropip.install(..., constraints=[])` and `set_constraints`
- [ ] add `%pip install -c/--constraint`
- [ ] for `pip`, this is _always_ a file, but we already support `-r/--requirements`, so the existing logic should work
- [ ] add a way to set default constraints at build time
- [ ] discussed previously, adding a `pipliteInstallOptions` could allow for setting all the (non-`dependency`) options:
```json
{
"pipliteInstallOptions": {
"constraints": [
"ipywidgets ==8.1.2"
],
"index_urls": [],
"keep_going": true
}
}
```
### Additional context
- https://github.com/pyodide/micropip/pull/181
Contributor guide
Assessment
This issue has not been assessed yet.