Installation via pipx doesn't work
A merged PR implies that pipx can be used, but it doesn't work for me.
$ pipx install mssql-cli
installed package mssql-cli 1.0.0, Python 3.9.0
These apps are now globally available
- mssql-cli
- mssql-cli.bat
done! ✨ 🌟 ✨
$ mssql-cli
/usr/local/opt/[email protected]/bin/python3.8: Error while finding module specification for 'mssqlcli.main' (ModuleNotFoundError: No module named 'mssqlcli')
As far as I understand:
- pipx recommends that packages use
entry_pointsin their setup.py. - Yet pipx has some support for
scripts, namely it symlinks them from the app's virtualenv to~/.local/bin - mssql-cli uses their own shell
scriptsinstead ofentry_points, because they need to setPYTHONIOENCODING: the switch to entry_points contributed by @cs01 in 2018 was later reverted in September 2019 https://github.com/dbcli/mssql-cli/pull/299
Seems like it's a pipx issue, which should at least document the solution for people who want to use non-python scripts that run python -m and expect their module to be installed. Or maybe install a wrapper executable to .local/bin, that activates the correct virtualenv and runs the original script afterwards.
Note that *.py scripts like https://github.com/aws/aws-cli/blob/c1c11afa6b4a76e3790b618ed746feeb25f70446/bin/aws#L1 on *nix work auto-magically because something rewrites their shebang to point to the python executable from the app's virtualenv.
Oh, the workaround is to change the last line of ~/.local/bin/mssql-cli to point to the virtualenv's python (on my system it's ~/.local/pipx/venvs/mssql-cli/Scripts/python -m mssqlcli.main "$@")