From fcf46469281771288e06b411cf1efa2dbc1b7808 Mon Sep 17 00:00:00 2001 From: "Celestial.y" Date: Thu, 9 Oct 2025 19:43:31 +0800 Subject: [PATCH] Update scriptdata/uv/README.md I hope this is the last commit for this file recently. --- scriptdata/uv/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scriptdata/uv/README.md b/scriptdata/uv/README.md index ad1299662..5bbe99fe9 100644 --- a/scriptdata/uv/README.md +++ b/scriptdata/uv/README.md @@ -6,10 +6,11 @@ This is important because there has been so many complaints about the failure in ## How to add/remove python package? 1. Edit `requirements.in`. You may refer to [PyPI](https://pypi.org/) for possible package names. + - If PyPI does not have the needed package, we probably need to build it manually inside the venv. In such case we need to edit the install scripts. 2. Run `uv pip compile requirements.in -o requirements.txt` in this folder. **Notes:** -- See also [uv doc](https://docs.astral.sh/uv/pip/dependencies/#using-requirementsin). +- For reference see [uv doc](https://docs.astral.sh/uv/pip/dependencies/#using-requirementsin). - `requirements.txt` is included in Git. It's for locking package versions to enhance stability and reproducibility.[^1] [^1]: In fact, including package version lock file in Git is also the most common way for similar situations, for example the `package-lock.json` of Node.js projects (see also [this stackoverflow question](https://stackoverflow.com/questions/48524417/should-the-package-lock-json-file-be-added-to-gitignore)). Although there are some situations when it's not suitable to include the lock file, for example [the poetry document](https://python-poetry.org/docs/basic-usage/#committing-your-poetrylock-file-to-version-control) recommend application developers to include package version lock file in Git, but library developers should consider more, such as not inluding the lock file or including it but refreshing regularly. @@ -72,7 +73,7 @@ And that's it! However: - It's only for python script, not the command provided by python package. - It can not deal with complex argument (e.g. filename containing spaces) passed to the python script. - - The example above is actually unstable, considering that `--image '${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)}'` could be a rather complex argument. + - If we apply this solution to the example above, it may cause problem, considering that `--image '${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)}'` could be a rather complex argument passed to `find_regions.py`. - This solution rely on shebang to activate the correct python venv, but the shebang will be ignored if the script is passed as a parameter to python, e.g. `python3 foo.py`. #### Solution B: bash script as wrapper