Running JOSM with support for plugins written in Python
In order to run plugins written in Python, a Jython jar has to be on the classpath at startup time.
Here's how to start JOSM:
jython.jar isn't included in the scripting plugin. The scripting plugin can download
it for you, just go to Scripting -> Configure..., or you can download it manually.
Configuring Python support
Select Scripting -> Configure ...
Select the tab "Configure script engines and scripts"
Select the tab "jython engine"
In the preferences you can configure
sys paths, i.e. directories and jar files where jython is looking for Python packages, modules, and classes
plugins, the names of Python plugins which shall be loaded at startup time
Writing a Python Plugin
Here's a simple example of a Python plugin for JOSM.
The plugin must inherit from
Deploying a Python Plugin
as source files
If you have plugin class MyPythonPlugin in the source file my_plugin.py then
make sure the parent directory of my_plugin.py is on the sys paths (how?)
make sure you add the plugin name my_plugin.MyPythonPlugin to the list of plugins (how?)
as jar file
You can create a jar file which includes the python source files required for a plugin.
If you have a plugin class MyPythonPlugin in the source file my_plugin.py, you can create a jar archive as follows:
Here's a typical layout of a jar for a Python plugin:
To configure a plugin deployed in a jar file
make sure the jar file my_plugin.jar is on the sys paths (how?)
make sure you add the plugin name my_plugin.MyPythonPluginy to the list of plugins (how?)