chore: deprecate poetry for uv; update dependencies

This commit is contained in:
fusion44 2025-11-10 11:51:15 +01:00
parent 6b3acf0239
commit 44385ca40c
No known key found for this signature in database
9 changed files with 1959 additions and 4722 deletions

View file

@ -16,9 +16,9 @@ help:
@echo "To test the project type 'make test'"
@echo "To assess test coverage type 'make coverage'"
@echo "To generate the requirements.txt file for pip type 'make update-requirements-file'"
@echo "To sync current changes to a blitz for testing, type 'make sync-to-blitz'.\n Adjust connection values in scripts/push_to_blitz.sh"
@echo "To sync current changes to a blitz for testing, type 'make sync-to-blitz'.\n     Adjust connection values in scripts/push_to_blitz.sh"
@echo "To generate the client libraries type 'make generate-client-libs'"
@echo "To build the Docker regtest image type 'make docker-regtest-image'.\n The image will be available to docker as 'blitz_api'"
@echo "To build the Docker regtest image type 'make docker-regtest-image'.\n     The image will be available to docker as 'blitz_api'"
@echo "To list all celery tasks type 'make celery-list-tasks'"
@echo "To manually trigger a celery task type 'make celery-run-task [TASK_NAME TASK_ARGS TASK_KWARGS]'"
@echo "------------------------------------"
@ -26,32 +26,33 @@ help:
clean:
echo "Removing htmlcov folder and .coverage file"
rm -rf htmlcov .coverage
poetry run python -m pyclean .
uv run python -m pyclean .
install:
poetry run python -m pip install -r requirements.txt
uv pip install -r requirements.txt
install-dev:
poetry install
# This command reads pyproject.toml and installs all dependencies (main + dev)
uv sync
run:
poetry run python -m uvicorn app.main:app --reload
uv run python -m uvicorn app.main:app --reload
test:
poetry run python -m pytest
uv run python -m pytest
coverage:
poetry run python -m coverage run --source=. -m pytest
poetry run python -m coverage html
uv run python -m coverage run --source=. -m pytest
uv run python -m coverage html
update-requirements-file:
poetry update && poetry export --without dev --output requirements.txt
uv pip compile --all-extras --output-file requirements.txt pyproject.toml
sync-to-blitz:
bash scripts/sync_to_blitz.sh
generate-client-libs:
poetry run python gen_client_libs.py
uv run python gen_client_libs.py
docker-regtest-image:
docker build -f Dockerfile.regtest -t blitz_api .
@ -67,10 +68,10 @@ disable-remote-debugging:
celery-list-tasks:
@echo "Listing registered Celery tasks..."
@poetry run celery -A $(CELERY_APP) inspect registered
@uv run celery -A $(CELERY_APP) inspect registered
celery-run-task:
@echo "Manually triggering Celery task: $(TASK_NAME)"
@echo " Args: $(TASK_ARGS)"
@echo " Kwargs: $(TASK_KWARGS)"
@poetry run celery -A $(CELERY_APP) call $(TASK_NAME) --args=$(TASK_ARGS) --kwargs=$(TASK_KWARGS)
@uv run celery -A $(CELERY_APP) call $(TASK_NAME) --args=$(TASK_ARGS) --kwargs=$(TASK_KWARGS)

View file

@ -3,10 +3,10 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1746707904,
"lastModified": 1762706931,
"owner": "cachix",
"repo": "devenv",
"rev": "fada79d97f2066c444766d039b0a62affd3e3cab",
"rev": "9a8147b9345ecbb1321890ce7603df1507b1125d",
"type": "github"
},
"original": {
@ -19,10 +19,10 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"lastModified": 1761588595,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
"type": "github"
},
"original": {
@ -40,10 +40,10 @@
]
},
"locked": {
"lastModified": 1746537231,
"lastModified": 1762441963,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "fa466640195d38ec97cf0493d6d6882bc4d14969",
"rev": "8e7576e79b88c16d7ee3bbd112c8d90070832885",
"type": "github"
},
"original": {
@ -74,10 +74,10 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1745934659,
"lastModified": 1761313199,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "fbc071e5c11e23fba50037de37268e3d8a1858eb",
"rev": "d1c30452ebecfc55185ae6d1c983c09da0c274ff",
"type": "github"
},
"original": {
@ -89,10 +89,10 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1746576598,
"lastModified": 1762482733,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55",
"rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc",
"type": "github"
},
"original": {

View file

@ -57,18 +57,16 @@
lndDataDir = "${dataDir}/lnd";
clnDataDir = "${dataDir}/cln";
pkgs-unstable = import inputs.nixpkgs-unstable {system = pkgs.stdenv.system;};
pkgs-unstable = import inputs.nixpkgs-unstable {inherit (pkgs.stdenv) system;};
in {
# https://devenv.sh/basics/
env.GREET = "devenv";
languages = {
python = {
enable = true;
poetry = {
# 3.11 is default on RaspiBlitz 1.12
package = pkgs-unstable.python311;
uv = {
enable = true;
activate.enable = true;
package = pkgs-unstable.poetry;
package = pkgs-unstable.uv;
};
};
};
@ -123,44 +121,21 @@ in {
nu ./scripts/fake_blitz_scripts/update_redis_values.nu
'';
celery_worker.exec = ''
poetry run celery -A app.celery_app worker --loglevel=info
uv run celery -A app.celery_app worker --loglevel=info
'';
celery_beat.exec = ''
poetry run celery -A app.celery_app beat --loglevel=info
uv run celery -A app.celery_app beat --loglevel=info
'';
};
# https://devenv.sh/services/
services = {
redis.enable = true;
};
# https://devenv.sh/tasks/
# tasks = {
# "myproj:setup".exec = "mytool build";
# "devenv:enterShell".after = [ "myproj:setup" ];
# };
enterShell = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
with pkgs-unstable;
lib.makeLibraryPath [stdenv.cc.cc.lib]
}"
'';
# https://devenv.sh/tests/
# disable tests for now. They don't work well, yet
# enterTest = ''
# echo "Running tests"
# wait_for_port 18443
# bitcoin-cli -regtest --datadir=${bitcoinDataDir} createwallet testwallet
# bitcoin-cli -regtest --datadir=${bitcoinDataDir} -generate 160
#
# lncli --chain=bitcoin --network=regtest --lnddir=${lndDataDir} getinfo
# '';
# https://devenv.sh/pre-commit-hooks/
# pre-commit.hooks.shellcheck.enable = true;
# See full reference at https://devenv.sh/reference/options/
}

View file

@ -4,10 +4,6 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix = {
url = "github:fusion44/poetry2nix/nb";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
@ -63,6 +59,7 @@
ruff-lsp
redis
pueue
sshpass
bitcoind
lnd

2994
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,52 +1,59 @@
[tool.poetry]
[project]
name = "blitz_api"
version = "0.5.1"
description = "A backend for the Raspiblitz project"
authors = ["fusion44 <some.fusion@gmail.com>"]
authors = [{ name = "fusion44", email = "some.fusion@gmail.com" }]
requires-python = ">=3.11,<3.13"
license = "MIT"
packages = [
{ include = "app" },
dependencies = [
"fastapi[standard-no-fastapi-cloud-cli]==0.120.4",
"fastapi-plugins[redis]==0.14.0",
"starlette==0.49.1",
"anyio==4.9.0",
"uvicorn[standard]==0.34.2",
"pydantic==2.10.6",
"pydantic-core==2.27.2",
"typing-extensions==4.12.2",
"pyjwt==2.10.1",
"python-decouple==3.8",
"psutil==7.0.0",
"requests==2.32.4",
"pyzmq==26.4.0",
"aiohttp==3.12.14",
"grpcio==1.71.0",
"grpcio-tools==1.71.0",
"protobuf==5.29.5",
"deepdiff==8.6.1",
"loguru==0.7.3",
"celery[redis]==5.5.2",
# Required for the fastapi-plugins[redis]
# Maybe remove and use redis-py directly instead as this is deprecated
"async_timeout==5.0.1",
]
[tool.poetry.dependencies]
python = "^3.12 | ^3.11"
fastapi = {extras = ["standard"], version = "0.115.12"}
fastapi-plugins = "0.13.2"
starlette = "0.45.3"
anyio = "4.9.0"
uvicorn = {extras = ["standard"], version = "0.34.2"}
pydantic = "2.10.6"
pydantic-core = "2.27.2"
typing-extensions = "4.12.2"
pyjwt = "2.10.1"
python-decouple = "3.8"
psutil = "7.0.0"
requests = "2.32.3"
pyzmq = "26.4.0"
aiohttp = "3.11.18"
grpcio = "1.71.0"
grpcio-tools = "1.71.0"
protobuf = "5.29.3"
deepdiff = "8.4.2"
loguru = "0.7.3"
celery = {extras = ["redis"], version = "5.5.2"}
[project.scripts]
api = "app.server:main"
[dependency-groups]
dev = [
"pytest==8.3.5",
"pytest-asyncio==0.25.3",
"coverage==7.8.0",
"ruff==0.9.6",
"debugpy==1.8.14",
"click==8.1.8",
"watchfiles==0.24.0",
]
[tool.poetry.group.dev.dependencies]
pytest = "8.3.5"
pytest-asyncio = "0.25.3"
coverage = "7.8.0"
ruff = "0.9.6"
debugpy = "1.8.14"
click = "8.1.8"
watchfiles = "0.24.0"
[tool.hatch.build.targets.sdist]
include = ["app"]
[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"
[tool.hatch.build.targets.wheel]
include = ["app"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.isort]
profile = "black"
@ -97,6 +104,3 @@ target-version = "py311"
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.poetry.scripts]
api = "app.server:main"

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@ fi
# Needs sshpass installed
echo "# syncing local code to: ${remote}"
sshpass -p "$passwordA" rsync -rvz --exclude .venv/ --exclude .env --exclude test_env_data/ --exclude .git/ -e "ssh -p ${sshPort}" $local $remote
sshpass -p "$passwordA" rsync -rvz --exclude .devenv/ --exclude .venv/ --exclude .env --exclude test_env_data/ --exclude .git/ -e "ssh -p ${sshPort}" $local $remote
result=$?
echo "result(${result})"
if [ "$result" != "0" ]; then

1657
uv.lock generated Normal file

File diff suppressed because it is too large Load diff