noembryo / KoHighlights

KOHighlights is a utility for viewing KOReader's highlights and/or export them to simple text, html, csv or markdown files.
MIT License
128 stars 5 forks source link

release as a python pip package ? make it easy to install and available for linux users ? #2

Closed m040601 closed 5 years ago

m040601 commented 5 years ago

Hi, this looks like a fantastic tool, thank you for your effort. I'm trying to run this on Linux but failed, because probably lack of python skills. My interest is in creating a package for ArchLinux.

I have tried installing the needed python modules dependencies, but I'm not sure which ones.I see a lot of python imports for bs4 beautifulsoup, mechanize, pyside ?

  1. Could you please detail on the README.md page the requirements and python dependencies needed ? Which ones belong to the standard library ? Which ones are extra foreign ?

  2. Would it be possible for you to release this as a python pip package ? https://pip.pypa.io/en/stable/ https://packaging.python.org/

A lot of potential users KoHighlights are for sure Linux users. For example deb/apt Debian/Ubuntu packages and ArchLinux AUR packages A clean and easy way to install this would be great, to avoid littering your system with untracked/uneeded/incompatible/coliding.

m040601 commented 5 years ago

as an example for documentation, check out the README.md page of pyglossary,https://github.com/ilius/pyglossary/

noembryo commented 5 years ago

Added the dependencies to the readme.md

As for the pip packaging, well, I never done any, so maybe I will look in to it. For now you can just clone the source and run pip install -r requirements.txt That will install everything that's missing. Remember, its for Python 2.17 only.

Edit: On windows the requirements.txt install works OK, but when I tried it on a Lubuntu VM, it couldn't install Pyside because the Python was 64bit. To solve this I had to use sudo apt-get install python-pyside

noembryo commented 5 years ago

Now runs on both Python 2 and 3.

noembryo commented 5 years ago

Linux binaries are available, starting with the 0.8.0.0 release.

m040601 commented 5 years ago

Thanks again for your effort. I'm trying now version 0.9, the Linux binary. I' like it ! I will provide you with more feedback about usabilty later in other issue. But I like the general functionality you have in mind.

Before you close this issue. Just wanted to add some (opinionated) advice about releasing and installation, specially if you are gonna be thinking of less technical users.

update to more recent libraries !

I saw in, https://www.mobileread.com/forums/showthread.php?t=265433&page=3 that you use windows. In windows, you just have to worry about releasing a compiled exe file and that's it.But if you're gonna make an effort to release it to Linux, save yourself some effort, other wise you're gonna keep being bombarded with user problems. Works in this distro, doesnt work in that distro, updated this, reupdate that , etc ...

Before you released the binary, I actually tried to run it on my system from the source version. It was a struggle trying to get the required python versions and dependencies, without 'polluting' my system with incompatible python versions/libraries and dependencies. Yes, one can do that in a testing environment without borking your system. If your're a python developer or advanced user, that may be ok. But if you're an user just checking out your KoHighlights for the first time, nobody will want to risk that.

Let me explain why.

Mechanize, beautifulsoup and future are no problem. Every distro has official packages for both the python2 and python3 versions. The main obstacle is the Pyside version you are using. You're using Pyside (1), https://pypi.org/project/PySide. It is already quite old, last version 1.2.4 (2015-10-14). Besides it needs a lot of old Qt4 related stuff.

These Qt4 stuff is old ... there's Qt5. On my system (ArchLinux) I don't have Qt4 stuff anymore. I love to test new stuff, but when I need to install a couple of megas of Qt4 packages just to test some cool new software I try to avoid it.

Pyside, does support both python2 and python3 but:

only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)

The official python 3 version on most modern Linux distributions is already much newer that 3.4. On Arch Linux for example, it is already Python 3.7.2. Dont know exactly, but it seems Ubuntu/Debian are already python 3.6 ,in https://packages.ubuntu.com/cosmic/python3.

Can you imagine the mess that it was to install pyside1 in a python3 system :) I saw, https://www.mobileread.com/forums/showthread.php?p=3815088 And I am gonna repeat the same advice you got there:

But PySide2/Qt5 would be preferable in the long run in any case.

Qt5 looks so much nicer. https://pypi.org/project/PySide2/ PySide2 is the official Python module from the Qt for Python project, which provides access to the complete Qt 5.12+ framework.

Any chance you would have interest in updating to Pyside2 ? Or any other more recent gui library ? There are so many beautifoul modern options !

So conclusion. If you use recent libraries, and the software is popular you dont' even need to worry about packaging for Linux. Somebody will come fetch your source code, build a specific package with the dependecies and release a package version for their own Linux distro,

installation without a binary

I would personally try to dump python2 once and for all, but if you still want to support it, dont recommend mixing of python2 and python3.

with pip, dont recommend sudo

If you dont provide a binary, dont recommend this

sudo pip install sudo pip2 install sudo pip3 install

it's gonna make a mess on the users system, and run into conflicts with the package manager.

If you really want to test it with the python (2 or 3)that's installed on the system use,

pip install --user pip2 install --user pip3 install --user

this will will install everything needed (python 2 or 3 in $home/.local/bin $home/.local/lib $home/.local/share

even better, python -m venv

This works with python3, since python 3.3 This is the recommended and safe way of testing something in a clean and isolated environment.

Don't confuse this with the 'virtualenv', 'mkvirtualenv', 'Pipenv' More, https://wiki.archlinux.org/index.php/Venv#virtualenvwrapper

So if KoHighlight would only depend on python3, you could recommend this to your (python3) users:

mkdir testing-Kohighlights cd testing-Kohighlights python -m venv KoHighlights-venv source KoHighlights-venv/bin/activate git clone https://github.com/noembryo/KoHighlights cd KoHighlights pip install -r requirements.txt

noembryo commented 5 years ago

Thank you in advance for your tests and opinions.

About your advises now ;o) First of all, as I stated before, I know almost nothing about Linux. ..but

Pyside, does support both python2 and python3 but:

only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)

I thought this too, but its not that accurate. I did install Pyside with Python 3.6.x (and maybe also with 3.7 - too many installations in the last days) Also, most of the distributions I checked were having both 3.x and 2.7.x Python.

And I am gonna repeat the same advice you got there:

But PySide2/Qt5 would be preferable in the long run in any case.

As I answered there, I want to keep supporting as many systems as possible. Although I already had a Xubuntu 18.04, I created 2 more 16.04 systems (x86, x64) for building the binaries, so more people can use them. I want to support Windows XP too :o)

To update my system to Pyside2 is not as simple as you think. I must also change Python to 3 and that means that most of my programs (not just KoHighlights which is a simple one) that use a gazillion of libraries, will not work anymore. And I would have to find solutions for something that has no problems and already works very well.

Apart from that, there isn't any new feature in Qt5 that I don't have in Qt4. OTOH there are things in Qt4 that are missing in Qt5 (e.g. QWebView)

I would personally try to dump python2 once and for all, but if you still want to support it, dont recommend mixing of python2 and python3.

Where did I made that recommendation?

with pip, dont recommend sudo

Again, I don't know what is recommend with Linux. I'll remove the commands from the page and hope that Python users will know how to install the dependencies.

I closed this issue since you didn't reply for more than a week and I thought that now, KoHighlights is available to Linux users. If you think otherwise, feel free to re-open it.

m040601 commented 5 years ago

I understand. And I admire your effort in maintaining the old stuff that works. Just to clarify, I'm not suggesting, that you dump python2 out of the system. I also have it. Some packages need it.

It's developing new applications in python2 the problem. It's not the python2 code itself the problem. It still runs fine in modern Linux systems. It's when it needs to imports old non standard libraries. Non standard here means, that they were not officialy shiped with the official python2 distribution. Sometimes these libraries, want to pull other non-python old packages to the system.

Anyway, good luck with your work. And dont' worry too much with Linux users. As long as you keep building a binary package for for x86_64, you will support 99.9% of the Linux users.

Since you're a Windows user, I would recommend you to install and try for yourself, https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux , https://docs.microsoft.com/en-us/windows/wsl/about, with the Ubuntu flavour, on Windows 10.

If only have Windows XP or Vista, just try the Ubuntu CD. You get 90% of your support problems solved.