lnbits/pyproject.toml

264 lines
6.1 KiB
TOML
Raw Permalink Normal View History

[project]
2022-07-08 09:22:35 +01:00
name = "lnbits"
2026-08-05 12:25:12 +02:00
version = "1.6.0-rc2"
requires-python = ">=3.10,<3.13"
2023-01-10 12:25:11 +01:00
description = "LNbits, free and open-source Lightning wallet and accounts system."
authors = [{ name = "Alan Bits", email = "alan@lnbits.com" }]
urls = { Homepage = "https://lnbits.com", Repository = "https://github.com/lnbits/lnbits" }
readme = "README.md"
dependencies = [
"bech32~=1.2.0",
"click~=8.3.1",
"fastapi~=0.116.1",
2026-07-27 21:00:08 +03:00
"starlette~=0.48.0",
"httpx~=0.27.2",
"jinja2~=3.1.6",
"lnurl~=0.10.0",
"pydantic~=1.10.26",
"pyqrcode~=1.2.1",
"shortuuid~=1.0.13",
"sse-starlette~=2.3.6",
"typing-extensions~=4.15.0",
"uvicorn~=0.40.0",
"sqlalchemy~=1.4.54",
"aiosqlite~=0.22.1",
"asyncpg~=0.31.0",
"uvloop~=0.22.1",
"websockets~=15.0.1",
"loguru~=0.7.3",
"grpcio~=1.76.0",
"protobuf~=6.33.5",
"pyln-client~=25.12.0",
"pywebpush~=2.2.0",
"slowapi~=0.1.9",
"websocket-client~=1.9.0",
"pycryptodomex~=3.23.0",
"packaging~=25.0.0",
"bolt11~=2.1.1",
"pyjwt~=2.12.0",
"itsdangerous~=2.2.0",
"fastapi-sso~=0.19.0",
# needed for boltz, lnurldevice, watchonly extensions
"embit~=0.8.0",
# needed for scheduler extension
"python-crontab~=3.3.0",
"pynostr~=0.7.0",
"python-multipart~=0.0.22",
"filetype~=1.2.0",
"nostr-sdk~=0.44.0",
"bcrypt~=5.0.0",
"jsonpath-ng~=1.7.0",
2026-07-27 19:37:30 +03:00
"pillow~=12.3.0",
"python-dotenv~=1.2.1",
"greenlet~=3.3.0",
2026-05-19 10:58:14 +02:00
"urllib3>=2.7.0",
"pyinstrument>=5.1.2",
"wasmtime>=45.0.0",
"random-username~=1.0.2",
]
2022-07-08 09:22:35 +01:00
[project.scripts]
lnbits = "lnbits.server:main"
lnbits-cli = "lnbits.commands:main"
[project.optional-dependencies]
breez = ["breez-sdk~=0.8.0", "breez-sdk-liquid~=0.11.11"]
2026-06-05 09:38:46 +01:00
liquid = ["wallycore~=1.5.1", "boltz-client==0.4.0"]
migration = ["psycopg2-binary~=2.9.11"]
[dependency-groups]
dev = [
"black~=26.3.1",
"mypy~=1.17.1",
"types-protobuf~=6.32.1.20251210",
"pre-commit~=4.5.1",
"openapi-spec-validator~=0.7.2",
"ruff~=0.14.10",
"types-passlib~=1.7.7.20250602",
"openai~=2.14.0",
"json5~=0.13.0",
"asgi-lifespan~=2.1.0",
"anyio~=4.12.1",
"pytest~=9.0.2",
"pytest-cov~=7.0.0",
2026-07-24 10:56:01 +03:00
"playwright~=1.61.0",
"pytest-md~=0.2.0",
"pytest-httpserver~=1.1.3",
"pytest-mock~=3.15.1",
"types-mock~=5.2.0.20250924",
"mock~=5.2.0",
"grpcio-tools~=1.76.0",
]
2026-05-19 10:58:14 +02:00
[tool.uv]
exclude-newer = "1 week"
[tool.poetry]
packages = [
{include = "lnbits"},
{include = "lnbits/py.typed"},
]
[tool.pyright]
include = [
"lnbits",
"tests",
"tools",
]
exclude = [
"lnbits/wallets/boltz_grpc_files",
"lnbits/wallets/lnd_grpc_files",
"lnbits/extensions",
"lnbits/upgrades",
]
[tool.mypy]
files = [
"lnbits",
"tests",
"tools",
]
exclude = [
"^lnbits/wallets/boltz_grpc_files",
"^lnbits/wallets/lnd_grpc_files",
"^lnbits/extensions",
"^lnbits/upgrades",
]
plugins = "pydantic.mypy"
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[[tool.mypy.overrides]]
module = [
"embit.*",
"secp256k1.*",
"uvicorn.*",
"sqlalchemy.*",
"websocket.*",
"websockets.*",
"pyqrcode.*",
"shortuuid.*",
"grpc.*",
"lnurl.*",
"bolt11.*",
"bitstring.*",
"ecdsa.*",
2023-01-11 12:40:02 +01:00
"pyngrok.*",
"pynostr.*",
"pyln.client.*",
[FEAT] Push notification integration into core (#1393) * push notification integration into core added missing component fixed bell working on all pages - made pubkey global template env var - had to move `get_push_notification_pubkey` to `helpers.py` because of circular reference with `tasks.py` formay trying to fix mypy added py-vapid to requirements Trying to fix stub mypy issue * removed key files * webpush key pair is saved in db `webpush_settings` * removed lnaddress extension changes * support for multi user account subscriptions, subscriptions are stored user based fixed syntax error fixed syntax error removed unused line * fixed subscribed user storage with local storage, no get request required * method is singular now * cleanup unsubscribed or expired push subscriptions fixed flake8 errors fixed poetry errors * updating to latest lnbits formatting, rebase error fix * remove unused? * revert * relock * remove * do not create settings table use adminsettings mypy fix * cleanup old code * catch case when client tries to recreate existing webpush subscription e.g. on cleared local storage * show notification bell on user related pages only * use local storage with one key like array, some refactoring * fixed crud import * fixed too long line * removed unused imports * ruff * make webpush editable * fixed privkey encoding * fix ruff * fix migration --------- Co-authored-by: schneimi <admin@schneimi.de> Co-authored-by: schneimi <dev@schneimi.de> Co-authored-by: dni ⚡ <office@dnilabs.com>
2023-09-11 15:48:49 +02:00
"py_vapid.*",
"pywebpush.*",
[FEAT] Auth, Login, OAuth, create account with username and password #1653 (#2092) no more superuser url! delete cookie on logout add usr login feature fix node management * Cleaned up login form * CreateUser * information leak * cleaner parsing usr from url * rename decorators * login secret * fix: add back `superuser` command * chore: remove `fastapi_login` * fix: extract `token` from cookie * chore: prepare to extract user * feat: check user * chore: code clean-up * feat: happy flow working * fix: usr only login * fix: user already logged in * feat: check user in URL * fix: verify password at DB level * fix: do not show `Login` controls if user already logged in * fix: separate login endpoints * fix: remove `usr` param * chore: update error message * refactor: register method * feat: logout * chore: move comments * fix: remove user auth check from API * fix: user check unnecessary * fix: redirect after logout * chore: remove garbage files * refactor: simplify constructor call * fix: hide user icon if not authorized * refactor: rename auth env vars * chore: code clean-up * fix: add types for `python-jose` * fix: add types for `passlib` * fix: return type * feat: set default value for `auth_secret_key` to hash of super user * fix: default value * feat: rework login page * feat: ui polishing * feat: google auth * feat: add google auth * chore: remove `authlib` dependency * refactor: extract `_handle_sso_login` method * refactor: convert methods to `properties` * refactor: rename: `user_api` to `auth_api` * feat: store user info from SSO * chore: re-arange the buttons * feat: conditional rendering of login options * feat: correctly render buttons * fix: re-add `Claim Bitcoin` from the main page * fix: create wallet must send new user * fix: no `username-password` auth method * refactor: rename auth method * fix: do not force API level UUID4 validation * feat: add validation for username * feat: add account page * feat: update account * feat: add `has_password` for user * fix: email not editable * feat: validate email for existing account * fix: register check * feat: reset password * chore: code clean-up * feat: handle token expired * fix: only redirect if `text/html` * refactor: remove `OAuth2PasswordRequestForm` * chore: remove `python-multipart` dependency * fix: handle no headers for exception * feat: add back button on error screen * feat: show user profile image * fix: check account creation permissions * fix: auth for internal api call * chore: add some docs * chore: code clean-up * fix: rebase stuff * fix: default value types * refactor: customize error messages * fix: move types libs to dev dependencies * doc: specify the `Authorization callback URL` * fix: pass missing superuser id in node ui test * fix: keep usr param on wallet redirect removing usr param causes an issue if the browser doesnt yet have an access token. * fix: do not redirect if `wal` query param not present * fix: add nativeBuildInputs and buildInputs overrides to flake.nix * bump fastapi-sso to 0.9.0 which fixes some security issues * refactor: move the `lnbits_admin_extensions` to decorators * chore: bring package config from `dev` * chore: re-add dependencies * chore: re-add cev dependencies * chore: re-add mypy ignores * feat: i18n * refactor: move admin ext check to decorator (fix after rebase) * fix: label mapping * fix: re-fetch user after first wallet was created * fix: unlikely case that `user` is not found * refactor translations (move '*' to code) * reorganize deps in pyproject.toml, add comment * update flake.lock and simplify flake.nix after upstreaming overrides for fastapi-sso, types-passlib, types-pyasn1, types-python-jose were upstreamed in https://github.com/nix-community/poetry2nix/pull/1463 * fix: more relaxed email verification (by @prusnak) * fix: remove `\b` (boundaries) since we re using `fullmatch` * chore: `make bundle` --------- Co-authored-by: dni ⚡ <office@dnilabs.com> Co-authored-by: Arc <ben@arc.wales> Co-authored-by: jackstar12 <jkranawetter05@gmail.com> Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2023-12-12 12:38:19 +02:00
"fastapi_sso.sso.*",
"json5.*",
"jsonpath_ng.*",
"filetype.*",
"breez_sdk.*",
"breez_sdk_liquid.*",
]
ignore_missing_imports = "True"
[tool.pytest.ini_options]
log_cli = false
addopts = "--durations=1 -s --cov=lnbits --cov-report=xml"
testpaths = [
"tests"
]
[tool.black]
line-length = 88
# use upcoming new features
# preview = true
extend-exclude = """(
lnbits/static
| lnbits/extensions
| lnbits/upgrades
| lnbits/wallets/lnd_grpc_files
| lnbits/wallets/boltz_grpc_files
)"""
[tool.ruff]
# Same as Black. + 10% rule of black
line-length = 88
# Exclude generated files.
extend-exclude = [
"lnbits/wallets/lnd_grpc_files",
"lnbits/wallets/boltz_grpc_files"
]
[tool.ruff.lint]
# Enable:
# F - pyflakes
# E - pycodestyle errors
# W - pycodestyle warnings
# I - isort
# A - flake8-builtins
2024-04-03 17:56:05 +02:00
# C - mccabe
# N - naming
# UP - pyupgrade
# RUF - ruff specific rules
# B - bugbear
2025-07-04 17:29:16 +03:00
# S - bandit
select = ["F", "E", "W", "I", "A", "C", "N", "UP", "RUF", "B", "S"]
# UP007: pyupgrade: use X | Y instead of Optional. (python3.10)
# RUF012: mutable-class-default
# RUF043: pytest-raises-ambiguous-pattern (RUF043)
ignore = ["RUF012", "RUF043"]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# needed for pydantic
[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
"root_validator",
feat: parse nested pydantic models `fetchone` and `fetchall` + add shortcuts for insert_query and update_query into `Database` (#2714) * feat: add shortcuts for insert_query and update_query into `Database` example: await db.insert("table_name", base_model) * remove where from argument * chore: code clean-up * extension manager * lnbits-qrcode components * parse date from dict * refactor: make `settings` a fixture * chore: remove verbose key names * fix: time column * fix: cast balance to `int` * extension toggle vue3 * vue3 @input migration * fix: payment extra and payment hash * fix dynamic fields and ext db migration * remove shadow on cards in dark theme * screwed up and made more css pushes to this branch * attempt to make chip component in settings dynamic fields * dynamic chips * qrscanner * clean init admin settings * make get_user better * add dbversion model * remove update_payment_status/extra/details * traces for value and assertion errors * refactor services * add PaymentFiatAmount * return Payment on api endpoints * rename to get_user_from_account * refactor: just refactor (#2740) * rc5 * Fix db cache (#2741) * [refactor] split services.py (#2742) * refactor: spit `core.py` (#2743) * refactor: make QR more customizable * fix: print.html * fix: qrcode options * fix: white shadow on dark theme * fix: datetime wasnt parsed in dict_to_model * add timezone for conversion * only parse timestamp for sqlite, postgres does it * log internal payment success * fix: export wallet to phone QR * Adding a customisable border theme, like gradient (#2746) * fixed mobile scan btn * fix test websocket * fix get_payments tests * dict_to_model skip none values * preimage none instead of defaulting to 0000... * fixup test real invoice tests * fixed pheonixd for wss * fix nodemanager test settings * fix lnbits funding * only insert extension when they dont exist --------- Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com> Co-authored-by: Tiago Vasconcelos <talvasconcelos@gmail.com> Co-authored-by: Arc <ben@arc.wales> Co-authored-by: Arc <33088785+arcbtc@users.noreply.github.com>
2024-10-29 09:58:22 +01:00
"validator",
]
2025-07-04 17:29:16 +03:00
[tool.ruff.lint.per-file-ignores]
# S101: Use of assert detected. mostly for tests...
# S105: Use of hard-coded password. mostly for tests...
# S106: Possible hardcoded password: 'password'.
# S307 Use of possibly insecure function; consider using `ast.literal_eval
# S602 `subprocess` call with `shell=True` identified, security issue
# S603 `subprocess` call: check for execution of untrusted input
# S607: Starting a process with a partial executable path
# S608: Possible SQL injection vector through string-based query construction
# S324 Probable use of insecure hash functions in `hashlib`: `md5`
2025-07-05 12:12:47 +03:00
# TODO: remove S101 ignore
"lnbits/*" = ["S101"]
2025-07-04 17:29:16 +03:00
"lnbits/core/views/admin_api.py" = ["S602", "S603", "S607"]
2025-09-25 18:33:33 +03:00
"lnbits/core/services/extensions_builder.py" = ["S701"]
2025-07-04 17:29:16 +03:00
"crypto.py" = ["S324"]
"test*.py" = ["S101", "S105", "S106", "S307"]
"tools*.py" = ["S101", "S608"]
"tests/*" = ["S311"]
"tests/regtest/helpers.py" = ["S603"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.flake8-bugbear]
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
extend-immutable-calls = [
"fastapi.Depends",
"fastapi.Query",
"fastapi.Body",
"lnbits.decorators.parse_filters"
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["lnbits"]