ideasman42 / nerd-dictation

Simple, hackable offline speech to text - using the VOSK-API.
GNU General Public License v3.0
1.21k stars 104 forks source link

Pipx #103

Open kohane27 opened 11 months ago

kohane27 commented 11 months ago

Hello @ideasman42 , hope you're doing well. Thank you for creating nerd-dictation. I'm actually using it right now as I write (speak) this paragraph!

The need for pyproject.toml

I'm on archlinux and I encountered the following problems:

  1. pip3 install vosk:

2023-07-15-14-08-43

  1. The aur vosk-api requires Java 17 to build, which I don't have, and think it's an overkill
  2. The aur nerd-dictation-git requires xdotool but I'm on Wayland

Solution

This PR is a continuation of https://github.com/ideasman42/nerd-dictation/issues/60. afaik, it's now favored to use pyproject.toml as a standard way of specifying project metadata, which could be used by pipx. So this PR includes a simple pyproject.toml. Then, users can just install the program with a simple command:

pipx install git+https://github.com/ideasman42/nerd-dictation.git

Thank you!

ideasman42 commented 11 months ago

Thanks for the PR, I'm not sure what to make of this as we already have package/python from what I can see this adds a second way to package nerd-dictation in the root directory which seems odd.

Can you check if your changes can be integrated into package/python ?

kohane27 commented 11 months ago

Thanks for the PR review!

asfik, the major difference is that package/python requires vosk to be installed globally:

pip is a general-purpose package installer for both libraries and apps with no environment isolation. pipx is made specifically for application installation, as it adds isolation yet still makes the apps available in your shell: pipx creates an isolated environment for each application and its associated packages.

Reasons to favor pipx over pip:

  1. Next Debian/Ubuntu Releases Will Likely No Longer Allow pip install Ouside A Virtual Environment as per https://peps.python.org/pep-0668/ . So ubuntu users will no longer be able to install the vosk dependency with pip3 install vosk
  2. I'm on archlinux and have encountered the problem as depicted in the above pic. The package/python does not work for me because I can't installed vosk globally through pip (same issue described above). I got the ModuleNotFoundError: No module named 'vosk' error
  3. The pyproject.toml format can be adopted by poetry but I personally don't use it. Some users might prefer poetry over pipx

Simply, I just think installing nerd-dictation in an isolated environment is better than requiring and accessing vosk globally. Thank you again for this awesome software!

ideasman42 commented 11 months ago

Could you move the pyproject.toml into a sub-directory? package/python_pipx for e.g. Since the PR in it's current state makes it seem the changes you have made is the primary/main way to install nerd-dictation, instead of one of the multiple supported ways.

kohane27 commented 11 months ago

Hello, I've looked for a solution to install nerd-dictation through pipx when pyproject.toml is not in the project root directory. It seems to be not supported. Therefore, I've updated the docs to do so manually. The solution is a bit more involved but it's much better than not being able to use the program at all.

I have also updated a bit about the pip instruction steps. Initially I thought pip install package/python means installing nerd-dictation through pypi, but searching through https://pypi.org/search/?q=nerd-dictation yielded no result. Then I reazlied pip install package/python is pointing to the local file from the project root directory to install nerd-dictation through the setup.py.

Cheers!

kohane27 commented 11 months ago

Update on the situation: https://www.youtube.com/watch?v=35PQrzG0rG4

lamyergeier commented 4 months ago

@kohane27 If pipx is not supported, is it better to install vosx in a venv so that it does not clutter the package list?