Skip to content

Commit 5ca933a

Browse files
authored
feat: Update to uv. (#6)
* feat: Update to uv.
1 parent 55c4e84 commit 5ca933a

File tree

24 files changed

+3717
-5671
lines changed

24 files changed

+3717
-5671
lines changed

.devcontainer/devcontainer.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
"ppa": true,
88
"version": "system"
99
},
10+
"ghcr.io/devcontainers-extra/features/pipenv:2": {
11+
"version": "latest"
12+
},
13+
"ghcr.io/va-h/devcontainers-features/uv:1": {
14+
"shellautocompletion": true,
15+
"version": "latest"
16+
},
1017
"ghcr.io/devcontainers/features/nvidia-cuda:1": {
1118
"installCudnn": true,
1219
"installCudnnDev": true,
1320
"installNvtx": true,
1421
"installToolkit": true,
15-
"cudaVersion": "12.2",
16-
"cudnnVersion": "8.9.5.29"
17-
},
18-
"ghcr.io/devcontainers-contrib/features/pipenv:2": {
19-
"version": "latest"
22+
"cudaVersion": "12.5",
23+
"cudnnVersion": "9.3.0.75"
2024
}
2125
},
2226

@@ -36,5 +40,20 @@
3640
"remoteEnv": {
3741
"LD_LIBRARY_PATH": "${containerEnv:LD_LIBRARY_PATH}:/usr/local/cuda/lib64",
3842
"TF_FORCE_GPU_ALLOW_GROWTH": "true"
43+
},
44+
"customizations": {
45+
"vscode": {
46+
"extensions": [
47+
"GitHub.copilot",
48+
"GitHub.copilot-chat",
49+
"ms-toolsai.jupyter",
50+
"ms-toolsai.jupyter-renderers",
51+
"ms-toolsai.tensorboard",
52+
"tamasfe.even-better-toml",
53+
"mechatroner.rainbow-csv",
54+
"ms-python.python",
55+
"charliermarsh.ruff"
56+
]
57+
}
3958
}
4059
}

.devcontainer/install.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,5 @@ sudo apt install -y libopenblas-dev libyaml-dev ffmpeg wget ca-certificates awsc
4747
# sudo rm -rf /var/lib/apt/lists/*
4848
# fi
4949

50-
# Install poetry
51-
pipx install poetry --pip-args '--no-cache-dir --force-reinstall'
52-
5350
# Install project dependencies
54-
poetry install
51+
uv sync

.github/workflows/ci.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,27 @@ name: SleepKit CI
22

33
on: [push]
44

5+
env:
6+
PYTHON_VERSION: '3.11'
7+
58
jobs:
69
build:
710

811
runs-on: ubuntu-latest
912

1013
steps:
11-
- uses: actions/checkout@v4
12-
- name: Install poetry
13-
run: pipx install poetry
14-
- uses: actions/setup-python@v5
14+
- name: Checkout 🛎️
15+
uses: actions/checkout@v4
16+
- name: Setup Python 🐍
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ env.PYTHON_VERSION }}
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
1522
with:
16-
python-version: '3.11'
17-
cache: 'poetry'
18-
- run: poetry install
19-
- run: poetry run task lint
20-
- run: poetry run task test
23+
enable-cache: true
24+
- name: Install dependencies 🔧
25+
run: |
26+
uv sync
27+
uv run ruff check
28+
uv run pytest tests/

.github/workflows/docs.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
push:
5-
branches: [$default-branch]
4+
release:
5+
types:
6+
- created
67
workflow_dispatch:
78

89
permissions:
@@ -30,20 +31,17 @@ jobs:
3031
- name: Setup Pages
3132
id: pages
3233
uses: actions/configure-pages@v4
33-
- name: Install Poetry
34-
run: pipx install poetry
35-
- name: Install Python
36-
uses: actions/setup-python@v5
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v5
3736
with:
38-
python-version: '3.11'
39-
cache: 'poetry'
37+
enable-cache: true
4038
- name: Install and Build 🔧
4139
env:
4240
CI: ""
4341
PUBLIC_URL: "${{ steps.pages.outputs.base_url }}/"
4442
run: |
45-
poetry install --no-root --only docs
46-
poetry run mkdocs build
43+
uv sync --only-group docs
44+
uv run mkdocs build
4745
- name: Upload artifact
4846
uses: actions/upload-pages-artifact@v3
4947
with:

.github/workflows/release.yaml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: Release to PyPi
22

3-
# on:
4-
# release:
5-
# types:
6-
# - created
7-
83
on:
9-
push:
10-
branches: [$default-branch]
4+
release:
5+
types:
6+
- created
117
workflow_dispatch:
128

139
jobs:
@@ -16,16 +12,13 @@ jobs:
1612
steps:
1713
- name: Checkout 🛎️
1814
uses: actions/checkout@v4
19-
- name: Install Poetry
20-
run: pipx install poetry
21-
- name: Install Python
22-
uses: actions/setup-python@v5
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
2317
with:
24-
python-version: '3.11'
25-
cache: 'poetry'
18+
enable-cache: true
2619
- name: Install and Build 🔧
2720
run: |
28-
poetry build
21+
uv build
2922
- name: Store the distribution packages
3023
uses: actions/upload-artifact@v4
3124
with:
@@ -38,8 +31,8 @@ jobs:
3831
- build
3932
environment:
4033
name: pypi
34+
url: https://pypi.org/p/sleepkit
4135
permissions:
42-
contents: write
4336
id-token: write
4437
steps:
4538
- name: Download all the dists

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,3 @@ repos:
2020
args: [ --config=pyproject.toml ]
2121
- id: ruff-format
2222
args: [ --config=pyproject.toml ]
23-
- repo: https://github.com/python-poetry/poetry
24-
rev: 1.8.3
25-
hooks:
26-
- id: poetry-check

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SleepKit is an AI Development Kit (ADK) that enables developers to easily build
2323
## <span class="sk-h2-span">Requirements</span>
2424

2525
* [Python ^3.11](https://www.python.org)
26-
* [Poetry ^1.6.1](https://python-poetry.org/docs/#installation)
26+
* [uv ^1.6.1+](https://docs.astral.sh/uv/getting-started/installation/)
2727

2828
The following are also required to compile/flash the binary for the EVB demo:
2929

@@ -46,7 +46,7 @@ Alternatively, you can install the package from source by cloning the repository
4646
```bash
4747
git clone https://github.com/AmbiqAI/sleepkit.git
4848
cd sleepkit
49-
poetry install
49+
uv sync
5050
```
5151

5252
---

docs/guides/train-detect-model.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@
8787
"from pathlib import Path\n",
8888
"import keras\n",
8989
"import neuralspot_edge as nse\n",
90-
"import sleepkit as sk\n",
91-
"import matplotlib.pyplot as plt\n",
92-
"import plotly.io as pio"
90+
"import sleepkit as sk"
9391
]
9492
},
9593
{

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Please explore the SleepKit Docs, a comprehensive resource designed to help you
2828

2929
## <span class="sk-h2-span">Getting Started</span>
3030

31-
- **Install** `SleepKit` with pip/poetry and getting up and running in minutes. &nbsp; [:material-clock-fast: Install SleepKit](./quickstart.md/#install-sleepkit){ .md-button }
31+
- **Install** `SleepKit` with pip/uv and getting up and running in minutes. &nbsp; [:material-clock-fast: Install SleepKit](./quickstart.md/#install-sleepkit){ .md-button }
3232
- **Train** a model with a custom network &nbsp; [:fontawesome-solid-brain: Train a Model](modes/train.md){ .md-button }
3333
- **Tasks** `SleepKit` provides tasks like staging, and apnea &nbsp; [:material-magnify-expand: Explore Tasks](tasks/index.md){ .md-button }
3434
- **Datasets** Several built-in datasets can be leveraged &nbsp; [:material-database-outline: Explore Datasets](./datasets/index.md){ .md-button }
@@ -59,7 +59,7 @@ To get started, first install the python package `sleepkit` along with its depen
5959
Cloning into 'sleepkit'...
6060
Resolving deltas: 100% (3491/3491), done.
6161
$ cd sleepkit
62-
$ poetry install
62+
$ uv sync
6363

6464
---> 100%
6565
```

docs/quickstart.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## <span class="sk-h2-span">Install SleepKit</span>
44

5-
We provide several installation methods including pip, poetry, and Docker. Install __SleepKit__ via pip/poetry for the latest stable release or by cloning the GitHub repo for the most up-to-date. Additionally, a [VSCode Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) is available and defined in [./.devcontainer](https://github.com/AmbiqAI/sleepkit/tree/main/.devcontainer) to run in an isolated Docker environment.
5+
We provide several installation methods including pip, uv, and Docker. Install __SleepKit__ via pip/uv for the latest stable release or by cloning the GitHub repo for the most up-to-date. Additionally, a [VSCode Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) is available and defined in [./.devcontainer](https://github.com/AmbiqAI/sleepkit/tree/main/.devcontainer) to run in an isolated Docker environment.
66

77
!!! install
88

99
=== "Git clone"
1010

11-
Clone the repository if you are interested in contributing to the development or wish to experiment with the latest source code. After cloning, navigate into the directory and install the package. In this mode, Poetry is recommended.
11+
Clone the repository if you are interested in contributing to the development or wish to experiment with the latest source code. After cloning, navigate into the directory and install the package. In this mode, uv is recommended.
1212

1313
```bash
1414
# Clone the repository
@@ -18,27 +18,27 @@ We provide several installation methods including pip, poetry, and Docker. Insta
1818
cd sleepkit
1919

2020
# Install the package in editable mode for development
21-
poetry install
21+
uv sync
2222
```
2323

24-
When using editable mode via Poetry, be sure to activate the python environment: `poetry shell`. <br>
25-
On Windows using Powershell, use `.venv\Scripts\activate.ps1`.
24+
When using editable mode via uv, be sure to activate the python environment: `source .venv/bin/activate`. <br>
25+
On Windows using Powershell, use `.venv\Scripts\activate`.
2626

2727
=== "PyPI install"
2828

29-
Install the SleepKit package using pip or Poetry.
29+
Install the SleepKit package using pip or uv.
3030
Visit the Python Package Index (PyPI) for more details on the package: [https://pypi.org/project/sleepkit/](https://pypi.org/project/sleepkit/)
3131

3232
```bash
3333
# Install with pip
3434
pip install sleepkit
3535
```
3636

37-
Or, if you prefer to use Poetry, you can install the package with the following command:
37+
Or, if you prefer to use uv, you can install the package with the following command:
3838

3939
```bash
40-
# Install with poetry
41-
poetry add sleepkit
40+
# Install with uv
41+
uv add sleepkit
4242
```
4343

4444
Alternatively, you can install the latest development version directly from the GitHub repository. Make sure to have the Git command-line tool installed on your system. The @main command installs the main branch and may be modified to another branch, i.e. @canary.
@@ -47,16 +47,16 @@ We provide several installation methods including pip, poetry, and Docker. Insta
4747
pip install git+https://github.com/AmbiqAI/sleepkit.git@main
4848
```
4949

50-
Or, using Poetry:
50+
Or, using uv:
5151

5252
```bash
53-
poetry add git+https://github.com/AmbiqAI/sleepkit.git@main
53+
uv add git+https://github.com/AmbiqAI/sleepkit.git@main
5454
```
5555

5656
## <span class="sk-h2-span">Requirements</span>
5757

5858
* [Python ^3.11+](https://www.python.org)
59-
* [Poetry ^1.6.1+](https://python-poetry.org/docs/#installation)
59+
* [uv ^1.6.1+](https://docs.astral.sh/uv/getting-started/installation/)
6060

6161
Check the project's [pyproject.toml](https://github.com/AmbiqAI/sleepkit/blob/main/pyproject.toml) file for a list of up-to-date Python dependencies. Note that the installation methods above install all required dependencies. The following are optional dependencies only needed when running `demo` command using Ambiq's evaluation board (`EVB`) backend:
6262

0 commit comments

Comments
 (0)