Skip to content

Commit 4f3f28f

Browse files
authored
chore: use dependency-groups for dev (#2287)
# What does this PR do? The previous `[project.optional-dependencies]` was misrepresenting what the packages were. They were NOT optional dependencies to the project but development dependencies. Unlike optional dependencies, development dependencies are local-only and will not be included in the project requirements when published to PyPI or other indexes. As such, development dependencies are not included in the [project] table. Additionally, the dev group is synced by default. Source: https://docs.astral.sh/uv/concepts/projects/dependencies/#development-dependencies Signed-off-by: Sébastien Han <[email protected]>
1 parent 484abe3 commit 4f3f28f

File tree

6 files changed

+97
-80
lines changed

6 files changed

+97
-80
lines changed

.github/actions/setup-runner/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
- name: Install dependencies
1414
shell: bash
1515
run: |
16-
uv sync --all-extras
16+
uv sync --all-groups
1717
uv pip install ollama faiss-cpu
1818
# always test against the latest version of the client
1919
# TODO: this is not necessarily a good idea. we need to test against both published and latest

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ repos:
6161
"--frozen",
6262
"--no-hashes",
6363
"--no-emit-project",
64+
"--no-default-groups",
6465
"--output-file=requirements.txt"
6566
]
6667

@@ -89,7 +90,7 @@ repos:
8990
name: Distribution Template Codegen
9091
additional_dependencies:
9192
- uv==0.7.8
92-
entry: uv run --extra codegen ./scripts/distro_codegen.py
93+
entry: uv run --group codegen ./scripts/distro_codegen.py
9394
language: python
9495
pass_filenames: false
9596
require_serial: true
@@ -98,7 +99,7 @@ repos:
9899
name: API Spec Codegen
99100
additional_dependencies:
100101
- uv==0.7.8
101-
entry: sh -c 'uv run --with ".[dev]" ./docs/openapi_generator/run_openapi_generator.sh > /dev/null'
102+
entry: sh -c 'uv run ./docs/openapi_generator/run_openapi_generator.sh > /dev/null'
102103
language: python
103104
pass_filenames: false
104105
require_serial: true

pyproject.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ dependencies = [
4242
]
4343

4444
[project.optional-dependencies]
45+
ui = [
46+
"streamlit",
47+
"pandas",
48+
"llama-stack-client>=0.2.8",
49+
"streamlit-option-menu",
50+
]
51+
52+
[dependency-groups]
4553
dev = [
4654
"pytest",
4755
"pytest-timeout",
@@ -112,12 +120,6 @@ docs = [
112120
"sphinxcontrib.openapi",
113121
]
114122
codegen = ["rich", "pydantic", "jinja2>=3.1.6"]
115-
ui = [
116-
"streamlit",
117-
"pandas",
118-
"llama-stack-client>=0.2.8",
119-
"streamlit-option-menu",
120-
]
121123

122124
[project.urls]
123125
Homepage = "https://github.com/meta-llama/llama-stack"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file was autogenerated by uv via the following command:
2-
# uv export --frozen --no-hashes --no-emit-project --output-file=requirements.txt
2+
# uv export --frozen --no-hashes --no-emit-project --no-default-groups --output-file=requirements.txt
33
annotated-types==0.7.0
44
# via pydantic
55
anyio==4.8.0

scripts/unit-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ PYTHON_VERSION=${PYTHON_VERSION:-3.10}
1010

1111
command -v uv >/dev/null 2>&1 || { echo >&2 "uv is required but it's not installed. Exiting."; exit 1; }
1212

13-
uv python find $PYTHON_VERSION
13+
uv python find "$PYTHON_VERSION"
1414
FOUND_PYTHON=$?
1515
if [ $FOUND_PYTHON -ne 0 ]; then
16-
uv python install $PYTHON_VERSION
16+
uv python install "$PYTHON_VERSION"
1717
fi
1818

19-
uv run --python $PYTHON_VERSION --with-editable . --with-editable ".[dev]" --with-editable ".[unit]" pytest --asyncio-mode=auto -s -v tests/unit/ $@
19+
uv run --python "$PYTHON_VERSION" --with-editable . --group unit pytest --asyncio-mode=auto -s -v tests/unit/ $@

uv.lock

Lines changed: 81 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)