A rich python console and more in Kate editor

I have done some improvements in the plugins: python_console_ipython, python_autocomplete, python_utils, js_utils, xml_pretty and django_utils. These plugins I added a month and a half ago (except python_console_ipython) to the kate repository. I have done two improvements and a new feature:

  • Now they work with Python2 and Python3 (except python_autocomplete, this only works with Python2, due pysmell dependence)
  • Now they have a configuration page (except python_autocomplete, this should not have configuration parameters)

Page Config Plugins

The new feature is the integration of the python_autocomplete and python_console_ipython plugins with the project plugin. The behaviour of these plugins depends of the loaded project. That is to say, the python_autocomplete plugin autocompletes with our project modules. Currently the kate community is working to add a new python autocomplete  using jedi (this will work with Python2 and Python3).

Python Autocomplete (with our modules)

And the python_console_ipython plugin has something that we can name the project console. A ipython shell with the python path of our project and with the environments variables that the project plugin needs.

IPython Console (converted in a django shell)

To use this we need to add in the project file (.kateproject) a new attribute named “python”, with this structure:

 {
  "name": "MyProject",
  "files": [ { "git": 1 } ],
  "python": {
        "extraPath": ["/python/path/1",
                      "/python/path/2",
                      "/python/path/n"
        ],
        "environs": {"key": "value"},
        "version": "3.2"
    }
 }

I am a django developer, as we say in Django we can come to have a django shell (python manage.py shell) integrated in our editor. But this feature is a generic feature not tied to Django. This feature can be used by other Python developers. I have added only a specific feature to the django developers. If we set in the project file (.kateproject) the attribute projectType with the value Django, the ipython shell automatically loads the models and the settings like a shell_plus does.

  {
   "name": "MyProject",
   "files": [ { "hg": 1 } ],
   "python": {
        "extraPath": ["/python/path/1",
                      "/python/path/2",
                      "/python/path/n"
        ],
        "environs": {"DJANGO_SETTINGS_MODULE": "myproject.settings"},
        "version": "2.7.3",
        "projectType": "django"
    }
  }

I hope you like it :-)

19 thoughts on “A rich python console and more in Kate editor”

      1. What release? Even though these features are very cool and useful I would appreciate if you added some information as to when a normal user can see these in action. Will these feature make it to 4.11?

  1. I have the latest Kate in Arch Linux:

    $ pacman -Q kdesdk-kate
    kdesdk-kate 4.11.0-1
    $ kate -v
    Qt: 4.8.5
    KDE Development Platform: 4.11.00
    Kate: 3.11.0

    and I wanted to try these plugins, but when I check “Pate engine could not be initialised”, and then the Python Plugins tab only shows “ERROR: The Python engine could not be initialised”. Do I have to install something else? Am I doing something wrong?

      1. Well, the library PyKDE4 was missing from my system, so I installed the relevant package (kdebindings-python on Arch Linux) but now Kate segfaults when I check the option:

        kate(3398)/kdecore (KLibrary) kde4Factory: The library “/usr/lib/kde4/katepateplugin.so” does not offer a qt_plugin_instance function.
        KCrash: Application ‘kate’ crashing…

        I have the traceback thanks to the KDE crash handler though…

Leave a Reply