Skip to content

Commit eff2e80

Browse files
Switch Poetry to uv (#101)
* chore: Switch to uv * fix: Correctly call from uv scripts * fix: Removed unused docs workflow, update test.yaml to uv
1 parent f57afe7 commit eff2e80

8 files changed

Lines changed: 1298 additions & 1682 deletions

File tree

.github/workflows/docs.yaml

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

.github/workflows/test.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Install poetry
15-
run: pipx install poetry
14+
- name: Install uv
15+
run: pipx install uv
1616
- uses: actions/setup-python@v5
1717
with:
1818
python-version-file: pyproject.toml
19-
cache: poetry
19+
cache: pip
2020
- name: Install dependencies
2121
run: |
22-
poetry install
22+
uv sync
2323
- name: Run tests
2424
id: run-tests
2525
run: >
26-
poetry run pytest \
26+
uv run pytest \
2727
--junitxml=pytest.xml \
2828
--cov-report=term-missing:skip-covered \
2929
--cov-report=xml:coverage.xml \
@@ -46,6 +46,6 @@ jobs:
4646
with:
4747
python-version: "3.11"
4848
- run: |
49-
pip install poetry
50-
poetry install
51-
poetry run mypy .
49+
pip install uv
50+
uv sync
51+
uv run mypy .

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM python:3.11-buster
1+
FROM ghcr.io/astral-sh/uv:python3.11-bookworm
22

33
EXPOSE 8051
44

55
WORKDIR /app
66

77
COPY . .
88

9-
RUN pip install poetry && \
10-
poetry config virtualenvs.create false && \
11-
poetry install --only main
9+
RUN uv sync --no-dev
1210

13-
CMD ["poetry", "run", "actigraphy", "/data"]
11+
CMD ["uv", "run", "--no-dev", "actigraphy", "/data"]

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,21 @@ The Actigraphy app is developed to annotate sleep data, and for this project, we
107107

108108
That being said, the callback architecture has grown complex, especially in the graph component where chains of callbacks can cause the app to slow down.
109109

110-
### Running the App through Poetry
110+
### Running the App through uv
111111

112-
1. Ensure you have [Poetry](https://python-poetry.org/docs/) installed.
112+
Installation via `uv` is intended for developers; end-users should use the Docker installation described earlier.
113+
114+
1. Ensure you have [uv](https://docs.astral.sh/uv/getting-started/installation/) installed.
113115
2. Clone the repository:
114116
```bash
115117
git clone https://github.com/childmindresearch/app-actigraphy.git
116118
cd app-actigraphy
117119
```
118120
3. Install dependencies:
119121
```bash
120-
poetry install
122+
uv sync
121123
```
122124
4. Run the app:
123125
```bash
124-
poetry run actigraphy {DATA_DIR}
126+
uv run actigraphy {DATA_DIR}
125127
```

poetry.lock

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

pyproject.toml

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,44 @@
1-
[tool.poetry]
2-
name = "actigraphy"
1+
[project]
2+
name = "actisleep-tracker"
33
version = "0.1.0"
4-
description = "A beautiful description."
5-
authors = ["Reinder Vos de Wael <reinder.vosdewael@childmind.org>"]
6-
license = "LGPL-2.1"
4+
description = "Add your description here"
75
readme = "README.md"
8-
packages = [{include = "actigraphy", from = "src"}]
9-
10-
[tool.poetry.dependencies]
11-
python = "~3.11"
12-
dash-bootstrap-components = "^1.4.2"
13-
dash-daq = "^0.5.0"
14-
numpy = "^1.26.4"
15-
pandas = "^2.2.0"
16-
plotly = "^5.16.1"
17-
rdata = "^0.10"
18-
pydantic = "^2.6.1"
19-
dash = "^2.15.0"
20-
sqlalchemy = "^2.0.26"
21-
pydantic-settings = "^2.1.0"
22-
polars = "^0.20.7"
23-
pyarrow = "^15.0.0"
24-
25-
[tool.poetry.group.dev.dependencies]
26-
pytest = "^8.0.2"
27-
mypy = "^1.8.0"
28-
pre-commit = "^3.6.2"
29-
pytest-cov = "^4.1.0"
30-
ruff = "^0.6"
31-
pytest-mock = "^3.12.0"
32-
vulture = "^2.11"
6+
requires-python = "~=3.11"
7+
dependencies = [
8+
"dash~=2.15",
9+
"dash-bootstrap-components>=1.7.1",
10+
"dash-daq>=0.6.0",
11+
"numpy>=2.3.0",
12+
"pandas>=2.3.0",
13+
"plotly>=6.1.2",
14+
"polars>=1.30.0",
15+
"pyarrow>=20.0.0",
16+
"pydantic>=2.11.5",
17+
"pydantic-settings>=2.9.1",
18+
"rdata>=0.11.2",
19+
"sqlalchemy>=2.0.41",
20+
]
3321

34-
[tool.poetry.group.docs.dependencies]
35-
pdoc = "^14.4.0"
22+
[dependency-groups]
23+
dev = [
24+
"mypy>=1.16.0",
25+
"pre-commit>=4.2.0",
26+
"pytest>=8.4.0",
27+
"pytest-cov>=6.1.1",
28+
"pytest-mock>=3.14.1",
29+
"ruff>=0.11.13",
30+
"vulture>=2.14",
31+
]
3632

37-
[tool.poetry.extras]
38-
docs = ["pdoc"]
33+
[build-system]
34+
requires = ["hatchling"]
35+
build-backend = "hatchling.build"
3936

40-
[tool.poetry.scripts]
41-
actigraphy = "actigraphy.__main__:main_entrypoint"
42-
actigraphy_preprocess = 'actigraphy.__main__:preprocess_entrypoint'
37+
[project.scripts]
38+
actigraphy = "actigraphy.app:run_app"
4339

44-
[build-system]
45-
requires = ["poetry-core>=1.2.0"]
46-
build-backend = "poetry.core.masonry.api"
40+
[tool.hatch.build.targets.wheel]
41+
packages = ["src/actigraphy"]
4742

4843
[tool.pytest.ini_options]
4944
pythonpath = [

src/actigraphy/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def create_app() -> dash.Dash:
5555
return app
5656

5757

58-
if __name__ == "__main__":
58+
def run_app() -> None:
59+
"""Entrypoint for the application."""
5960
app = create_app()
60-
app.run_server(debug=True)
61+
app.run_server(debug=False)

0 commit comments

Comments
 (0)