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
7 changes: 7 additions & 0 deletions currencyrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ different backends and taking the median. It caches results for an hour.

## Installation

You need [uv](https://docs.astral.sh/uv/getting-started/installation/) to run this
plugin like a binary. After `uv` is installed you can simply run

```
lightning-cli plugin start /path/to/currencyrate.py
```

For general plugin installation instructions see the repos main
[README.md](https://github.com/lightningd/plugins/blob/master/README.md#Installation)

Expand Down
25 changes: 19 additions & 6 deletions currencyrate/currencyrate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run --script

# /// script
# requires-python = ">=3.9.2"
# dependencies = [
# "cachetools>=5.3.3",
# "pyln-client>=24.11",
# "requests[socks]>=2.32.2",
# "urllib3>=2.2.2",
# ]
# ///

try:
import statistics
from collections import namedtuple
Expand All @@ -15,11 +26,13 @@

getmanifest = json.loads(sys.stdin.readline())
print(
json.dumps({
"jsonrpc": "2.0",
"id": getmanifest["id"],
"result": {"disable": str(err)},
})
json.dumps(
{
"jsonrpc": "2.0",
"id": getmanifest["id"],
"result": {"disable": str(err)},
}
)
)
sys.exit(1)

Expand Down
16 changes: 16 additions & 0 deletions currencyrate/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "currencyrate"
version = "0.1.0"
description = "Provides Bitcoin currency conversion functions using various different backends"
readme = "README.md"
requires-python = ">=3.9.2"

[dependency-groups]
dev = [
"pytest>=7.4,<9",
"pytest-xdist>=3.7,<4",
"pytest-timeout>=2.4,<3",
"pyln-testing>=24.11.1",
"pyln-client>=24.11.1",
"pyln-proto>=24.11.1",
]
5 changes: 0 additions & 5 deletions currencyrate/requirements.txt

This file was deleted.

Loading