[Qgis-user] plugin standards ;)
Borys Jurgiel
borys at wolf.most.org.pl
Wed Dec 3 05:57:18 PST 2008
Wednesday 03 of December 2008 13:08:43 Maurício de Paulo napisał(a):
> And thanks Borys for the tips on the standards. I'm still not used to the
> new standards (not even the older ones). Is there any place where I can
> read the updated standards?
In fact, they aren't frozen yet ;-) For months I'm going to sit down and write
the (sub)chapter for User Guide, but still I'm busy. So in short:
1. THE MOST ESSENTIAL rule: zip file name and contained plugin directory name
are used as a plugin ID, so _they_has_to_be_identical_!
**********************************************************************
* plugin ID == module name == plugin dir name == zip file basename *
**********************************************************************
In other case Installer has no posibility to interrelate instaled plugin with
its instance abvailable in repositories.
2. plugin version in __init__.py has to match its declaration in repository
metadata - in other case Installer can't state if the plugin is upgradeable.
3. __init__.py should contain the following methods:
def name():
def version():
def description():
def qgisMinimumVersion(): [required for qgis > preview2; returned string has
to be in form '1.0.0']
def authorName(): [optional]
def homepage(): [optional]
def classFactory(iface):
4. If repository supports <qgis_minimum_version> tag, Installer displays only
plugins which meet this condition.
5. If given plugin is installed in both system location (so comes with Qgis
package) and user location (so is installed by Installer), the 'user'
instance always mask the 'system' one. Regardless of version numbers!
6. There may be two or more instances of given plugin (I mean with the same
ID, for example qgsAffine) in repositories (it doesn't matter if the
instances are all in one repository or not). In such case Installer always
chooses the highest version. Of course if <qgis_minimum_version> tag is set,
Installer considers only plugins meeting this condition.
So newer plugin always masks its older instances, until it's 'too new'. As a
result, the best strategy is to keep one plugin ID for all qgis versions and
Installer will automatically follow QGIS updates and choose the best
available plugin version:
qgsAffine ver. 0.1 for qgis at least 0.10
qgsAffine ver. 0.2 for qgis at least 1.0.0-preview1
qgsAffine ver. 0.3 for qgis at least 1.0.0-preview2
etc...
You only have to remember to always assign higher version for higher api.
Unfortunately, present Official Repo doesn't support <qgis_minimum_version>
tag yet (the final for 1.0 will do). Official repo doesn't support also
multiple plugin instances (however it's still possible to put second instance
to another repository). So your way to create two separate plugin ID:
findbyattr and findbyattr_peview2 is a 'necessary evil' to work around those
limits. It's disadvantage is that Installer won't automatically update
findbyattr_peview2 to another ID when QGIS 1.0 will be released.
I don't know if I was clear, so feel free to request any clarifications ;)
Regards,
B.
More information about the Qgis-user
mailing list