This repo is to show and summarize the group management procedures for uv.
The group manament have 2 parts:
- Solving dependency
- Installation
- Install packages to virtual python (recommended) or
- Install packages to system default python
we recommended install packages to virtual python instead of system default python since this is not only sample and strictly forward but also no extra requirement.txt
will be generated
-
create a
pyproject.toml
file -
add package to main
eg.
uv add numpy
note: package related info will be added to pyproject.toml and uv.lock. Also package will be added to virtual python (.venv)
-
add package to dev group
eg.
uv add --group dev ruff
note: package related info will be added to pyproject.toml and uv.lock. Also package will be added to virtual python (.venv)
-
add package to other group
eg.
uv add --group unittest pytest
note: package related info will be added to pyproject.toml and uv.lock. Also package will be added to virtual python (.venv)
After the runing above procedures, it will result the pyproject.toml
and uv.lock
files in this repo
-
install packages in only main (recorded in uv.lock) to
.venv
eg.
uv sync --no-dev --frozen --active
-
install packages in both main and dev group (recorded in uv.lock) to
.venv
eg.
uv sync --frozen --active
-
install packages in both main and other group (recorded in uv.lock) to
.venv
eg.
uv sync --group unittest --no-dev --frozen --active
-
install packages in only dev (recorded in uv.lock) to
.venv
eg.
uv sync --only-group dev --frozen --active
-
install packages in only other group (recorded in uv.lock) to
.venv
eg.
uv sync --only-group unittest --frozen --active
-
install packages in only main (recorded in uv.lock) to system default python (non-virual)
eg.
uv export --no-dev --format requirements-txt > requirements.txt uv pip install -r requirements.txt
-
install packages in both main and dev group (recorded in uv.lock) to system default python (non-virual)
eg.
uv export --format requirements-txt > requirements_dev.txt uv pip install -r requirements_dev.txt
-
install packages in both main and other group (recorded in uv.lock) to system default python (non-virual)
eg.
uv export --group unittest --no-dev --format requirements-txt > requirements_unittest.txt uv pip install -r requirements_unittest.txt
-
install packages in only dev (recorded in uv.lock) to system default python (non-virual)
eg.
uv export --only-group dev --format requirements-txt > requirements_only_dev.txt uv pip install -r requirements_only_dev.txt
-
install packages in only other group (recorded in uv.lock) to system default python (non-virual)
eg.
uv export --only-group unittest --format requirements-txt > requirements_only_unittest.txt uv pip install -r requirements_only_unittest.txt