Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.git
.venv
.uv-cache
__pycache__/
*.py[cod]
.pytest_cache/
.mypy_cache/
.ruff_cache/
.coverage
coverage.xml
junit.xml
test_data/
dist/
build/
cashu.egg-info/
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ LIGHTNING_RESERVE_FEE_MIN=2000

# Mint Management gRPC service configurations
# Run the script in cashu/mint/management_rpc/generate_certificates.sh to generate certificates for the server and client.
# Use `poetry run mint-cli get-info` to test the connection.
# Use `uv run mint-cli get-info` to test the connection.
MINT_RPC_SERVER_ENABLE=FALSE
MINT_RPC_SERVER_ADDR=localhost
MINT_RPC_SERVER_PORT=8086
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ inputs:
description: "Python Version"
required: true
default: "3.10"
poetry-version:
description: "Poetry Version"
default: "2.3.2"
uv-version:
description: "uv Version"
default: "0.11.14"

runs:
using: "composite"
Expand All @@ -16,11 +16,11 @@ runs:
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install Poetry ${{ inputs.poetry-version }}
- name: Install uv ${{ inputs.uv-version }}
run: |
python -m pip install --upgrade "poetry==${{ inputs.poetry-version }}"
python -m pip install --upgrade "uv==${{ inputs.uv-version }}"
shell: bash
- name: Install dependencies
run: |
poetry install
uv sync --locked
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string

permissions:
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}
- name: Ruff check
run: make ruff-check
mypy:
Expand All @@ -31,11 +31,11 @@ jobs:
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}
- name: Setup mypy
run: yes | poetry run mypy cashu --install-types || true
run: yes | uv run mypy cashu --install-types || true
- name: Run mypy
run: poetry run mypy cashu --ignore-missing --check-untyped-defs
run: uv run mypy cashu --ignore-missing --check-untyped-defs
ruff:
runs-on: ubuntu-latest
steps:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
# Wallet v0 / deprecated mint API support was removed in https://github.com/cashubtc/nutshell/pull/814; deprecated-only CI runs are no longer valid.
# mint-only-deprecated: ["false", "true"]
mint-only-deprecated: ["false"]
Expand All @@ -28,7 +28,7 @@ jobs:
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
uv-version: ${{ matrix.uv-version }}
mint-only-deprecated: ${{ matrix.mint-only-deprecated }}
mint-database: ${{ matrix.mint-database }}

Expand All @@ -38,13 +38,13 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
uses: ./.github/workflows/tests_redis_cache.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
uv-version: ${{ matrix.uv-version }}
mint-database: ${{ matrix.mint-database }}

tests_keycloak_auth:
Expand All @@ -53,13 +53,13 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
uses: ./.github/workflows/tests_keycloak_auth.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
uv-version: ${{ matrix.uv-version }}
mint-database: ${{ matrix.mint-database }}

regtest-mint:
Expand All @@ -68,13 +68,14 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.12"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
backend-wallet-class:
["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
# mint-database: ["./test_data/test_mint"]
with:
python-version: ${{ matrix.python-version }}
uv-version: ${{ matrix.uv-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: ${{ matrix.mint-database }}

Expand All @@ -84,12 +85,13 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.12"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
backend-wallet-class:
["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
# mint-database: ["./test_data/test_mint"]
with:
python-version: ${{ matrix.python-version }}
uv-version: ${{ matrix.uv-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: ${{ matrix.mint-database }}
10 changes: 5 additions & 5 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
strategy:
matrix:
python-version: ["3.11"]
poetry-version: ["2.3.2"]
uv-version: ["0.11.14"]
steps:
- name: Checkout
uses: actions/checkout@v6

- uses: ./.github/actions/prepare
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
uv-version: ${{ matrix.uv-version }}

- name: Verify Versions
if: github.event_name == 'release'
Expand All @@ -31,13 +31,13 @@ jobs:

- name: Build package
run: |
poetry build
uv build

- name: Install package
run: |
pip install --upgrade dist/*.whl
uv pip install dist/*.whl

- name: Upload to PyPI on release
if: github.event_name == 'release' && github.event.action == 'released'
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
uv publish --token "${{ secrets.PYPI_API_TOKEN }}"
6 changes: 3 additions & 3 deletions .github/workflows/regtest-mint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string
os-version:
default: "ubuntu-latest"
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}

- name: Setup Regtest
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/regtest-wallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string
os-version:
default: "ubuntu-latest"
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}

- name: Setup Regtest
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string
mint-database:
default: ""
Expand All @@ -23,7 +23,7 @@ permissions:
contents: read

jobs:
poetry:
uv:
name: Run (db ${{ inputs.mint-database }}, deprecated api ${{ inputs.mint-only-deprecated }})
runs-on: ${{ inputs.os }}
steps:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}
- name: Run tests
env:
MINT_BACKEND_BOLT11_SAT: FakeWallet
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests_keycloak_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string
mint-database:
default: ""
Expand All @@ -20,7 +20,7 @@ permissions:
contents: read

jobs:
poetry:
uv:
name: Auth tests with Keycloak (db ${{ inputs.mint-database }})
runs-on: ${{ inputs.os }}
steps:
Expand All @@ -31,7 +31,7 @@ jobs:
uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}

- name: Start PostgreSQL service
if: contains(inputs.mint-database, 'postgres')
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
MINT_AUTH_OICD_DISCOVERY_URL: http://localhost:8080/realms/nutshell/.well-known/openid-configuration
MINT_AUTH_OICD_CLIENT_ID: cashu-client
run: |
poetry run pytest tests/wallet/test_wallet_auth.py -v --cov=mint --cov-report=xml
uv run pytest tests/wallet/test_wallet_auth.py -v --cov=mint --cov-report=xml

- name: Stop and clean up Docker Compose
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests_redis_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
python-version:
default: "3.12"
type: string
poetry-version:
default: "2.3.2"
uv-version:
default: "0.11.14"
type: string
mint-database:
default: ""
Expand All @@ -23,7 +23,7 @@ permissions:
contents: read

jobs:
poetry:
uv:
name: Run (db ${{ inputs.mint-database }}, deprecated api ${{ inputs.mint-only-deprecated }})
runs-on: ${{ inputs.os }}
steps:
Expand All @@ -39,7 +39,7 @@ jobs:
uses: ./.github/actions/prepare
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}
uv-version: ${{ inputs.uv-version }}

- name: Start Redis service
run: |
Expand All @@ -56,7 +56,7 @@ jobs:
MINT_REDIS_CACHE_ENABLED: true
MINT_REDIS_CACHE_URL: redis://localhost:6379
run: |
poetry run pytest tests/mint/test_mint_api_cache.py -v --cov=mint --cov-report=xml
uv run pytest tests/mint/test_mint_api_cache.py -v --cov=mint --cov-report=xml

- name: Stop and clean up Docker Compose
run: |
Expand Down
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

| Task | Command |
|---|---|
| Install dependencies | `poetry install` |
| Activate virtual env | `poetry env activate` |
| Install dependencies | `uv sync` |
| Activate virtual env | `source .venv/bin/activate` |
| Run the wallet CLI | `cashu --help` |
| Run the mint server | `poetry run mint` |
| Run the mint server | `uv run mint` |
| Run all tests | `make test` (or `pytest tests`) |
| Run wallet tests only | `make test-wallet` |
| Run mint tests only | `make test-mint` |
| Lint + type-check | `make check` (Ruff + mypy) |
| Auto-format code | `make format` |
| Install pre-commit hook | `poetry run pre-commit install` |
| Install pre-commit hook | `uv run pre-commit install` |

### Environment setup

- Python **3.10.4** (install via `pyenv install 3.10.4 && pyenv local 3.10.4`)
- [Poetry](https://python-poetry.org/) for dependency and environment management
- [uv](https://docs.astral.sh/uv/) for dependency and environment management
- Copy `.env.example` to `.env` and set `MINT_BACKEND_BOLT11_SAT=FakeWallet` for local testing

## Repo Conventions
Expand Down
Loading
Loading