Skip to content

Commit

Permalink
plugins: Remove requirements.txt for python plugins
Browse files Browse the repository at this point in the history
Removing requirements.txt from clnrest and wss-proxy plugins due to their ever changing dependencies. We will only be dependent on pyproject.toml for more stable results.

Reference: #7416 (comment)

Changelog-None.
  • Loading branch information
ShahanaFarooqui committed Jul 3, 2024
1 parent c6ac45d commit 4b69c57
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 790 deletions.
23 changes: 15 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,24 @@ RUN apt-get update -qq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | python3 -
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
ENV PATH=$PATH:/root/.cargo/bin/
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN rustup toolchain install stable --component rustfmt --allow-downgrade

WORKDIR /opt/lightningd
COPY plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt
COPY plugins/wss-proxy/requirements.txt plugins/wss-proxy/requirements.txt
ENV PYTHON_VERSION=3
RUN pip3 install -r plugins/clnrest/requirements.txt && \
pip3 install -r plugins/wss-proxy/requirements.txt && \
WORKDIR /opt/lightningd

COPY plugins/clnrest/pyproject.toml plugins/clnrest/pyproject.toml
COPY plugins/wss-proxy/pyproject.toml plugins/wss-proxy/pyproject.toml

RUN cd plugins/clnrest && \
/root/.local/bin/poetry export -o requirements.txt --without-hashes && \
pip3 install -r requirements.txt && \
cd /opt/lightningd

RUN cd plugins/wss-proxy && \
/root/.local/bin/poetry export -o requirements.txt --without-hashes && \
pip3 install -r requirements.txt && \
cd /opt/lightningd && \
pip3 cache purge

FROM ${BASE_DISTRO} as final
Expand Down
2 changes: 1 addition & 1 deletion doc/developers-guide/app-development/rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ An online demo for the REST interface is available at [REST API REFERENCE](ref:g
## Installation

The plugin is built-in with Core Lightning but its python dependencies are not, and must be installed separately.
Install required packages with `pip install -r plugins/clnrest/requirements.txt`.
Detailed installation instructions can be found [here](https://docs.corelightning.org/docs/installation#clnrest).

Note: if you have the older c-lightning-REST plugin, you can configure Core Lightning with `disable-plugin=clnrest.py`
option to avoid confusion with this one. You can also run both plugins simultaneously till all your applications
Expand Down
7 changes: 4 additions & 3 deletions doc/getting-started/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ To build cln to just install a tagged or master version you can use the followin
```shell
pip3 install --upgrade pip
pip3 install mako
pip3 install -r plugins/clnrest/requirements.txt
pip3 install grpcio-tools
./configure
make
Expand Down Expand Up @@ -588,7 +587,9 @@ apk add libgcc libsodium sqlite-libs zlib

## Python plugins

You will need some Python packages if you want to use python plugins. Unfortunately there are some Python packages which are not packaged in Ubuntu, and so you will need to force installation of these (I recommend --user which will install them in your own .local directory, so at least you won't run the risk of breaking Python globally!).
Python plugins will be installed with the `poetry install` step mentioned above fron development setup.

Other users will need some Python packages if python plugins are used. Unfortunately there are some Python packages which are not packaged in Ubuntu, and so force installation will be needed (Flag `--user` is recommended which will install them in user's own .local directory, so at least the risk of breaking Python globally can be avoided!).

### clnrest

Expand All @@ -601,7 +602,7 @@ pip3 install --user flask-cors flask-restx pyln-client flask-socketio gevent gev

### wss-proxy

For wss-proxy, you need to install below libraries:
Below libraries are required for wss-proxy:

```
pip3 install --user pyln-client websockets
Expand Down
Loading

0 comments on commit 4b69c57

Please sign in to comment.