Skip to content
Merged
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
26 changes: 15 additions & 11 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: formatting
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.5"]
steps:
- uses: actions/checkout@v4
- name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
python-version: ${{ inputs.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install packages
run: poetry install
enable-cache: true
python-version: ${{ inputs.python-version }}
- name: Install the project dependencies
shell: bash
run: uv sync --locked --all-extras --dev
- name: Check black
run: make black
26 changes: 15 additions & 11 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: mypy
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.5"]
steps:
- uses: actions/checkout@v4
- name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
python-version: ${{ inputs.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install packages
run: poetry install
enable-cache: true
python-version: ${{ inputs.python-version }}
- name: Install the project dependencies
shell: bash
run: uv sync --locked --all-extras --dev
- name: Check mypy
run: make mypy
28 changes: 16 additions & 12 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: pyright
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.5"]
steps:
- uses: actions/checkout@v3
- name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install packages
run: poetry install
python-version: ${{ inputs.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ inputs.python-version }}
- name: Install the project dependencies
shell: bash
run: uv sync --locked --all-extras --dev
- name: Check pyright
run: make pyright
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ name: release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.15
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
pypi_token: ${{ secrets.PYPI_API_KEY }}

python-version: 3.10
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build the project
run: uv build
- name: Publish to pypi
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_KEY }}
run: uv publish
- name: Create github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Ruff
on: [ push, pull_request ]
on:
push:
branches:
- main
pull_request:
jobs:
ruff:
runs-on: ubuntu-latest
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name: tests
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.5"]
steps:
- uses: actions/checkout@v4
- name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies
run: poetry install
python-version: ${{ inputs.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ inputs.python-version }}
- name: Install the project dependencies
shell: bash
run: uv sync --locked --all-extras --dev
- name: Run tests
run: make test
- name: Upload coverage to Codecov
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ all: black ruff mypy pyright test
format: black ruff-fix

black:
poetry run black --preview .
uv run black --preview .

ruff:
poetry run ruff check .
uv run ruff check .

ruff-fix:
poetry run ruff check . --fix
uv run ruff check . --fix

mypy:
poetry run mypy .
uv run mypy .

pyright:
poetry run pyright
uv run pyright

test:
poetry run pytest
uv run pytest
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ and the LNbits bolt11 helpers created by [@fiatjaf][fiatjaf].
```console
$ git clone https://github.com/lnbits/bolt11
$ cd bolt11
$ poetry install
$ uv sync
```

### running CLI
```console
$ poetry run bolt11 --help
$ poetry run bolt11 decode
$ uv run bolt11 --help
$ uv run bolt11 decode
```

### run all checks and tests
Expand All @@ -56,18 +56,18 @@ $ make

### using pre-commit as git hook
```console
$ poetry run pre-commit install
$ uv run pre-commit install
```


### running CLI
```console
$ poetry run bolt11 --help
$ uv run bolt11 --help
```

### running CLI decode
```
$ poetry run bolt11 decode lnbc20m1pvjluez.....
$ uv run bolt11 decode lnbc20m1pvjluez.....
{
"currency": "bc",
"amount": 2000000000,
Expand Down Expand Up @@ -104,7 +104,7 @@ $ poetry run bolt11 decode lnbc20m1pvjluez.....

### running CLI encode
```
$ poetry run bolt11 encode '{
$ uv run bolt11 encode '{
"currency": "bc",
"amount_msat": 1000,
"date": 1590000000,
Expand Down
Loading
Loading