feat: use uv instead of poetry for CI, docker and development (#3325)

Co-authored-by: arcbtc <ben@arc.wales>
This commit is contained in:
dni ⚡
2025-08-21 16:17:19 +02:00
committed by GitHub
co-authored by arcbtc
parent 15984fa49b
commit 5ba06d42d0
88 changed files with 4265 additions and 1303 deletions
+3 -4
View File
@@ -2,7 +2,6 @@ import asyncio
import hashlib
import json
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -71,9 +70,9 @@ class AlbyWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
# https://api.getalby.com/invoices
+3 -4
View File
@@ -2,7 +2,6 @@ import asyncio
import hashlib
import json
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -102,9 +101,9 @@ class BlinkWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
# https://dev.blink.sv/api/btc-ln-receive
+4 -5
View File
@@ -1,6 +1,5 @@
import asyncio
from collections.abc import AsyncGenerator
from typing import Optional
from bolt11.decode import decode
from grpc.aio import AioRpcError
@@ -107,9 +106,9 @@ class BoltzWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
pair = boltzrpc_pb2.Pair(to=boltzrpc_pb2.LBTC)
@@ -254,7 +253,7 @@ class BoltzWallet(Wallet):
)
await asyncio.sleep(5)
async def _fetch_wallet(self, wallet_name: str) -> Optional[str]:
async def _fetch_wallet(self, wallet_name: str) -> str | None:
try:
request = boltzrpc_pb2.GetWalletRequest(name=wallet_name)
response = await self.rpc.GetWallet(request, metadata=self.metadata)
+1 -2
View File
@@ -1,3 +1,2 @@
wget https://raw.githubusercontent.com/BoltzExchange/boltz-client/refs/heads/master/pkg/boltzrpc/boltzrpc.proto -O boltz_grpc_files/boltzrpc.proto
poetry run python -m grpc_tools.protoc -I . --python_out=. --grpc_python_out=. --pyi_out=. boltz_grpc_files/boltzrpc.proto
uv run python -m grpc_tools.protoc -I . --python_out=. --grpc_python_out=. --pyi_out=. boltz_grpc_files/boltzrpc.proto
+6 -7
View File
@@ -9,14 +9,13 @@ if not find_spec("breez_sdk"):
def __init__(self):
raise RuntimeError(
"Breez SDK is not installed. "
"Ask admin to run `poetry install -E breez` to install it."
"Ask admin to run `uv sync --extra breez` to install it."
)
else:
import asyncio
from collections.abc import AsyncGenerator
from pathlib import Path
from typing import Optional
from bolt11 import Bolt11Exception
from bolt11 import decode as bolt11_decode
@@ -66,7 +65,7 @@ else:
):
breez_incoming_queue.put_nowait(e.details)
def load_bytes(source: str, extension: str) -> Optional[bytes]:
def load_bytes(source: str, extension: str) -> bytes | None:
# first check if it can be read from a file
if source.split(".")[-1] == extension:
with open(source, "rb") as f:
@@ -85,7 +84,7 @@ else:
logger.debug(exc)
return None
def load_greenlight_credentials() -> Optional[GreenlightCredentials]:
def load_greenlight_credentials() -> GreenlightCredentials | None:
if (
settings.breez_greenlight_device_key
and settings.breez_greenlight_device_cert
@@ -168,9 +167,9 @@ else:
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
# if description_hash or unhashed_description:
+4 -5
View File
@@ -8,7 +8,7 @@ if not find_spec("breez_sdk_liquid"):
def __init__(self):
raise RuntimeError(
"Breez Liquid SDK is not installed. "
"Ask admin to run `poetry add -E breez` to install it."
"Ask admin to run `uv sync --extra breez` to install it."
)
else:
@@ -16,7 +16,6 @@ else:
from asyncio import Queue
from collections.abc import AsyncGenerator
from pathlib import Path
from typing import Optional
from bolt11 import decode as bolt11_decode
from breez_sdk_liquid import (
@@ -128,9 +127,9 @@ else:
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
try:
+3 -4
View File
@@ -2,7 +2,6 @@ import asyncio
import hashlib
import json
from collections.abc import AsyncGenerator
from typing import Optional
from loguru import logger
from websocket import create_connection
@@ -53,9 +52,9 @@ class ClicheWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
if unhashed_description or description_hash:
+3 -4
View File
@@ -5,7 +5,6 @@ import os
import ssl
import uuid
from collections.abc import AsyncGenerator
from typing import Optional
from urllib.parse import urlparse
import httpx
@@ -174,9 +173,9 @@ class CLNRestWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
+4 -4
View File
@@ -1,7 +1,7 @@
import asyncio
from collections.abc import AsyncGenerator
from secrets import token_urlsafe
from typing import Any, Optional
from typing import Any
from bolt11.decode import decode as bolt11_decode
from bolt11.exceptions import Bolt11Exception
@@ -92,9 +92,9 @@ class CoreLightningWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
label = kwargs.get("label", f"lbl{token_urlsafe(16)}")
+3 -4
View File
@@ -2,7 +2,6 @@ import asyncio
import json
from collections.abc import AsyncGenerator
from secrets import token_urlsafe
from typing import Optional
import httpx
from bolt11 import Bolt11Exception
@@ -106,9 +105,9 @@ class CoreLightningRestWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
label = kwargs.get("label", f"lbl{token_urlsafe(16)}")
+4 -4
View File
@@ -5,7 +5,7 @@ import json
import urllib.parse
from collections.abc import AsyncGenerator
from decimal import Decimal
from typing import Any, Optional
from typing import Any
import httpx
from loguru import logger
@@ -84,9 +84,9 @@ class EclairWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
data: dict[str, Any] = {
+5 -6
View File
@@ -3,7 +3,6 @@ from collections.abc import AsyncGenerator
from datetime import datetime
from hashlib import sha256
from os import urandom
from typing import Optional
from bolt11 import (
Bolt11,
@@ -53,11 +52,11 @@ class FakeWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
expiry: Optional[int] = None,
payment_secret: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
expiry: int | None = None,
payment_secret: bytes | None = None,
**_,
) -> InvoiceResponse:
tags = Tags()
+3 -4
View File
@@ -1,7 +1,6 @@
import asyncio
import json
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -71,9 +70,9 @@ class LNbitsWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
data: dict = {"out": False, "amount": amount, "memo": memo or ""}
+6 -7
View File
@@ -3,7 +3,6 @@ import base64
from collections.abc import AsyncGenerator
from hashlib import sha256
from os import environ
from typing import Optional
import grpc
from loguru import logger
@@ -123,9 +122,9 @@ class LndWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
data: dict = {
@@ -312,9 +311,9 @@ class LndWallet(Wallet):
self,
amount: int,
payment_hash: str,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
data: dict = {
+7 -7
View File
@@ -3,7 +3,7 @@ import base64
import hashlib
import json
from collections.abc import AsyncGenerator
from typing import Any, Optional
from typing import Any
import httpx
from loguru import logger
@@ -103,9 +103,9 @@ class LndRestWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
_data: dict = {
@@ -327,9 +327,9 @@ class LndRestWallet(Wallet):
self,
amount: int,
payment_hash: str,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
data: dict = {
+3 -4
View File
@@ -1,7 +1,6 @@
import asyncio
import hashlib
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -75,9 +74,9 @@ class LNPayWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
data: dict = {"num_satoshis": f"{amount}"}
+3 -4
View File
@@ -3,7 +3,6 @@ import hashlib
import json
import time
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -69,9 +68,9 @@ class LnTipsWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
data: dict = {"amount": amount, "description_hash": "", "memo": memo or ""}
+2 -3
View File
@@ -1,6 +1,5 @@
import base64
from getpass import getpass
from typing import Optional
from loguru import logger
@@ -8,8 +7,8 @@ from lnbits.utils.crypto import AESCipher
def load_macaroon(
macaroon: Optional[str] = None,
encrypted_macaroon: Optional[str] = None,
macaroon: str | None = None,
encrypted_macaroon: str | None = None,
) -> str:
"""Returns hex version of a macaroon encoded in base64 or the file path."""
+8 -8
View File
@@ -4,7 +4,7 @@ import json
import random
import time
from collections.abc import AsyncGenerator
from typing import Optional, Union, cast
from typing import cast
from urllib.parse import parse_qs, unquote, urlparse
import secp256k1
@@ -130,9 +130,9 @@ class NWCWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
desc = ""
@@ -360,7 +360,7 @@ class NWCConnection:
"""
return self.shutdown or not settings.lnbits_running
async def _send(self, data: list[Union[str, dict]]):
async def _send(self, data: list[str | dict]):
"""
Sends data to the NWC relay.
@@ -396,7 +396,7 @@ class NWCConnection:
async def _close_subscription_by_subid(
self, sub_id: str, send_event: bool = True
) -> Optional[dict]:
) -> dict | None:
"""
Closes a subscription by its sub_id.
@@ -427,7 +427,7 @@ class NWCConnection:
async def _close_subscription_by_eventid(
self, event_id, send_event=True
) -> Optional[dict]:
) -> dict | None:
"""
Closes a subscription associated to an event_id.
@@ -514,7 +514,7 @@ class NWCConnection:
if subscription: # Check if the subscription exists first
subscription["future"].set_exception(Exception(info))
async def _on_event_message(self, msg: list[Union[str, dict]]): # noqa: C901
async def _on_event_message(self, msg: list[str | dict]): # noqa: C901
"""
Handles EVENT messages from the relay.
"""
+3 -4
View File
@@ -1,6 +1,5 @@
import asyncio
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from loguru import logger
@@ -71,9 +70,9 @@ class OpenNodeWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
if description_hash or unhashed_description:
+4 -4
View File
@@ -4,7 +4,7 @@ import hashlib
import json
import urllib.parse
from collections.abc import AsyncGenerator
from typing import Any, Optional
from typing import Any
import httpx
from httpx import RequestError, TimeoutException
@@ -96,9 +96,9 @@ class PhoenixdWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
+3 -4
View File
@@ -3,7 +3,6 @@ import hashlib
import json
from collections.abc import AsyncGenerator
from secrets import token_urlsafe
from typing import Optional
import httpx
from loguru import logger
@@ -111,9 +110,9 @@ class SparkWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**kwargs,
) -> InvoiceResponse:
label = f"lbs{token_urlsafe(16)}"
+9 -9
View File
@@ -2,7 +2,7 @@ import asyncio
import time
from collections.abc import AsyncGenerator
from decimal import Decimal
from typing import Any, Optional
from typing import Any
import httpx
from loguru import logger
@@ -116,7 +116,7 @@ class StrikeWallet(Wallet):
self.failed_payments: dict[str, str] = {}
# balance cache
self._cached_balance: Optional[int] = None
self._cached_balance: int | None = None
self._cached_balance_ts: float = 0.0
self._cache_ttl = 30 # seconds
@@ -199,8 +199,8 @@ class StrikeWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None, # Add this parameter
**kwargs,
) -> InvoiceResponse:
@@ -424,10 +424,10 @@ class StrikeWallet(Wallet):
async def get_invoices(
self,
filters: Optional[str] = None,
orderby: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
filters: str | None = None,
orderby: str | None = None,
skip: int | None = None,
top: int | None = None,
) -> dict[str, Any]:
try:
params: dict[str, Any] = {}
@@ -450,7 +450,7 @@ class StrikeWallet(Wallet):
async def _get_payment_status_by_quote_id(
self, checking_id: str, quote_id: str
) -> Optional[PaymentStatus]:
) -> PaymentStatus | None:
resp = await self._get(f"/payment-quotes/{quote_id}")
resp.raise_for_status()
+3 -4
View File
@@ -1,7 +1,6 @@
import asyncio
import hashlib
from collections.abc import AsyncGenerator
from typing import Optional
import httpx
from bolt11 import decode as bolt11_decode
@@ -60,9 +59,9 @@ class ZBDWallet(Wallet):
async def create_invoice(
self,
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
memo: str | None = None,
description_hash: bytes | None = None,
unhashed_description: bytes | None = None,
**_,
) -> InvoiceResponse:
# https://api.zebedee.io/v0/charges