Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(py): Migrate all python packages to use uv #559

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ The docs are hosted on https://blockstream.github.io/greenlight/

## Contributing to the documentation

You must have a working installation of `python` and `poetry` to contribute to the docs.
You must have a working installation of `python` and `uv` to contribute to the docs.

To install dependencies make sure you are at the root of the repository

```
poetry install --with-only docs
uv sync --extra docs
```

To build the docs
Expand Down
1,199 changes: 0 additions & 1,199 deletions docs/poetry.lock

This file was deleted.

17 changes: 17 additions & 0 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[project]
name = "gl-docs"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.49",
"mkdocs-redirects>=1.2.2",
"mkdocs-material-extensions>=1.3.1",
"pymdown-extensions>=10.13",
"ghp-import>=2.1.0",
"pdoc>=15.0.1",
"cairosvg>=2.7.1",
"pillow>=11.0.0",
]
365 changes: 0 additions & 365 deletions examples/python/poetry.lock

This file was deleted.

18 changes: 10 additions & 8 deletions examples/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[tool.poetry]
[project]
name = "my-gl-example"
version = "0.1.0"
description = "An example application for greenlight that uses the gl-client library"
authors = []
license = "MIT"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"gl-client",
"pytest>=8.3.4",
]

[tool.poetry.dependencies]
gl-client = {path = "../../libs/gl-client-py"}
pytest = "^7.1.2"
python = ">=3.7,<4"
[tool.uv.sources]
gl-client = { workspace = true }
1 change: 1 addition & 0 deletions libs/cln-version-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cln_version_manager.egg-info/
20 changes: 20 additions & 0 deletions libs/cln-version-manager/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2024 Blockstream

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 changes: 25 additions & 22 deletions libs/cln-version-manager/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
[tool.poetry]
[project]
name = "cln-version-manager"
version = "0.1.1"
description = "A version manager for Core Lightning Binaries"
authors = ["Erik De Smedt <[email protected]>"]
license = "MIT"
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.8"

packages = [
{ include = "clnvm" },
authors = [
{ name = "Erik De Smedt", email = "[email protected]" },
]
dependencies = [
"click>=8.1.8",
"requests>=2.32.3",
]
[project.scripts]
clnvm = 'clnvm.cli:run'

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2"
click = "^8"
[tool.uv]
dev-dependencies = [
"pytest>=8.3.4",
"types-click>=7.1.8",
"types-requests>=2.32.0.20241016",
]

[tool.poetry.group.dev.dependencies]
types-requests = "^2.31"
pytest = "^8"
mypy = "^1.8.0"
types-click = "^7"
black = "^24.2.0"
source = ['.']

[tool.poetry.group.lsp_ide.dependencies]
python-lsp-server = "^1.10.0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.scripts]
clnvm = "clnvm.cli:run"
[tool.hatch.build.targets.sdist]
ignore-vcs = true

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.hatch.build.targets.wheel]
packages = ["clnvm"]
1 change: 1 addition & 0 deletions libs/gl-client-py/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
gl_client.egg-info
index.node
poetry.lock
20 changes: 20 additions & 0 deletions libs/gl-client-py/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2024 Blockstream

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File renamed without changes.
56 changes: 14 additions & 42 deletions libs/gl-client-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,25 @@
[project]
name = "gl-client"

dependencies = [
"protobuf>=3",
"grpcio>=1.56",
"pyln-grpc-proto>=0.1",
]

[tool.poetry]
name = "gl-client"
version = "0.3.0"
description = ""
authors = ["Christian Decker <[email protected]>"]
license = "MIT"

packages = [
{ include = "glclient" },
description = "Greenlight Client Bindings for Python"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.7"
authors = [
{ name = "Christian Decker", email = "[email protected]" },
]

include = [
{ path = "glclient/*.pyi", format = ["wheel", "sdist"] },
{ path = "glclient/py.typed", format = ["wheel", "sdist"] },
dependencies = [
"protobuf>=5.29.2",
"pyln-grpc-proto>=24.2.1",
]

[tool.poetry.group.dev.dependencies]
black = "^23.1.0"
mypy-protobuf = "^3.5"
maturin = {version = ">=1.0,<1.3.2", extras = ["patchelf"]}
mypy = "^1.7.0"
grpcio-tools = "^1.67"

[tool.poetry.dependencies]
python = ">=3.8,<4"
grpcio = ">=1.67"
pyln-grpc-proto = ">=0.1.2,<1.2"
protobuf = ">=4"
maturin = ">=1.0"

[build-system]
requires = ["maturin>=1.0"]
build-backend = "maturin"

[tool.mypy]
exclude = [
'glclient/greenlight_pb2.py',
'glclient/scheduler_pb2.py',
'glclient/greenlight_pb2_grpc.py',
'glclient/scheduler_pb2_grpc.py',
[tool.uv]
dev-dependencies = [
"grpcio-tools>=1.68.1",
"maturin>=1.8.0",
"mypy-protobuf>=3.6.0",
]

[[tool.mypy.overrides]]
module = 'glclient'
4 changes: 3 additions & 1 deletion libs/gl-plugin/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ impl Node for PluginNodeServer {
// log entries are produced while we're streaming the
// backlog out, but do we care?
use tokio::io::{AsyncBufReadExt, BufReader};
let file = tokio::fs::File::open("/tmp/log").await?;
// The nodelet uses its CWD, but CLN creates a network
// subdirectory
let file = tokio::fs::File::open("../log").await?;
let mut file = BufReader::new(file).lines();

tokio::spawn(async move {
Expand Down
6 changes: 6 additions & 0 deletions libs/gl-testing/tests/test_grpc_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_node_grpc_web(scheduler, node_grpc_web_proxy, clients):
c = clients.new()
c.register(configure=True)
n = c.node()
_s = c.signer().run_in_thread()
info = n.get_info()

# Now extract the TLS certificates, so we can sign the payload.
Expand All @@ -62,3 +63,8 @@ def test_node_grpc_web(scheduler, node_grpc_web_proxy, clients):
req = clnpb.GetinfoRequest()
info = web_client.call("Getinfo", req)
print(info)

# Ask for a new address
req = clnpb.NewaddrRequest()
addr = web_client.call("NewAddr", req)
print(addr)
Loading
Loading