bordaigorl / rmview

A live viewer for reMarkable written in PyQt5
GNU General Public License v3.0
741 stars 61 forks source link

Migrate from setuptools to hatch #150

Open M4a1x opened 1 year ago

M4a1x commented 1 year ago

As suggested in #149 this removes setup.py/setup.cfg and replaces it with hatch, configured in the pyproject.toml. I took inspiration from the hatch projects' pypoetry.toml for this.

The metadata was directly converted with some more keywords and classifiers added. The version number moved to __about__.py. I also added a custom build hook to compile the resources.qrc as was done in the setup.py. It's my first time writing a hatch hook, so if you spot something feel free to point it out.

I already added black, pytest, ... as environment/development dependencies as well as some basic configuration. The windows-binary.yml workflow still works as well.

Basic usage of hatch looks like this (with hatch installed e.g. through pip install hatch or package manager):

# Run program/script (also sets up virtual environment and builds artifacts)
hatch run rmview

# Setup environment in `.venv` folder
hatch env create

# Build distribution
hatch build

# Activate python environment
hatch shell
bordaigorl commented 1 year ago

Is this ready for review or are you planning to add more to it?

M4a1x commented 1 year ago

I'd appreciate it if you could have a look. To keep things simple I thought I'd start off by only switching to hatch at first and then doing the other things from #149 I proposed.

I don't have much experience contributing to projects on Github, so If I should e.g. just put all the changes in consecutive commits on this request or so - please, feel free to instruct me :sweat_smile:

bordaigorl commented 1 year ago

I have tried to use hatch but something is not working. I don't understand how this works so I might just be doing something stupid. I installed hatch, then run hatch run rmview which started building the environment and complained about a bunch of dependencies. I (re?)installed the dependencies manually and those errors were replaced by a runtime exception triggered by twisted in relation to OpenSSL. Needless to say, rmview works if run on the vnc branch.