forked from Shinonome/dots-hyprland
Update scriptdata/uv/README.md
I hope this is the last commit for this file recently.
This commit is contained in:
@@ -6,10 +6,11 @@ This is important because there has been so many complaints about the failure in
|
|||||||
## How to add/remove python package?
|
## How to add/remove python package?
|
||||||
|
|
||||||
1. Edit `requirements.in`. You may refer to [PyPI](https://pypi.org/) for possible package names.
|
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.
|
2. Run `uv pip compile requirements.in -o requirements.txt` in this folder.
|
||||||
|
|
||||||
**Notes:**
|
**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]
|
- `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.
|
[^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:
|
However:
|
||||||
- It's only for python script, not the command provided by python package.
|
- 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.
|
- 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`.
|
- 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
|
#### Solution B: bash script as wrapper
|
||||||
|
|||||||
Reference in New Issue
Block a user