jankrepl / mltype

Command line tool for improving typing skills (programmers friendly)
https://mltype.readthedocs.io
MIT License
448 stars 29 forks source link

Recommend using pipx #106

Closed harshcurious closed 1 year ago

harshcurious commented 1 year ago

I have personally used pipx extensively on my linux device, and seems to be the best way to avoid the dependency hell of python. It basically install a python package in it's own python environment, while also making it accessible in the PATH. It also has significantly less overhead than Docker.

PS: This will reduce the number of installation related issues too.

jankrepl commented 1 year ago

@harshcurious thank you for your interest.

I have heard about the tool, but don't really have any real experience with it and that is why I don't really feel comfortable recommending it. However, if I understand it correctly this would not require any changes in the source code, right?

Note that you don't have to use Docker to make things run. Another approach is below

Without pipx (using venv)

Install time

cd $SOME_FOLDER
python -m venv venv
source venv/bin/active
pip install mltype

When using

cd $SOME_FOLDER
source venv/bin/active
mlt --help
harshcurious commented 1 year ago

Thanks a lot for the reply. I agree that it is possible to create a python environment (using a variety of tools; I prefer conda) and run it. The issue with that approach is that I will have to remember to activate/deactivate the environment on every run. Pipx does that automatically and provides a direct access to it. I personally use Manjaro (Arch based) as my daily driver and the python packages from AUR broke often. So I have personally started using pipx. It does not require any changes on the part of the package maintainers. As long as pip works, pipx also works.

To use pipx, you need to first install pipx using pip (I do it with the default python installed on the system):

pip install pipx
pipx ensurepath

Details: https://pypa.github.io/pipx/installation/

Once pipx is in the PATH all you need to install a python library is:

pipx install <package_name>

It install the package into its unique isolated environment and the package can be accessed from the terminal (i.e. the binary is in the PATH) Upgrade is easy too. You can either upgrade all your pipx python packages using pipx upgrade --all or just one particular one using pipx upgrade <package_name>

But I understand your reluctance, there are so many python packager/installers that have failed that recommending Docker seems safer :P

PS: I installed this using pipx and it worked fine, in case someone else wants to use it.

jankrepl commented 1 year ago

@harshcurious I think it is a great suggestion. Thank you for it. I am sure that people who want to use pipx will stumble upon this issue and will be able to follow your instructions:)

Anyway, as I mentioned, since I am not an expert on this technology I am not going to put it in the README.md.

Thank you!!