Skip to content

Commit 08b8327

Browse files
Migrate to uv
1 parent b0e32bb commit 08b8327

File tree

8 files changed

+1316
-1758
lines changed

8 files changed

+1316
-1758
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,48 +91,48 @@ asyncio.run(test_notifier())
9191

9292
## Local development
9393

94-
The project is managed using [poetry](https://python-poetry.org/). Make sure to have it installed first.
94+
The project is managed using [uv](https://docs.astral.sh/uv/). Make sure to have it installed first.
9595

9696
Then install the dependencies
9797

9898
```console
99-
poetry install
99+
uv sync
100100
```
101101

102102
## Generating protobuf
103103

104104
To generate Python protobuf definitions run
105105

106106
```console
107-
poetry run ./compile_proto.sh
107+
uv run ./compile_proto.sh
108108
```
109109

110110
## Testing
111111

112112
You can test the SDK by running
113113

114114
```console
115-
poetry run ci_test
115+
uv run ci_test
116116
```
117117

118118
In local development you can use
119119

120120
```console
121-
poetry run local_test
121+
uv run local_test
122122
```
123123

124124
## Format & Lint
125125

126126
You can format code by running
127127

128128
```console
129-
poetry run format
129+
uv run format
130130
```
131131

132132
You can check linter by running
133133

134134
```console
135-
poetry run lint
135+
uv run lint
136136
```
137137

138138
## Documentation
@@ -143,7 +143,7 @@ To update documentation you need to:
143143

144144
- Go to https://github.com/fishjam-cloud/fishjam/blob/main/openapi.yaml and open the raw file.
145145
- Copy the URL.
146-
- Run `poetry run update_client <copied-url>`
146+
- Run `uv run update_client <copied-url>`
147147

148148
## License
149149

docker-compose-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ services:
1818
FJ_SIP_IP: "127.0.0.1"
1919
FJ_COMPONENTS_USED: "rtsp file hls recording sip"
2020
FJ_BROADCASTING_ENABLED: "true"
21-
FJ_BROADCASTER_URL: "http://broadcaster:4000"
22-
FJ_BROADCASTER_TOKEN: "broadcaster_token"
21+
FJ_BROADCASTER_URL: "http://broadcaster:4000"
22+
FJ_BROADCASTER_TOKEN: "broadcaster_token"
2323
FJ_BROADCASTER_WHIP_TOKEN: "whip_token"
2424
ports:
2525
- "5002:5002"
@@ -43,7 +43,7 @@ services:
4343
dockerfile: tests/Dockerfile
4444
args:
4545
PYTHON_VERSION: ${PYTHON_VERSION:-3.10}
46-
command: poetry run pytest
46+
command: uv run pytest
4747
environment:
4848
DOCKER_TEST: "TRUE"
4949
depends_on:

poetry.lock

Lines changed: 0 additions & 1679 deletions
This file was deleted.

poetry.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

pyproject.toml

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,67 @@
1-
[tool.poetry]
1+
[project]
22
name = "fishjam-server-sdk"
33
version = "0.20.0"
44
description = "Python server SDK for the Fishjam"
5-
authors = ["Fishjam Team"]
6-
homepage = "https://github.com/fishjam-cloud/python-server-sdk"
7-
documentation = "https://fishjam-cloud.github.io/python-server-sdk/fishjam"
8-
license = "Apache-2.0"
5+
authors = [{ name = "Fishjam Team", email = "[email protected]" }]
6+
requires-python = ">=3.10"
97
readme = "README.md"
10-
packages = [{ include = "fishjam" }]
8+
license = "Apache-2.0"
9+
dependencies = [
10+
"websockets~=15.0",
11+
"urllib3>=1.25.3,<2",
12+
"aenum>=3.1.15,<4",
13+
"python-dateutil>=2.8.2,<3",
14+
"betterproto==2.0.0b6",
15+
"httpx>=0.20.0,<0.26.0",
16+
"attrs>=21.3.0",
17+
"flask-cors>=6.0.1,<7",
18+
]
1119

12-
[tool.poetry.dependencies]
13-
python = "^3.10"
14-
websockets = "^15.0"
15-
urllib3 = ">=1.25.3,<2"
16-
aenum = "^3.1.15"
17-
python-dateutil = "^2.8.2"
18-
betterproto = "2.0.0b6"
19-
httpx = ">=0.20.0,<0.26.0"
20-
attrs = ">=21.3.0"
21-
flask-cors = "^6.0.1"
20+
[project.urls]
21+
Homepage = "https://github.com/fishjam-cloud/python-server-sdk"
22+
Documentation = "https://fishjam-cloud.github.io/python-server-sdk/fishjam"
2223

23-
[tool.poetry.group.dev.dependencies]
24-
betterproto = { version = "= 2.0.0b6", extras = ["compiler"] }
25-
pdoc = "^15.0.0"
26-
mkdocs = "^1.5.3"
27-
mike = "^2.0.0"
28-
openapi-python-client = "^0.16.0"
29-
ruff = "^0.1.7"
30-
flask = "^3.0.3"
31-
pyright = "^1.1.383"
24+
[project.scripts]
25+
ci_test = "scripts:run_tests"
26+
local_test = "scripts:run_local_test"
27+
format = "scripts:run_formatter"
28+
format_check = "scripts:run_format_check"
29+
lint = "scripts:run_linter"
30+
fix_lint = "scripts:run_linter_fix"
31+
generate_docs = "scripts:generate_docs"
32+
update_client = "scripts:update_client"
33+
room_manager = "scripts:start_room_manager"
3234

33-
[tool.poetry.group.test.dependencies]
34-
pytest = "^7.4.2"
35-
pytest-asyncio = "^0.21.1"
36-
requests = "^2.31.0"
37-
flask = "^3.0.3"
35+
[dependency-groups]
36+
dev = [
37+
"betterproto[compiler]== 2.0.0b6",
38+
"pdoc>=15.0.0,<16",
39+
"mkdocs>=1.5.3,<2",
40+
"mike>=2.0.0,<3",
41+
"openapi-python-client>=0.16.0,<0.17",
42+
"ruff>=0.1.7,<0.2",
43+
"flask>=3.0.3,<4",
44+
"pyright>=1.1.383,<2",
45+
]
46+
test = [
47+
"pytest>=7.4.2,<8",
48+
"pytest-asyncio>=0.21.1,<0.22",
49+
"requests>=2.31.0,<3",
50+
"flask>=3.0.3,<4",
51+
]
3852

39-
[build-system]
40-
requires = ["poetry-core>=1.6.0"]
41-
build-backend = "poetry.core.masonry.api"
53+
[tool.uv]
54+
default-groups = ["dev", "test"]
55+
56+
[tool.hatch.build.targets.sdist]
57+
include = ["fishjam"]
4258

43-
[tool.poetry.scripts]
44-
ci_test = "poetry_scripts:run_tests"
45-
local_test = "poetry_scripts:run_local_test"
46-
format = "poetry_scripts:run_formatter"
47-
format_check = "poetry_scripts:run_format_check"
48-
lint = "poetry_scripts:run_linter"
49-
fix_lint = "poetry_scripts:run_linter_fix"
50-
generate_docs = "poetry_scripts:generate_docs"
51-
update_client = "poetry_scripts:update_client"
52-
room_manager = "poetry_scripts:start_room_manager"
59+
[tool.hatch.build.targets.wheel]
60+
include = ["fishjam"]
61+
62+
[build-system]
63+
requires = ["hatchling"]
64+
build-backend = "hatchling.build"
5365

5466
[tool.ruff]
5567
select = ["F", "I"]
@@ -63,18 +75,18 @@ ignore = []
6375

6476
[tool.pytest.ini_options]
6577
markers = [
66-
"file_component_sources: Tests requiring files uploaded for File Component",
78+
"file_component_sources: Tests requiring files uploaded for File Component",
6779
]
6880

6981
[tool.pyright]
7082
exclude = [
71-
"**/.venv",
72-
"**/__pycache__",
73-
".pytest_cache",
74-
".ruff_cache",
75-
"lib",
76-
"fishjam/_openapi_client",
77-
"tests",
83+
"**/.venv",
84+
"**/__pycache__",
85+
".pytest_cache",
86+
".ruff_cache",
87+
"lib",
88+
"fishjam/_openapi_client",
89+
"tests",
7890
]
7991
typeCheckingMode = "basic"
8092
venv = ".venv"

poetry_scripts.py renamed to scripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run_tests():
3535

3636

3737
def run_local_test():
38-
check_exit_code('poetry run pytest -m "not file_component_sources" -vv')
38+
check_exit_code('uv run pytest -m "not file_component_sources" -vv')
3939

4040

4141
def run_formatter():

tests/Dockerfile

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
ARG UV_VERSION=0.8
12
ARG PYTHON_VERSION=3.10
3+
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv-image
24

3-
FROM python:$PYTHON_VERSION-slim as builder
5+
ARG PYTHON_VERSION
6+
FROM python:$PYTHON_VERSION-slim AS builder
47

5-
ARG POETRY_VERSION=2.1
6-
7-
ENV POETRY_HOME=/opt/poetry
8-
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
9-
ENV POETRY_VIRTUALENVS_CREATE=1
10-
ENV PYTHONDONTWRITEBYTECODE=1
11-
ENV PYTHONUNBUFFERED=1
12-
ENV POETRY_CACHE_DIR=/opt/.cache
13-
14-
RUN pip install "poetry==${POETRY_VERSION}"
8+
COPY --from=uv-image /uv /uvx /bin/
159

1610
WORKDIR /app
1711

18-
COPY pyproject.toml poetry.lock /app/
19-
RUN poetry install --with=dev --no-root && rm -rf $POETRY_CACHE_DIR
12+
RUN --mount=type=cache,target=/root/.cache/uv \
13+
--mount=type=bind,source=uv.lock,target=uv.lock \
14+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
15+
uv sync --locked --no-install-project
16+
2017
COPY . /app/
18+
RUN --mount=type=cache,target=/root/.cache/uv \
19+
uv sync --locked

0 commit comments

Comments
 (0)