Do you think you can put up the development libraries (.lib) and includes for the python you're using to build PythonScript? I realize I can easily build Python on my own - the issue is that if I write a Notepad++ plugin that relies on calling PythonScript, and I want to include some Python C-Extensions, depending on what particular distribution I use, it may not be compatible with the Python dll included with PythonScript, and therefore would not run for other people.
Sure - I'll upload them probably over the weekend - I've got limited time until then.
The main issue is that the python27.dll (and compiled modules) that are bundled with python script are compiled with /MT. There's some changes to some python modules in order for that to work (they're available on my python git repo on github - github.com/davegb3/python). Therefore, any Python C-Extensions must also be compiled with /MT.
What's the plugin? Sounds intriging!
There's a couple of things I'd like to try, actually. Depending on how much time I have in the next few weeks, I'm going to try to wrap a bit more of the Notepad++ plugin interfaces with Python, such as the DockingDlgInterface and StaticDialog. To do that, I'll have to wrap some Win32 ui parts, of course, but that shouldn't be too much of an issue. If I come up with anything useful on that end, I'll most likely propose it at the github page, rather than releasing it as an additional plugin. (Worst comes to worst, I can always build some of the PyWin32 extensions against PythonScript's library and integrate a GUI through that)
I may also see what I can do about putting together a packaging system for PythonScript to allow packaging a script and any modules written for it into a single zip file. (To maximize performance on this end, I'd most likely use the zlib module or czipfile module) I realize the user site folder seems to be located at AppData/Notepad++/plugins/PythonScript/lib, so I may just write a quick helper function to install any necessary dependencies/modules there and provide a way for developers to automatically register their events into the startup script. (Possibly with a prompt, if you feel that it's too much of a security risk)
Besides that, there's some general improvements I'd like to make to Notepad++ to make it a bit more context-sensitive that I just don't have the time to write out in C++. (Especially with how rusty my C++ has gotten)
I've reimplemented a lot of the functionality in my language auto-detection script: https://sourceforge.net/projects/npppythonscript/forums/forum/1199074/topic/4736847, and I've been improving on it off and on over the last few weeks. Additionally, I'm looking into writing up a framework to specify how Notepad++ treats certain files. (For instance, when opening or creating a Shell Script, automatically convert line endings to Unix if they're not currently) Gets a little annoying when I'm deploying a shell script onto one of my development servers, I realize it won't run until I fix the line-endings. Another thing that drives me nuts is the indentations of scripts/source files. I'm well aware that the Python Standard is 4 spaces, but I really cant stand using anything but tabs. I understand, however, that some feel the same way about spaces. A feature I would like to try to integrate is a mechanism so that when a user opens a file that doesn't meet the indentation specified in their preferences, Notepad++ will automatically figure out the current indentation being used, remember it, and then convert it to the user's preference. When the user then saves that file, it reapplys the previous indentation. (Which would be a real timesaver for me when I'm trying to contribute to a project that has a defined code style that doesn't match mine)
There's also the matter of hotkeys. I'd love to use the many hotkeys provided by Notepad++, but I don't know half of them, and I can't be bothered trying to set new ones, only because Notepad++ will not warn you if a hotkey is already being used - it'll just fail silently when you attempt to use it. In my opinion, a simple dialog that allows you to search the currently assigned hotkeys would be a huge improvement.
Finally, there's a few existing Python C-Extensions that I'd like to try integrating into the Notepad++ environment, just to see how they fair. More lightweight modules like Xapian, SimpleJSON/UJSON (with the C-Speedups), or Greenlet (Though it may not work with the current python distribution in PythonScript) might work well in the current environment. I may also try utilizing the lxml module, only because it's the best Python module I've found for working with XML. (I was also looking at SQLAlchemy for integrating some sort of Database Manager into Notepad++, but I think it may too bulky of an install. We'll see)
But yeah, I appreciate the quick response, and thanks for the awesome plugin.
Just noticed that I forgot the second half of one of my sentences. When I was talking about "reimplementing a lot of the functionality of my script", I meant to say, "in Cython".
Sorry to triple post, but I wanted to mention something you might find interesting. I've been playing with this Python for .NET project, (Not IronPython, but .NET from CPython - http://sourceforge.net/projects/npppythonscript/forums/forum/1188886/topic/4768153) and I managed to load a form from a .NET assembly (into a background thread, therefore allowing me to continue in an interactive console). I was then able to dynamically bind event handlers in the form to python methods I defined in the console. All in all, a cool toy.
It did, however, occur to me, that if I can get the module loaded into the context of PythonScript's interpreter, I could theoretically control any .NET-based plugins currently loaded into Notepad++. (This is assuming that .NET returns the current instance of that assembly when I attempt to load it. Haven't explored the inner workings of .NET much, so I can't say for sure.) First attempt caused Notepad++ to close without any exception, which is when I remembered that I had built the module against python27, and I was using a custom python DLL I built for playing around with Notepad++. (Same thing, just different name for the binaries and .lib files) So, I rebuilt Python.NET against the current binary I'm using, and this time I received a standard, "Dynamic module failed to initialize". On checking the dll's currently loaded into Notepad++, I found that all the necessary DLLs for Python.NET to function seemed to be loaded into the context correctly, which leads me to think it may be that the module is having trouble finding the site module, for some reason.
Anyways, you seemed pretty knowledgeable about Python, so I was wondering if you had any ideas.
My python knowledge is strictly limited! I presume the link you meant was http://pythonnet.sourceforge.net/, and not a link back to this post :)
I think it depends how the CLR is started. I'm kinda assuming that they use a new AppDomain, hence you'd only get communication with N++ .NET plugins via MarshalByRefObject and inter-AppDomain serialisation (doable, but if you need to throw reflection in there too, it's a *world* of pain). As the chance of any plugin being a MarshalByRefObject is approximately nil, I don't rate your chances.
However, I don't see any reason why the module shouldn't work, but you'd probably have to go with a standard python27.dll/.lib, linked with /MT. Without diving into the .NET for Python code, I couldn't be sure.
Could you build a debug version of Python .NET and attach to python itself before the module is init'ed. What does depends.exe say about the Python .NET extension?
I've uploaded the libraries, I think - you'll have to confirm they're the right ones (in a directory calls DevLibs on the SF site).
Good luck - your plugin stuff sounds awesome, really looking forward to seeing that. And if you get .NET going too, well…. :D
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.