Skip to content

Commit df33faf

Browse files
authored
Merge branch 'main' into ruff
2 parents b2cb612 + 13fea69 commit df33faf

17 files changed

Lines changed: 1809 additions & 155 deletions

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[flake8]
2-
ignore = E501,E252
2+
ignore = E501,E252,W503
33
exclude = venv,.tox

.github/workflows/ci.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
python-version: [3.9, 3.11, 3.12]
12+
python-version: [3.13, 3.14]
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v5
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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Set up Python
13-
uses: actions/setup-python@v2
11+
- uses: actions/checkout@v4
1412
with:
15-
python-version: "3.x"
13+
fetch-depth: 0 # Need full history for version from git tags
14+
- name: Install uv
15+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
16+
- name: Add uv to PATH
17+
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
1618
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
19+
run: uv sync --extra dev
2020
- name: Build and publish
2121
env:
2222
TWINE_USERNAME: __token__
2323
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2424
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload --repository pypi dist/*
25+
uv build
26+
uv run twine upload --repository pypi dist/*

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v5.0.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
@@ -19,7 +19,7 @@ repos:
1919
hooks:
2020
- id: pytest
2121
name: pytest
22-
entry: pytest
22+
entry: "uv run pytest"
2323
language: system
2424
pass_filenames: false
2525
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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[project]
2+
name = "python-smarttub"
3+
dynamic = ["version"]
4+
description = "API to query and control hot tubs using the SmartTub system"
5+
readme = "README.md"
6+
license = {text = "MIT"}
7+
requires-python = ">=3.13"
8+
dependencies = [
9+
"aiohttp>=3.9.1",
10+
"inflection~=0.5.1",
11+
"pyjwt>=2.10.0",
12+
"python-dateutil>=2.8.1"
13+
]
14+
15+
[project.optional-dependencies]
16+
dev = [
17+
"pytest",
18+
"pytest-asyncio",
19+
"pytest-cov",
20+
"aresponses",
21+
"pre-commit",
22+
"black",
23+
"flake8",
24+
"twine"
25+
]
26+
27+
[build-system]
28+
requires = ["hatchling", "hatch-vcs"]
29+
build-backend = "hatchling.build"
30+
31+
[tool.hatch.version]
32+
source = "vcs"
33+
34+
[tool.pytest.ini_options]
35+
testpaths = ["tests"]
36+
python_files = ["test_*.py"]
37+
asyncio_mode = "auto"
38+
39+
[tool.hatch.build.targets.wheel]
40+
packages = ["smarttub"]

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[pytest]
22
asyncio_mode = auto
3+
markers =
4+
integration: mark a test as an integration test.

requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
aiohttp~=3.9.0b0;python_version>='3.12'
2-
aiohttp~=3.8.0;python_version<'3.12'
1+
aiohttp>=3.9.1,<3.14.0
32
inflection~=0.5.1
4-
pyjwt~=2.8.0
3+
pyjwt>=2.8,<2.13
54
python-dateutil~=2.8.1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="python-smarttub",
8-
version="0.0.36",
8+
version="0.0.39",
99
author="Matt Zimmerman",
1010
author_email="mdz@alcor.net",
1111
description="API to query and control hot tubs using the SmartTub system",

smarttub/__main__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async def info_command(spas, args):
1414
for spa in spas:
1515
print(f"= Spa '{spa.name}' =\n")
1616
if args.all or args.status or args.location or args.locks:
17-
status = await spa.get_status()
17+
status = await spa.get_status_full()
1818

1919
if args.all or args.status:
2020
print("== Status ==")
@@ -32,13 +32,13 @@ async def info_command(spas, args):
3232

3333
if args.all or args.pumps:
3434
print("== Pumps ==")
35-
for pump in await spa.get_pumps():
35+
for pump in status.pumps:
3636
print(pump)
3737
print()
3838

3939
if args.all or args.lights:
4040
print("== Lights ==")
41-
for light in await spa.get_lights():
41+
for light in status.lights:
4242
print(light)
4343
print()
4444

@@ -70,6 +70,12 @@ async def info_command(spas, args):
7070
pprint(await energy_usage_day)
7171
print()
7272

73+
if args.all or args.sensors:
74+
print("== Sensors ==")
75+
for sensor in status.sensors:
76+
print(sensor)
77+
print()
78+
7379
if args.all or args.debug:
7480
debug_status = await spa.get_debug_status()
7581
print("== Debug status ==")
@@ -152,6 +158,7 @@ async def main(argv):
152158
info_parser.add_argument("--reminders", action="store_true")
153159
info_parser.add_argument("--locks", action="store_true")
154160
info_parser.add_argument("--debug", action="store_true")
161+
info_parser.add_argument("--sensors", action="store_true")
155162
info_parser.add_argument("--energy", action="store_true")
156163

157164
set_parser = subparsers.add_parser("set", help="Change settings on the spa")

0 commit comments

Comments
 (0)