Skip to content

Commit ccd5c3c

Browse files
authored
convert to uv (#57)
1 parent 7d4dc44 commit ccd5c3c

8 files changed

Lines changed: 1214 additions & 19 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
python-version: [3.9, 3.11, 3.12]
12+
python-version: [3.9, 3.11, 3.12, 3.13]
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
@@ -18,13 +18,13 @@ jobs:
1818
uses: actions/setup-python@v1
1919
with:
2020
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements.txt
25-
pip install -r requirements_tests.txt
26-
pip install flake8
21+
- name: Install uv
22+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
23+
- name: Add uv to PATH
24+
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
25+
- name: Install all dependencies
26+
run: uv sync --extra dev
2727
- name: Lint with flake8
28-
run: flake8 --show-source --statistics
28+
run: uv run flake8 smarttub tests --show-source --statistics
2929
- name: Test with pytest
30-
run: pytest --cov-fail-under=100 --cov-report=term-missing
30+
run: uv run pytest --cov-fail-under=100 --cov-report=term-missing

.github/workflows/release.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ jobs:
1313
uses: actions/setup-python@v2
1414
with:
1515
python-version: "3.x"
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
16+
- name: Install build backend
17+
run: python -m pip install --upgrade pip build twine
2018
- name: Build and publish
2119
env:
2220
TWINE_USERNAME: __token__
2321
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2422
run: |
25-
python setup.py sdist bdist_wheel
23+
python -m build
2624
twine upload --repository pypi dist/*

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
hooks:
2222
- id: pytest
2323
name: pytest
24-
entry: pytest
24+
entry: "uv run pytest"
2525
language: system
2626
pass_filenames: false
2727
always_run: true

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ python3 -m smarttub -u YOUR_SMARTTUB_EMAIL -p YOUR_SMARTTUB_PASSWORD -vv info -a
4343

4444
## Contributing
4545
```bash
46-
pip install pre-commit && pre-commit install
46+
uv sync --extra dev
47+
uv run pre-commit install
4748
```

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[project]
2+
name = "python-smarttub"
3+
version = "0.0.39"
4+
description = "API to query and control hot tubs using the SmartTub system"
5+
readme = "README.md"
6+
requires-python = ">=3.9"
7+
dependencies = [
8+
"aiohttp~=3.9.1",
9+
"inflection~=0.5.1",
10+
"pyjwt~=2.8.0",
11+
"python-dateutil~=2.8.1"
12+
]
13+
14+
[project.optional-dependencies]
15+
dev = [
16+
"pytest",
17+
"pytest-asyncio",
18+
"pytest-cov",
19+
"aresponses",
20+
"pre-commit",
21+
"black",
22+
"flake8"
23+
]
24+
25+
[build-system]
26+
requires = ["hatchling"]
27+
build-backend = "hatchling.build"
28+
29+
[tool.pytest.ini_options]
30+
testpaths = ["tests"]
31+
python_files = ["test_*.py"]
32+
asyncio_mode = "auto"
33+
34+
[tool.hatch.build.targets.wheel]
35+
packages = ["smarttub"]

smarttub/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ def __init__(self, spa: Spa, state: dict):
374374
SpaPump(spa, **pump_props) for pump_props in self.properties["pumps"]
375375
]
376376
self.sensors = [
377-
SpaSensor(spa, **sensor_props) for sensor_props in self.properties.get("sensors", [])
377+
SpaSensor(spa, **sensor_props)
378+
for sensor_props in self.properties.get("sensors", [])
378379
]
379380

380381

tests/test_reminder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def reminders(mock_spa):
1717
"remainingDuration": 0,
1818
"snoozed": False,
1919
"state": "INACTIVE",
20-
}
20+
},
2121
),
2222
SpaReminder(
2323
mock_spa,
@@ -30,7 +30,7 @@ def reminders(mock_spa):
3030
"remainingDuration": 0,
3131
"snoozed": False,
3232
"state": "INACTIVE",
33-
}
33+
},
3434
),
3535
]
3636
return reminders

uv.lock

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

0 commit comments

Comments
 (0)