[Qt-creator] Dealing with python projects

Cristián Maureira-Fredes Cristian.Maureira-Fredes at qt.io
Thu Apr 25 11:05:10 CEST 2019


On 4/25/19 1:18 AM, Christian Gagneraud wrote:
> On Thu, 25 Apr 2019 at 04:29, Jason H <jhihn at gmx.com> wrote:
>>
>> Check out this thread: https://lists.qt-project.org/pipermail/qt-creator/2019-March/007865.html
> Thanks, missed that one.
> 
>> I also requested documentation on .pyproject and why a standard python project format was not used.
> Do you know a "standard python project" format?

AFAIK the closer "Python project file" accepted by the community is the
one introduced by PEP-518 https://www.python.org/dev/peps/pep-0518/
I have been playing around with .toml files, but I don't know if that
feature will be included in QtCreator soon.

The main motivation behind .pyproject was that .pyqtc was a too limited.

.pyqtc files are plain text files that contains one filename per line,
which is too limited if we want to extend and include other options like
separating .ui, .qrc, and .qml files, or specifying python version or
interpreter.

$ cat x.pyqtc
a.py
b.py
c.py

.pyproject files aims to have at least the infrastructure to extend it.
At the moment it's a json file with only one valid entry, "files",
which serves the same purpose than the old file format, because you need
to assign a list of filenames.

$ cat x.pyproject
{
     "files": ["a.py", "b.py", "c.py"]
}


>> I think it isn't meant to be a proper python IDE, just one good enough for PySide. Which is a shame.
> That's IMHO a good start. I hope we'll have support for debugging
> soon. As well - might be dreaming -, maybe the class and include
> hierarchies will work someday. I'm not familiar with the language
> server thing, but hopefully the work can be done there, and creator
> just need to query it.
I'm not too experienced with LSP neither, but I agree that those
are good ideas.

> 
> I had a quick look at Visual code documentation [1], they support
> choosing your interpreter (inc. from your venv), debugging, ...
> But it seems to require you to write "supporting" JSON files.

At the moment you can change the interpreter in QtCreator
in the Run Configuration, but we are working on a nicer selection
process, and maybe some auto-detection.

> And BTW, about my static analyser thing (pycodestyle, flake8), it is
> very likely coming from the language server, creator "just" display
> the issues reported by pyls.

IMHO QtCreator needs to provide an option to select between flake8,
black, and yapf, but at the moment it's just flake8.

> And I think that using Qbs to manage a python project has some
> interesting potential for now

Agree, but it's just a matter of spending some time working on it :/

> Chris
> [1] https://code.visualstudio.com/docs/python/python-tutorial


Thanks for your feedback Chris, and Jason,
hopefully you can help QtCreator to improve on the Python support.
I will be more than happy to review your patches.

Cheers


-- 
Dr. Cristian Maureira-Fredes
Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
--


More information about the Qt-creator mailing list