joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
953 stars 104 forks source link

Packaging and PyPI distribution #61

Closed colin-nolan closed 4 years ago

colin-nolan commented 4 years ago

This PR sets up packaging with a pyproject.toml file and the help of Poetry.

I have tried to change as little as possible to get this to work. However, it was necessary to create a papertty package (directory) and move papertty.py + the drivers into that because I don't think it's possible to have a single module in addition to a package (which in this case was the drivers package).

I've setup papertty on PyPI, which I will pass control over to you if you let me know your PyPI details. Installation for users would be as simple as:

pip install papertty

I've then made the program available through the papertty command:

papertty --help

Installation from source is possible without any special tools using:

# Requires a modern version of pip (at least >18 - I've confirmed with 20)
pip install .

However, as a developer, I've found Poetry is useful, particularly when uploading to PyPI.

I've tried to align the README.md with the change but it was a little difficult (the need for a cleanup is mentioned in https://github.com/joukos/PaperTTY/issues/43).

Closes #44.

joukos commented 4 years ago

Nice, this is a very welcome change, thanks! I'll need to take a look at the code a bit and try it out. I also yesterday considered rewriting the README, hopefully soonish - now that installation is simple, usage ought to be too.

joukos commented 4 years ago

Update about this - I've been very busy as usual so this lagged quite a bit, sorry about that. I've rewritten (ie. condensed a lot) most of the README in preparation for putting this to PyPI, although it's not quite done yet. Perhaps we should get this stuff sorted somehow first, since it would be very useful even without the documentation fixes. I'm not too familiar with Poetry, but I don't immediately see it hurting the project either, so it's probably fine to use it.

I have an account at PyPI with the same username joukos, but haven't looked up how Poetry helps with all of this, so a couple of pointers may be needed :) Anyway there's a few conflicts to fix first since things have changed - I think I might also merge a new driver PR that's pending, so maybe this can be sorted after that, or when you feel like it.

Thanks again for your work on this, it's very appreciated.

colin-nolan commented 4 years ago

@joukos I have added you as a maintainer of the package on PyPI (I will upgrade this to owner once you confirm that I have added the correct account!).

A nice overview of Poetry can be found here. I'm happy to help with any specific problems though. I've found Poetry provides a developer friendly way of building and publishing Python packages, in addition to being much better WRT dependency management. To publish, it's as simple as bumping the version number, then:

poetry build
poetry publish

(Probably best to play with the PyPi test package index before going to prod!).

I've rebased against master. I believe I also got the new colour driver into that update.

joukos commented 4 years ago

@joukos I have added you as a maintainer of the package on PyPI (I will upgrade this to owner once you confirm that I have added the correct account!).

Thanks, I see the project in my account now, so it's the correct one :)

joukos commented 4 years ago

I finally had the time to try this out very briefly - my test RPi had gotten its SD card busted and most of the time was spent on bootstrapping another one for testing...doh! - and just pipped the version currently in PyPi. Apparently the default fonts need to be included etc., but otherwise looks promising! I'll see if I can find some time tomorrow to try with PyPi test to get it sorted out.

(accidentally posted the above comment with wrong account first, in case that caused some confusion)

joukos commented 4 years ago

I went and merged this now - will add some minor tweaks soon.

joukos commented 4 years ago

Phew. Thanks a lot! I added a temporary quick help to the README and moved fonts etc. to resources subdirectory. Now should just finish the docs rewrite at some point, but at least it should be pippable now which is great.