[Qt-creator] Dealing with python projects
chgans at gmail.com
Thu Apr 25 14:01:18 CEST 2019
On Thu, 25 Apr 2019 at 21:05, Cristián Maureira-Fredes
<Cristian.Maureira-Fredes at qt.io> wrote:
> 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.
I'm not familiar with that PEP, but it seems to be related to
packaging/deployment, not source, tests, execution, format/style, ...
> > I had a quick look at Visual code documentation , 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.
Interesting, it's only available for "Qt for python projects" (aka
May I suggest the idea that it should be part of
"Tools->Options...->Python", and be customisable in "project mode ->
That would be IMHO more powerful. But might require lot of work....
The risk with the current approach is to put all python related stuff
into a god module that dictates everything.
That would be better to make the python language a first-class citizen
first. And make sure it can deal with project specific virtualenv.
/me dreaming again
> > 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.
Not sure. Maybe users could decide of their configuration if QtC fully
I can fully control my python language server via requirements.txt and
setup.cfg (inc. flake vs black vs yapf).
But wait! There's more! :)
McCabe, Rope, ... QtC cannot catch-up with this fast moving system,
better let the user decide what he/she wants.
If only i could teach QtC to "load" all the python-related settings
from my venv+pip+setup.cfg...
I think it would be a mistake to lead users into thinking that with
QtC there's no need to use virtualenv.
Even for a pyside project, virtualenv should be made mandatory. it's
IMHO a question of good practice (and sanity)
> > 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 :/
I've been playing around this afternoon, and one of the main issue is
that Qbs was designed for compiled languages.
For a moment i thought about making Qbs understand python bytecode compilation.
I think that this source/build/install paradigm is both a strength and
a weakness when it comes to a python project.
It's all about how much integration you can make.
In python, build = make a package (eg, setup.py) and install means
install that package along dependencies (venv/pip), so the concept
still apply at the macro level.
> > Chris
> >  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.
The python project i'm working on has already dragged me into adding a
new feature to clazy, i can't afford to get dragged into QtC and/or
Qbs. Never say never tho.
More information about the Qt-creator