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

build: migrate from setuptools to poetry (use pyproject.toml for build) #164

Open
wants to merge 3 commits into
base: vnc
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
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim-buster
FROM python:3.12-slim
RUN apt-get update
RUN apt-get install -y \
libdbus-1-3 \
Expand All @@ -9,15 +9,9 @@ RUN apt-get install -y \
libxcb-image0 \
libxkbcommon-x11-0
RUN apt-get clean

WORKDIR /rmview
COPY resources.qrc setup.cfg setup.py ./
COPY assets ./assets
COPY bin ./bin
COPY src ./src
RUN pip install --upgrade pip
# TODO: setup.py could to be fixed to include install_requires
# see also: https://stackoverflow.com/q/21915469/543875
RUN pip install pyqt5==5.14.2 paramiko twisted
COPY pyproject.toml build.py setup.py poetry.lock assets bin src README.md ./
RUN pip install .[tunnel]
RUN pip cache purge

CMD rmview
51 changes: 24 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,48 @@


## Installation

The most efficient installation method is the semi-automatic one below, which requires a Python3 installation.
If you are looking for a standalone executable, check the [releases page](https://github.com/bordaigorl/rmview/releases) for executable bundles.
If there is no bundle for your operating system then follow the installation instructions below.

As a basic prerequisite you will need [Python3][py3] on your computer.
If your system uses `pipx` to handle global python packages, run:
pipx install .
If it uses pip:
pip install .

> :warning: Please make sure `pip` is pointing to the Python3 version if your system has Python2 as well.
If not, use `pip3` instead of `pip` in what follows.

> :warning: **WARNING** :warning::
> If you use [Anaconda][anaconda], please install the dependencies via `conda` (and not `pip`) then run `pip install .`.

### Semi-automatic installation

The easiest installation method is by using `pip`, from the root folder of this repository:

pip install .

(please note the command ends with a dot)
which will install all required dependencies and install a new `rmview` command.
If you want to use the SSH tunnel feature, install with
pip install .[tunnel]

pip install ".[tunnel]"
Then, to run `rmview`, just execute:
rmview

Then, from anywhere, you can execute `rmview` from the command line.
The tool will ask for the connection parameters and then ask permission to install the VNC server on the tablet.
Press <kbd>Auto install</kbd> to proceed.

If you plan to modify the source code, use `pip install -e .` so that when executing `rmview` you will be running your custom version.
## Development installation
For this, you'll need as well as [`poetry`][https://python-poetry.org/] installed.

### Manual installation
To install `poetry`, [refer to the docs][https://python-poetry.org/docs/#installation], or if `pipx` is installed on your system:
pipx install poetry
if it isn't:
pip install -I poetry

Install the dependencies ([PyQt5][pyqt5], [Paramiko][paramiko], [Twisted][twisted], [PyJWT][pyjwt]) with `pip` or `conda` manually:
Then, install rmview's dependencies:
poetry install

# install dependencies
pip install pyqt5 paramiko twisted pyjwt
pip install sshtunnel # optional
# build resources file
pyrcc5 -o src/rmview/resources.py resources.qrc
Or if you want to use the SSH tunnel feature, install with
poetry install -E tunnel

Then you can run the program with `python -m rmview` from the `src` folder.
Then, to run `rmview`, just execute:
poetry run rmview

### Using Docker
## System-wide installation
Then, from anywhere, you can execute `rmview` from the command line.

If you plan to modify the source code, use `pip install -e .` so that when executing `rmview` you will be running your custom version.

### Using Docker
This project contains a `Dockerfile` so that `rmview` and all its dependencies can be installed and run inside a Docker container.
Since `rmview` not only reads your local configuration but also needs an X11 display, you should run `docker-run.sh` which takes care of the host mappings.
Please note that `docker-run.sh` is written for Unix-like OSes and expects your rmview configuration inside your local `$HOME/.config/rmview/` folder.
Expand Down
6 changes: 6 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys, os
from PyQt5.pyrcc_main import processResourceFile

def build(_setup_kwargs):
# Generate resources.py from resources.qrc
processResourceFile(['resources.qrc'], 'src/rmview/resources.py', False)
Loading