Python Plugin Development
I’ve got some questions:
- Is it possible to develop a plugin with Python?
- Can I allow my plugin to highlight syntax of something that doesn’t currently have syntax highlighting by default?
- Any resources?
I can’t seem to find any resources for plugin development resources, if you know of any good resources for a beginner plugin developer, then please respond with one.
Sorry if this is in the wrong category, or an answer is available (I can’t seem to find any), I’ve just joined this forum right now.
Yes but no.
Pure python, no, as a plugin needs to be a standard windows dll
but together with cython and a little hack you can make this work.
But there is an alternative which is called PythonScript plugin.
This plugin allows you to use python to manipulate the scinitlla control.
If you install this plugin you get example scripts which shows you
what you can do with it.
A few of them have a name like …Lexer.py, those are the ones you are looking for.
Oh ok thanks, so it is possible but not alone, I saw your specific tutorial from June 2019 one and a half hours ago, but are there are any sources or anything, or do I just read the normal plugin resources and transfer the way they’re written to how in Python (or Cython if needed)?
I do not know any documentation/tutorial about creating npp plugins with python.
I would recommend reading https://npp-user-manual.org/docs/plugins/#how-to-develop-a-plugin
and sources of existing plugins to understand their interaction.
To create a plugin you need to create a dll.
Afaik this can be done using either
- cffi and maybe
- Nuitka (never tested by me)
Using cython has the advantage that no additional modules are needed at runtime.
If you are using CFFI on the other hand, it needs to be available at runtime.
I tested both, more or less proof of concept only, and the resulting dll could be loaded and the coded scripts could be executed.
I need to check my source - they should be still laying around somewhere.
Let me see if I can bundle them to a basic package you can us as a starting point.