Menu

Embedding PythonQt for plugin APIs - a couple of general questions

Help
Max
2019-05-26
2019-05-26
  • Max

    Max - 2019-05-26

    Hello, and first of all - thanks for this great project!

    I am developing an app using C++/Qt5, and thought about the possibility of third-party plugins by exposing Python APIs (similar to, e.g., as done in Sublime Text editor, although it is not based on Qt). Hence, I found that PythonQt might be exactly what I need.

    I've downloaded PythonQt and managed to compile/run examples, which look promising to me. However, there are some points which are not obvious from your documentation (at least to a person like me who is not yet well acquainted with the Python-side of the story). I would apprecaite even brief answers, just to understand if I should spend time on digging further into PythonQt (and Python in general), or instead I should look into alternative solutions like embedding Lua scripts.

    1) Suppose I build my app and link it with PythonQt. Will users of my app have to install Python, or will distributing PythonQt libraries together with my app suffice? (Again, I refer to Sulime Text, which has its own interpreter independent of system's Python.)

    2) If no Python installation is required on users' part, how does PythonQt manages non-standrad Python modules? Suppose, a third party decides to develop a plugin for my app, and wants to use some non-standard Python module which normally would be installed using, e.g., pip. Would it be possible to "install" it for the embedded PythonQt?

     
  • Florian Link

    Florian Link - 2019-05-26

    Typically you will need to distribute the Python dll(s) and standard libraries together with your application, so that you have your own deployment of Python with your application. There will be a site-packages directory in the libs folder and users can install external Python libs using pip into your deployed Python installation.
    I would recommend copying the parts the you need from a standard Python installation into your application folder before building the installer.
    Python does not work without some essential standard library files, so just deploying PythonQt and the Python dll will not work.

     
  • Max

    Max - 2019-05-26

    Ok, thank you. Distributing standard library and Python dll is ok for me, so I'll take up attempting to embed Python into my app with PythonQt.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.