Closed abstractalgo closed 1 year ago
I'm not completely sure I understand the need for get-pip
, does the end user need to build this plugin themself and we're trying to work around their development environment not having pip installed?
Currently, there's no way to bundle the plugin and deliver it as a standalone. Fortunately enough, we didn't even have such needs so far since we didn't have any extra outside dependencies.
So, in order to be able to have additional dependencies, we need to somehow install them; and to install deps, we need pip
. And that's what get-pip
is about - providing an installer for pip
.
cc @ilijapuaca
To use Sentry, we need to use
sentry-sdk
module. However, there's no easy way of distributing QGIS plugin with its additional dependencies. There's absolutely no assurance that the user haspip
or any of those packages installed on their machine.Earlier commits in this PR tried to get a shallow copy of
sentry-sdk
and just import it with a relative path. However, that module itself depends on multiple other packages as well, so it's not so easy to just get a shallow copy of the module (which is more or less what we did withUnfolded/qgis_plugin_tools
module e.g.).Another way is to make sure that
pip
is installed by using something likeget-pip.py
, and then usepip
itself to install required dependencies. This is what we do.When installing
sentry-sdk
, we pick a specific version because we want to ensure that the rest of the code that depends on it works for sure, so that we don't risk some updated version ofsentry-sdk
being installed that changes the API and accidentally and silently breaks the plugin.TODO
get-pip.py
, either (see https://github.com/foursquare/qgis-plugin/pull/70/commits/9a7a90bd4be12a97278de7cc881315669fd9b029):init()
Testing
02278b5
)Also, see an example issue or this one.
Notes
Some considerations around installing
sentry-sdk
andpip
:If the user has these two, this entire thing is a no-op. If the user has
pip
, but nosentry-sdk
package, this will not mess up their modules locally, they will still be able to install other versions etc. If the user doesn't havepip
norsentry-sdk
, this again won't inconvenience their packages locally, as they probably weren't using those developer tools either way.Overall, this does seem like a low-risk way to do things, it's been a sort of recommended way to install additional packages for QGIS plugins, and in good chunk of cases, this probably just becomes a no-op either way.