Skip to content

Commit 1cd4b33

Browse files
authored
feat: add uv (#23)
1 parent 6de5eb6 commit 1cd4b33

7 files changed

Lines changed: 2327 additions & 2675 deletions

File tree

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@ format: prettier black ruff
55
check: mypy pyright checkblack checkruff checkprettier
66

77
prettier:
8-
poetry run ./node_modules/.bin/prettier --write .
8+
uv run ./node_modules/.bin/prettier --write .
99
pyright:
10-
poetry run ./node_modules/.bin/pyright
10+
uv run ./node_modules/.bin/pyright
1111

1212
mypy:
13-
poetry run mypy .
13+
uv run mypy .
1414

1515
black:
16-
poetry run black .
16+
uv run black .
1717

1818
ruff:
19-
poetry run ruff check . --fix
19+
uv run ruff check . --fix
2020

2121
checkruff:
22-
poetry run ruff check .
22+
uv run ruff check .
2323

2424
checkprettier:
25-
poetry run ./node_modules/.bin/prettier --check .
25+
uv run ./node_modules/.bin/prettier --check .
2626

2727
checkblack:
28-
poetry run black --check .
28+
uv run black --check .
2929

3030
checkeditorconfig:
3131
editorconfig-checker
3232

3333
test:
3434
PYTHONUNBUFFERED=1 \
3535
DEBUG=true \
36-
poetry run pytest
36+
uv run pytest
3737
install-pre-commit-hook:
3838
@echo "Installing pre-commit hook to git"
39-
@echo "Uninstall the hook with poetry run pre-commit uninstall"
40-
poetry run pre-commit install
39+
@echo "Uninstall the hook with uv run pre-commit uninstall"
40+
uv run pre-commit install
4141

4242
pre-commit:
43-
poetry run pre-commit run --all-files
43+
uv run pre-commit run --all-files
4444

4545

4646
checkbundle:

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ def copilot_start():
3838
scheduled_tasks.append(task)
3939

4040

41-
__all__ = ["copilot_ext", "copilot_static_files", "copilot_start", "copilot_stop", "db"]
41+
__all__ = ["copilot_ext", "copilot_start", "copilot_static_files", "copilot_stop", "db"]

crud.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List, Optional
2-
31
from lnbits.db import Database
42
from lnbits.helpers import urlsafe_short_hash
53

@@ -20,15 +18,15 @@ async def update_copilot(copilot: Copilot) -> Copilot:
2018
return copilot
2119

2220

23-
async def get_copilot(copilot_id: str) -> Optional[Copilot]:
21+
async def get_copilot(copilot_id: str) -> Copilot | None:
2422
return await db.fetchone(
2523
"SELECT * FROM copilot.newer_copilots WHERE id = :id",
2624
{"id": copilot_id},
2725
Copilot,
2826
)
2927

3028

31-
async def get_copilots(user: str) -> List[Copilot]:
29+
async def get_copilots(user: str) -> list[Copilot]:
3230
return await db.fetchall(
3331
'SELECT * FROM copilot.newer_copilots WHERE "user" = :user',
3432
{"user": user},

models.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Optional
2-
31
from fastapi import Query, Request
42
from lnurl import encode as lnurl_encode
53
from pydantic import BaseModel
@@ -31,27 +29,27 @@ class CreateCopilotData(BaseModel):
3129

3230
class Copilot(BaseModel):
3331
id: str
34-
user: Optional[str]
32+
user: str | None
3533
title: str
3634
lnurl_toggle: int
37-
wallet: Optional[str]
38-
animation1: Optional[str]
39-
animation2: Optional[str]
40-
animation3: Optional[str]
35+
wallet: str | None
36+
animation1: str | None
37+
animation2: str | None
38+
animation3: str | None
4139
animation1threshold: int
4240
animation2threshold: int
4341
animation3threshold: int
44-
animation1webhook: Optional[str]
45-
animation2webhook: Optional[str]
46-
animation3webhook: Optional[str]
47-
lnurl_title: Optional[str]
42+
animation1webhook: str | None
43+
animation2webhook: str | None
44+
animation3webhook: str | None
45+
lnurl_title: str | None
4846
show_message: int
4947
show_ack: int
50-
show_price: Optional[str]
48+
show_price: str | None
5149
amount_made: int
5250
timestamp: int
5351
fullscreen_cam: int
54-
iframe_url: Optional[str]
52+
iframe_url: str | None
5553

5654
def lnurl(self, req: Request) -> str:
5755
url = str(req.url_for("copilot.lnurl_response", cp_id=self.id))

0 commit comments

Comments
 (0)