good bye venv (#1569)
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
parent
fbe982af36
commit
4dd206da2a
8 changed files with 9 additions and 146 deletions
|
|
@ -3,7 +3,6 @@ data
|
||||||
docker
|
docker
|
||||||
docs
|
docs
|
||||||
tests
|
tests
|
||||||
venv
|
|
||||||
|
|
||||||
lnbits/static/css/*
|
lnbits/static/css/*
|
||||||
lnbits/static/bundle.js
|
lnbits/static/bundle.js
|
||||||
|
|
|
||||||
23
.github/workflows/tests.yml
vendored
23
.github/workflows/tests.yml
vendored
|
|
@ -3,29 +3,6 @@ name: tests
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
venv-sqlite:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.9"]
|
|
||||||
poetry-version: ["1.3.1"]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
|
||||||
VIRTUAL_ENV: ./venv
|
|
||||||
PATH: ${{ env.VIRTUAL_ENV }}/bin:${{ env.PATH }}
|
|
||||||
run: |
|
|
||||||
python -m venv ${{ env.VIRTUAL_ENV }}
|
|
||||||
./venv/bin/python -m pip install --upgrade pip
|
|
||||||
./venv/bin/pip install -r requirements.txt
|
|
||||||
./venv/bin/pip install pytest pytest-asyncio pytest-cov requests mock
|
|
||||||
- name: Run tests
|
|
||||||
run: make test-venv
|
|
||||||
sqlite:
|
sqlite:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -23,8 +23,6 @@ tests/data/*.sqlite3
|
||||||
*.pyc
|
*.pyc
|
||||||
*.env
|
*.env
|
||||||
.env
|
.env
|
||||||
.venv
|
|
||||||
venv
|
|
||||||
|
|
||||||
data
|
data
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
|
|
||||||
8
Makefile
8
Makefile
|
|
@ -50,14 +50,6 @@ test-real-wallet:
|
||||||
DEBUG=true \
|
DEBUG=true \
|
||||||
poetry run pytest
|
poetry run pytest
|
||||||
|
|
||||||
test-venv:
|
|
||||||
LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \
|
|
||||||
FAKE_WALLET_SECRET="ToTheMoon1" \
|
|
||||||
LNBITS_DATA_FOLDER="./tests/data" \
|
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
DEBUG=true \
|
|
||||||
./venv/bin/pytest --durations=1 -s --cov=lnbits --cov-report=xml tests
|
|
||||||
|
|
||||||
test-migration:
|
test-migration:
|
||||||
rm -rf ./migration-data
|
rm -rf ./migration-data
|
||||||
mkdir -p ./migration-data
|
mkdir -p ./migration-data
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,16 @@ Going over the example extension's structure:
|
||||||
Adding new dependencies
|
Adding new dependencies
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are available in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others.
|
DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are availabe in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others.
|
||||||
|
|
||||||
If for some reason your extensions must have a new python package to work, and its needs are not met in `pyproject.toml`, you can add a new package using `venv`, or `poerty`:
|
If for some reason your extensions must have a new python package to work, and its nees are not met in `pyproject.toml`, you can add a new package using `poerty`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ poetry add <package>
|
$ poetry add <package>
|
||||||
# or
|
|
||||||
$ ./venv/bin/pip install <package>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**But we need an extra step to make sure LNbits doesn't break in production.**
|
**But we need an extra step to make sure LNbits doesn't break in production.**
|
||||||
Dependencies need to be added to `pyproject.toml` and `requirements.txt`, then tested by running on `venv` and `poetry` compatibility can be tested with `nix build .#checks.x86_64-linux.vmTest`.
|
Dependencies need to be added to `pyproject.toml`, then tested by running on `poetry` compatability can be tested with `nix build .#checks.x86_64-linux.vmTest`.
|
||||||
|
|
||||||
|
|
||||||
SQLite to PostgreSQL migration
|
SQLite to PostgreSQL migration
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ nav_order: 2
|
||||||
|
|
||||||
# Basic installation
|
# Basic installation
|
||||||
|
|
||||||
You can choose between four package managers, `poetry`, `nix` and `venv`.
|
You can choose between four package managers, `poetry` and `nix`
|
||||||
|
|
||||||
By default, LNbits will use SQLite as its database. You can also use PostgreSQL which is recommended for applications with a high load (see guide below).
|
By default, LNbits will use SQLite as its database. You can also use PostgreSQL which is recommended for applications with a high load (see guide below).
|
||||||
|
|
||||||
|
|
@ -80,30 +80,8 @@ mkdir data
|
||||||
LNBITS_DATA_FOLDER=data LNBITS_BACKEND_WALLET_CLASS=LNbitsWallet LNBITS_ENDPOINT=https://legend.lnbits.com LNBITS_KEY=7b1a78d6c78f48b09a202f2dcb2d22eb ./result/bin/lnbits --port 9000
|
LNBITS_DATA_FOLDER=data LNBITS_BACKEND_WALLET_CLASS=LNbitsWallet LNBITS_ENDPOINT=https://legend.lnbits.com LNBITS_KEY=7b1a78d6c78f48b09a202f2dcb2d22eb ./result/bin/lnbits --port 9000
|
||||||
```
|
```
|
||||||
|
|
||||||
## Option 3: venv
|
|
||||||
|
|
||||||
```sh
|
## Option 3: Docker
|
||||||
git clone https://github.com/lnbits/lnbits.git
|
|
||||||
cd lnbits
|
|
||||||
# ensure you have virtualenv installed, on debian/ubuntu 'apt install python3.9-venv'
|
|
||||||
python3.9 -m venv venv
|
|
||||||
# If you have problems here, try `sudo apt install -y pkg-config libpq-dev`
|
|
||||||
./venv/bin/pip install -r requirements.txt
|
|
||||||
# create the data folder and the .env file
|
|
||||||
mkdir data && cp .env.example .env
|
|
||||||
# build the static files
|
|
||||||
./venv/bin/python tools/build.py
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Running the server
|
|
||||||
|
|
||||||
```sh
|
|
||||||
./venv/bin/uvicorn lnbits.__main__:app --port 5000
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to host LNbits on the internet, run with the option `--host 0.0.0.0`.
|
|
||||||
|
|
||||||
## Option 4: Docker
|
|
||||||
|
|
||||||
use latest version from docker hub
|
use latest version from docker hub
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -122,7 +100,7 @@ mkdir data
|
||||||
docker run --detach --publish 5000:5000 --name lnbits --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbitsdocker/lnbits-legend
|
docker run --detach --publish 5000:5000 --name lnbits --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbitsdocker/lnbits-legend
|
||||||
```
|
```
|
||||||
|
|
||||||
## Option 5: Fly.io
|
## Option 4: Fly.io
|
||||||
|
|
||||||
Fly.io is a docker container hosting platform that has a generous free tier. You can host LNbits for free on Fly.io for personal use.
|
Fly.io is a docker container hosting platform that has a generous free tier. You can host LNbits for free on Fly.io for personal use.
|
||||||
|
|
||||||
|
|
@ -210,9 +188,6 @@ sudo apt install python3.9-dev gcc build-essential
|
||||||
# if the secp256k1 build fails:
|
# if the secp256k1 build fails:
|
||||||
# if you used poetry
|
# if you used poetry
|
||||||
poetry add setuptools wheel
|
poetry add setuptools wheel
|
||||||
|
|
||||||
# if you used venv
|
|
||||||
./venv/bin/pip install setuptools wheel
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Poetry
|
#### Poetry
|
||||||
|
|
@ -433,7 +408,7 @@ mkcert localhost 127.0.0.1 ::1
|
||||||
You can then pass the certificate files to uvicorn when you start LNbits:
|
You can then pass the certificate files to uvicorn when you start LNbits:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./venv/bin/uvicorn lnbits.__main__:app --host 0.0.0.0 --port 5000 --ssl-keyfile ./key.pem --ssl-certfile ./cert.pem
|
poetry run uvicorn lnbits.__main__:app --host 0.0.0.0 --port 5000 --ssl-keyfile ./key.pem --ssl-certfile ./cert.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ You can also use an AES-encrypted macaroon (more info) instead by using
|
||||||
|
|
||||||
- `LND_GRPC_MACAROON_ENCRYPTED`: eNcRyPtEdMaCaRoOn
|
- `LND_GRPC_MACAROON_ENCRYPTED`: eNcRyPtEdMaCaRoOn
|
||||||
|
|
||||||
To encrypt your macaroon, run `./venv/bin/python lnbits/wallets/macaroon/macaroon.py`.
|
To encrypt your macaroon, run `poetry run python lnbits/wallets/macaroon/macaroon.py`.
|
||||||
|
|
||||||
### LNbits
|
### LNbits
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
anyio==3.6.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
asn1crypto==1.5.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
async-timeout==4.0.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
attrs==22.2.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
base58==2.1.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
bech32==1.2.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
bitstring==3.1.9 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
boltz-client==0.1.3 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
cashu==0.9.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
cerberus==1.3.4 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
certifi==2022.12.7 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
cffi==1.15.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
charset-normalizer==2.0.12 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
click==8.0.4 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
coincurve==17.0.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
colorama==0.4.6 ; python_version >= "3.7" and python_version < "4.0" and platform_system == "Windows" or python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32"
|
|
||||||
cryptography==36.0.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
ecdsa==0.18.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
embit==0.4.9 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
enum34==1.1.10 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
environs==9.5.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
exceptiongroup==1.1.0 ; python_version >= "3.7" and python_version < "3.11"
|
|
||||||
fastapi==0.83.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
grpcio==1.51.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
h11==0.12.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
httpcore==0.15.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
httpx==0.23.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
idna==3.4 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
importlib-metadata==5.2.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
iniconfig==2.0.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
jinja2==3.0.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
lnurl==0.3.6 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
loguru==0.6.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
markupsafe==2.1.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
marshmallow==3.19.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
outcome==1.2.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
packaging==23.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pathlib2==2.3.7.post1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pluggy==1.0.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
protobuf==4.21.12 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
psycopg2-binary==2.9.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pycparser==2.21 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pycryptodomex==3.16.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pydantic==1.10.4 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pyln-bolt7==1.0.246 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pyln-client==0.11.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pyln-proto==0.11.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pyqrcode==1.2.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pyscss==1.4.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pysocks==1.7.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pytest-asyncio==0.19.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
pytest==7.2.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
python-bitcoinlib==0.11.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
python-dotenv==0.21.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
represent==1.6.0.post0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
requests==2.27.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
rfc3986[idna2008]==1.5.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
secp256k1==0.14.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
setuptools==65.7.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
shortuuid==1.0.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
six==1.16.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
sniffio==1.3.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
sqlalchemy-aio==0.17.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
sqlalchemy==1.3.24 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
sse-starlette==0.6.2 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
starlette==0.19.1 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
tomli==2.0.1 ; python_version >= "3.7" and python_version < "3.11"
|
|
||||||
typing-extensions==4.4.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
urllib3==1.26.14 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
uvicorn==0.18.3 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
uvloop==0.16.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
websocket-client==1.3.3 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
websockets==10.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
wheel==0.38.4 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
win32-setctime==1.1.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32"
|
|
||||||
zipp==3.11.0 ; python_version >= "3.7" and python_version < "4.0"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue