[Development] [EXTERNAL EMAIL] Re: Repository request: playground/qtscrypt

Mark De Wit mark.dewit at iesve.com
Thu Sep 1 17:37:13 CEST 2022

This sounds like QPyBind11 to me?


-----Original Message-----
From: Development <development-bounces at qt-project.org> On Behalf Of Cristián Maureira-Fredes
Sent: 31 August 2022 23:33
To: development at qt-project.org
Subject: [EXTERNAL EMAIL] Re: [Development] Repository request: playground/qtscrypt

On 8/31/22 21:33, Konrad Rosenbaum wrote:
> Hi,
> On 31/08/2022 20:57, Cristián Maureira-Fredes wrote:
>> On 8/31/22 19:19, Aleix Pol wrote:
>>> On Wed, Aug 31, 2022 at 4:47 PM Cristián Maureira-Fredes 
>>> <Cristian.Maureira-Fredes at qt.io> wrote:
>>>> Hey there,
>>>> I would like to request a new repository on 
>>>> codereview.qt-project.org
>>>> Name and description: qtscrypt - Script C++ with Python Responsible 
>>>> person: Cristián Maureira-Fredes
>>>> (Cristian.Maureira-Fredes at qt.io)
>>>> Desired repository name: playground/qtscrypt URL of existing code: 
>>>> https://git.qt.io/crmaurei/qtscrypt
>>>> Thanks
>>> Won't this be confusing? We have had QtScript for the longest time 
>>> and it looks like a typo.
>> thanks for the comments.
>> I was under the impression that changing the 'i' for a 'y'
>> from P'y'thon was not confusing, because it was already mentioned in 
>> a couple of talks and nobody mentioned anything against it.
> Even more fun: scrypt is the name of a password encryption algorithm 
> and the corresponding library.
>> I wanted to avoid qtscript-python because it's not really qtscript, 
>> it's just the main idea from it.
>> Do you have any other name suggestion?
>> (I really struggled with finding a name)
> QtPython

Hey Konrad,
too close to 'Qt for Python' IMHO

> QtPythonScripting

Could be! even if it's a longer name, it's more descriptive.

> QtPythonAPI

Not really a Python API,

>  > QtYetAnotherPythonBinding

Jokes aside, I think there is a project
called "PyAnotherSide" :)

> QtNowForSomethingCompletelyDifferent
> QtBrightSide

Probable copyright issues with the band "The Killers"

> QtHesTheMessiah
> (SCNR)
> Sorry for having completely missed the ball here, but what makes this 
> new Python binding worthwhile when there's already PyQt, Qt-for-Python 
> and PySide?

This idea, as you can see in the code
is to run Python code within C++ code,
quite different from the bindings, but hey, maybe an example is more clear.

With QtScrypt (Following the idea of the old QtScript module)

You can have C++ code, and at some point that evaluates Python code and get some result back, say:

QScryptEngine e;
qDebug() << "something, something" << e.evaluate("[i for i in range(10)]");

and you can get a QVariantList with the numerical values, same idea with a Python function, like:

# your_file.py
def power_of_two(x):
     return x**2

you can call it from C++ like

QScryptModule mod("your_file.py")
QScryptFunction f("power_of_two", &mod);
qDebug() << "power_of_two(4): " << f.call(4); // you get 16 as a QVariant

So now,
PyQt and PySide
provide bindings Python for the Qt API,
like having:

button = QPushButton("press me!")

on Python files.

> Hopefully it's not a QtDeadParrot, I'd prefer a QtHolyGrail... :-P
> [I'll see myself out now and do something useful instead, sorry.]

No worries, it's useful to ask things are are unknown to ourselves :)

So, as the original email states, this is for a 'playground' repository, because I was literally playing with this idea on a Hackathon, and after presenting it in some talks in Qt conferences/workshops, some folks thought it was something interesting to play with.

>      Konrad


Dr. Cristián Maureira-Fredes
Senior R&D Manager

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
Development mailing list
Development at qt-project.org

More information about the Development mailing list