From eb0520c3345922232ce760b128871987cbeb9573 Mon Sep 17 00:00:00 2001 From: Erik De Smedt Date: Thu, 7 Mar 2024 13:30:25 +0100 Subject: [PATCH 1/2] Poetry: Python dependency management A general clean-up of the `pyproject.toml`-files. It is now possible to install all dependencies using `poetry install`. Before you had to do ``` cd docs; poetry install cd libs/gl-client-py; poetry install cd libs/gl-testing; poetry install ``` Another advantage is that it now properly resolves dependencies and conflicts. In the old approach conflicts between two different `pyproject.toml`-files wouldn't be detected. Users who want to contribute to the documentation have to use ``` poetry install --with docs ``` --- Cargo.lock | 49 ++++++++++++++++++++-------------- docs/pyproject.toml | 23 ---------------- libs/gl-testing/pyproject.toml | 15 ++++++++--- pyproject.toml | 43 +++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 47 deletions(-) delete mode 100644 docs/pyproject.toml create mode 100644 pyproject.toml diff --git a/Cargo.lock b/Cargo.lock index c24038cac..9669712bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -451,6 +451,12 @@ dependencies = [ "serde", ] +[[package]] +name = "chunked-buffer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa622bd314835eb026b776af471344d0dba94705c937900656a31d0407e53689" + [[package]] name = "cipher" version = "0.4.4" @@ -999,7 +1005,7 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "gl-client" -version = "0.1.9" +version = "0.1.11" dependencies = [ "anyhow", "async-trait", @@ -1045,7 +1051,7 @@ dependencies = [ [[package]] name = "gl-client-py" -version = "0.1.10" +version = "0.1.11" dependencies = [ "anyhow", "bytes 1.5.0", @@ -2799,12 +2805,13 @@ dependencies = [ [[package]] name = "serde_bolt" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3ddb862d94a73280b5b6faa3c9bc37db242f6a495d49f0ffb85f040dbb9bca" +checksum = "54f634eeb988ab754b0711815e13e6ad983bfc52f76e0af342d492c6cad4f681" dependencies = [ "bitcoin 0.29.2", "bitcoin-consensus-derive", + "chunked-buffer", "hex", ] @@ -2844,14 +2851,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64 0.21.5", "chrono", "hex", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -2859,9 +2867,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", @@ -3630,13 +3638,14 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "txoo" -version = "0.6.2-beta.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74fb0ae52e565a5e1364ed50933a2a884f2e6330e8ffe9ac32ec6c4084bd3a3a" +checksum = "2d63e3a8a97175f205a3b101cb100568ce15e6b4e77d88207e9065da4a4e061e" dependencies = [ "bitcoin 0.29.2", "log", "serde", + "serde_bolt 0.3.4", ] [[package]] @@ -3734,9 +3743,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vls-core" -version = "0.11.0-rc.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c9571f43c1d63d301e4f88892cc7bd570b28fb6d44e8af3fac86bce210d8f0" +checksum = "1210aae1bc771b5ff39372466cf94ea23130a9d3ed0bbbafb6ee4443976de945" dependencies = [ "anyhow", "backtrace", @@ -3753,7 +3762,7 @@ dependencies = [ "log", "scopeguard", "serde", - "serde_bolt 0.3.1", + "serde_bolt 0.3.4", "serde_derive", "serde_with", "txoo", @@ -3761,9 +3770,9 @@ dependencies = [ [[package]] name = "vls-persist" -version = "0.11.0-rc.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bad8154243b9db47c8cd0efc3513f07499faa7e31f25c8e7027a13241362605" +checksum = "e8a9de079c84145fd4df1f826970d140f1a364fbd0f68f1944d16149988a3931" dependencies = [ "hex", "log", @@ -3776,24 +3785,24 @@ dependencies = [ [[package]] name = "vls-protocol" -version = "0.11.0-rc.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2b2f877b5ee624f38a61fb37fad38678514176a01da925aa265a70a977df70" +checksum = "e01ad8baa041296e8d715fd34d052d00ee5210038cc755e0f993c8c827935a85" dependencies = [ "as-any", "bitcoin-consensus-derive", "bolt-derive", "hex", "log", - "serde_bolt 0.3.1", + "serde_bolt 0.3.4", "txoo", ] [[package]] name = "vls-protocol-signer" -version = "0.11.0-rc.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a720d79fa6a2da1c5ed528312eacd15fa1b7af1d8dc4caa8775222e817ac21" +checksum = "a4435ed40d9bab3350f0caa305685bc3ac95e268e9c3b3f09bc08b002fac19ba" dependencies = [ "bit-vec", "log", diff --git a/docs/pyproject.toml b/docs/pyproject.toml deleted file mode 100644 index 2e3b478ac..000000000 --- a/docs/pyproject.toml +++ /dev/null @@ -1,23 +0,0 @@ -[tool.poetry] -name = "docs" -version = "0.1.0" -description = "" -authors = ["Christian Decker "] - -[tool.poetry.dependencies] -python = ">=3.8,<4" -mkdocs-material = "^9.1.0" -mkdocs-redirects = "^1.1.0" -mkdocs-material-extensions = "^1.3.1" -pymdown-extensions = "^10.7" -ghp-import = "2.1.0" -pdoc = "^13.1.1" -cairosvg = "^2.7.0" -pillow = "^9.5.0" - -[tool.poetry.dev-dependencies] -pytest = "^5.2" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" diff --git a/libs/gl-testing/pyproject.toml b/libs/gl-testing/pyproject.toml index b42364d65..2bbd095e0 100644 --- a/libs/gl-testing/pyproject.toml +++ b/libs/gl-testing/pyproject.toml @@ -15,9 +15,6 @@ cryptography = ">=36.0.1,<37.0.0" ephemeral-port-reserve = "^1.1.4" sh = "^1.14.2" pytest-timeout = "^2.1.0" -# `pip` doesn't like relative-path dependencies. Should be ok once we -# publish this on PyPI so pip can find it too. -# gl-client-py = {path = "../gl-client-py"} pytest-xdist = "^2.5.0" pytest = "^7.1.2" pytest-cov = "^3.0.0" @@ -30,7 +27,17 @@ anyio = "^3.7.1" purerpc = { version = "^0.8.0", extras = ["grpc"] } pytest-sugar = "^0.9.7" -[tool.poetry.dev-dependencies] +# The dependency below is defined in this repository +# PyPi cannot support relative paths. +# +# Users, who `pip install` this library retrieve the sources from `PyPi`. +# using the version numbers listed below +# +# Contributors should use `poetry install` in the project root +# to insure the installation is editable from local sources. +gl-client = "^0.1.11" + +[tool.poetry.group.dev.dependencies] mypy = "^1" typed-ast = "^1.5.4" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..3f51f1aa3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[tool.poetry] +package-mode=false + +[tool.poetry.dependencies] +python = ">=3.8,<4.0" +gl-client = {path = "./libs/gl-client-py", develop=true} +gltesting = {path = "./libs/gl-testing", develop=true} + +[tool.poetry.group.dev.dependencies] +black = "^24.0.0" +pytest = "^7" + +[tool.poetry.group.dev-gl-client-py.dependencies] +black = "^24.0.0" +mypy-protobuf = "^3.5" +maturin = ">=1.0,<1.3.2" +mypy = "^1.7.0" +grpcio-tools = "^1.59.2" + +[tool.poetry.group.dev-gl-testing.dependencies] +mypy = "^1" +typed-ast = "^1.5.4" +grpc-stubs= "^1.53.0" + +[tool.poetry.group.docs] +optional=true + +[tool.poetry.group.docs.dependencies] +python = ">=3.8,<4" +mkdocs-material = "^9.1.0" +mkdocs-redirects = "^1.1.0" +mkdocs-material-extensions = "^1.3.1" +pymdown-extensions = "^10.7" +ghp-import = "2.1.0" +pdoc = "^13.1.1" +cairosvg = "^2.7.0" +pillow = "^9.5.0" + +# Language server protocol used by the ide +# Not to be confused with lightning service provider +[tool.poetry.group.lsp_ide.dependencies] +python-lsp-server = "^1.10.0" + From bddb115b8b4df1dbe4ddd45af3b7910c07212bf8 Mon Sep 17 00:00:00 2001 From: Erik De Smedt Date: Thu, 7 Mar 2024 13:51:29 +0100 Subject: [PATCH 2/2] Document: How to build the docs --- docs/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..dc4c6c4d1 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,24 @@ +# Greenlight docs + +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. + +To install dependencies make sure you are at the root of the repository + +``` +poetry install --with-only docs +``` + +To build the docs + +``` +cd docs; mkdocs build +``` + +To serve the docs locally +``` +cd docs; mkdocs serve +```