-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support grass algorithms in profile folder #53246
Conversation
I have tried to implement this as simply as possible; not sure what someone more competent would think.
But I guess the big question is whether |
Looking at current implementation, it seems that user defined description will be added first then shipped desc and override user one ?
|
I believe this is correctly handled by qgsprocessingprovider.cpp Do you want an additional check anyway? |
When I say "override" I mean "are loaded in preference to". |
spec = importlib.util.spec_from_file_location('grassprovider.ext.' + name, extpath) | ||
self.module = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(self.module) | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid the broad exception here and catch specific ones instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any advice on what to catch, given that we're loading code written by the user?
- Maybe we just need to be more informative?:
except Exception as e:
QgsMessageLog.logMessage(self.tr('Failed to load: {0}\n{1}').format(extpath, str(e)), 'Processing', Qgis.Critical)
pass
- Are you happy with
pass
rather thanraise e
? This means if someone has written a working algorithm description, in most cases it will be useable even if they are struggling with getting an ext module module they're writing to work. - Should Qgis.Critical be downgraded? With the current pull request we get a Qgis.Critical
Could not open GRASS GIS 7 algorithm:
, with the exception, so I presume we should stick with Qgis.Critical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with a QgsMessage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added that to the pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did wonder if we should add something like this, but it didn't seem right when we don't show a message even when we fail to load an algorithm:
iface.messageBar().pushMessage("Warning", "GRASS algorithm " + self.name() + " failed to load ext module - see Processing log messages", 1)
Co-authored-by: Nicolas Godet <[email protected]>
Co-authored-by: Nicolas Godet <[email protected]>
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Bumping to stop the bot killing us. |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Bumping again to stay alive. |
Description
Allow users to create algorithm descriptions in
[QGIS profile folder]/processing/grassaddons/description
.An addon shipped with QGIS can also be overridden by creating a modified version here.
The ext mechanism is supported at
[QGIS profile folder]/processing/grassaddons/ext
.This follows on from #53049, to implement #53048.