General Information About Sikuli Extensions¶
This feature is currently under developement and might only be available on request.
Extensions allow to implement new Sikuli features by adding packages to your current Sikuli installation.
They are maintained by the developers (see Technical Details below).
If you want to contribute a new extension or a modified exisiting one, please look at How to contribute an extension below.
How to Download and use an Extension¶
The download of an extension is supported by the IDE through the menu. You get a popup, that lists the available and already installed extensions and allows to download new packages or updates for installed ones.
This popup shows a new package not yet installed:
If you need more information about the features of the extension, just click More Info - this will open the related documentation from the web in a browser window.
If you want to install the extension, just click the Install... button. The package will be downloaded and added to your extensions repository.
This popup shows an installed package:
If a new version would be available at that time, the Install... button would be active again, showing the new version number. Now you could click and download the new version.
How to Use an Extension
To use the features of an installed extension in one of your scripts, just say
from extension-name import *. For an usage example read Sikuli Guide.
For information about features, usage and API use menuin the IDE.
Extensions are Java JAR files containing some Java classes (usually the core functions) and/or Python modules, which define the API to be used in a script.
Sikuli maintains a local extensions directory, where downloaded extensions are stored together with a hidden list of the installed extensions (Windows:
~/Library/Application Support/Sikuli/extensions, Linux:
Once an extension is imported using
Sikuli automatically searches and loads the JAR file of that extension
into the current context with
How to develop an extension¶
The source structure of an extension named
extension-name looks like this:
Java - org/com -- your-organization-or-company --- extension-name ---- yourClass1.java ---- yourClass2.java ---- .... more classes python - extension-name -- __init__.py -- extension-name.py
The final structure of a JAR (filename
extension-name-X.Y where X.Y is the version string) looks like this:
org/com - your-organization-or-company -- extension-name --- yourClass1.class --- yourClass2.class --- .... more classes extension-name - __init__.py - extension-name.py META-INF - MANIFEST.MF
__init__.py contains at least
from extension-name import * to avoid one qualification level. So in a script you might either use:
import extension-name extension-name.functionXYZ()
from extension-name import * functionXYZ()
The second case requires more investement in a naming convention, that avoids naming conflicts.
extension-name.py contains the classes and methods, that represent the API, that one might use in a Sikuli script.
As an example you may take the source of the extension Sikuli Guide.
Name your extensions properly¶
Sikuli extensions can be Python/Jython modules or Java classes.
For Java classes, following the reverse URL convention of Java is a good idea (for example, org.foo.your-extension). However, DO NOT use Java’s convention for Python/Jython modules. You need to come up with a unique extension name that does not conflict with existing Python modules and other Sikuli extensions.
Please read Naming Python Modules and Packages to learn the details for naming a Python module.
How to test your extension¶
While developing your extensions, you can put the JAR file in Sikuli’s
extension directory or in the same .sikuli folder as your test script.
The JAR file should not have a version number in its file name,
Because Sikuli starts to search extensions in the .sikuli folder of the running script and then
in the Sikuli extensions folder, it is usually a good idea to put your
developing extensions in the .sikuli folder of your test script.
Another option is to use the
load() function with
an absolute path to your
extension-name.jar. If this fails, Sikuli
goes on searching in the current .sikuli folder and then in the Sikuli extensions folder.
If load() succeeds, it returns
True and puts
so you can use
import extension-name afterwards.
How to contribute your extension¶
Currently you have to contact the developers of Sikuli and agree on how to proceed.