[Qt-creator] PythonEditor

Sergey Shambir sergey.shambir.auto at gmail.com
Wed Jan 16 18:15:50 CET 2013


Hello everybody out there using QtCreator,

I've sent simplest PythonEditor plugin to review 2 days ago and now want 
to discuss some long term plans, as hjk asked. Should be mentioned that 
python support was asked many times by community members, someone from 
Nokia tried to write editor and project manager in 2010, Mort Yao 
proposed it to GSOC 2012 and so on.

PythonEditor just overrides generic highlighter and indenter, adds file 
wizard (class wizard will be added soon). It also simple & commented 
with doxygen and can be educational example like HelloWorld plugin.

To declare python support as one of QtCreator features, plugin also must 
have code model and project manager which keeps settings like pyside 
installation, python version, files list. It is good challenge for 2013. 
Current PythonEditor is _just_ plugin example for new QtCreator hackers 
and starting point for further experiments, nothing more.

I tried to create code model in April, 2012, but failed: i'm not 
experienced developer, too young to be software architect and drowned in 
problems. Than i postponed this task and started filling gaps in 
education: made QLALR based python parser, written patches to QtCreator, 
finally joined to ClangCodeModel development (bugfixing). Now i'm ready 
to collect all code written in 2012 and publish python code model, in 
February. After publishing, anyone can take participant in development. 
It will include abstract interface, which should keep glue code small as 
in ClangCodeModel plugin, qlalr parser, AST and code generator (based on 
clang library) which creates AST stuff from .h file with nodes declarations.
Ideally, i want create something like clang libraries for python and 
ready to improve & maintain it over years, but don't want hurry.

Another key point is project manager for running projects on pure python.
1. I have proof-of-concept manager here: 
https://qt.gitorious.org/~sergey-shambir/qt-creator/qt-creator-py-reborn
2. However, it preferable to use project format from existing python 
IDE. QtCreator not depend on any build system, all things can be done 
using existing ProjectExplorer plugin API. VCProjectManager plugins can 
be used as reference implementation, thanks to Bojan Petrovic and 
Radovan Zivkovic for this excelent work: 
https://qt.gitorious.org/qt-creator/qt-creator/trees/wip/vcproj/src/plugins/vcprojectmanager
3. How do you think, which project format is preferable? Ecplise + PyDev 
is advanced and popular python IDE (and *.pydev is XML format), but Erik 
IDE already have place to keep settings especially for PySide and PyQt4.

Anyone can start work on alien project manager right now, and i will be 
glad to help with some questions about ProjectExplorer using & hacking.
Anyone can start collecting papers and interesting ideas about: type 
inference, LALR parsers error recovery, control flow graphs.
In February, anyone can join to development of python code model.
And when these two key projects will be mostly done, we can invite 
community to take participant in development of full-featured python 
support.

Useful materials:
1. Type inference in javascript: see rfrn.org/~shu/drafts/ti.pdf
2. wip/clang branch: just build it from sources and enjoy precise 
diagnostic without need to press "Build": 
http://qt-project.org/wiki/Branches



More information about the Qt-creator mailing list