using_pip/Files/untitled.txt

39 lines
1.5 KiB
Text
Raw Permalink Normal View History

2025-10-20 03:23:45 +00:00
Using pylock.toml:
1. Create a requirements.in file that has full path to the local libraries:
.local-libraries/tufte-0.7.0-py3-none-any.whl
.local-libraries/clear_run_to_selected-0.3.0-py3-none-any.whl
This is somewhat inconvenient because it means that the requirements.in file has to be updated when the version of the library changes.
2. Use uv to create the pylock.toml file:
uv pip compile requirements.in -o pylock.toml
3. Have uv create the venv:
uv pip sync pylock.toml
4. Use the t.sh script to run Jupyter lab. The script creates environment variables for the Jupyter paths, adds .venv/bin to the PATH and and starts jupyter with the lab option:
#!/bin/bash
export JUPYTERLAB_SETTINGS_DIR="${PWD}/.jupyter/lab/user-settings"
export JUPYTER_DATA_DIR="${PWD}/.jupyter/data"
export JUPYTER_CONFIG_DIR="${PWD}/.jupyter"
export VIRTUAL_ENV_PROMPT=.venv
export PATH=".venv/bin:$PATH"
jupyter lab
5. Note that this approach pins all of the versions, including all the versions for Jupyter Lab. One can argue that this is good in the sense that users will not run new libraries created after the date when the current lock file was generated. However, if we want to always be just 30 days behind the most recent versions, we have to continually:
- update the update the requirements.in file and the wheels in the local-libraries folder
- recreate the `pylock.toml` file generated from the requirements.in file
- re-run the command `uv pip sync pylock.toml`