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

2022-09-02 Thread Cristián Maureira-Fredes



On 9/1/22 17:37, Mark De Wit wrote:

This sounds like QPyBind11 to me?


Hey Mark,

Not really,
pybind11 is a binding generation system
like the one used for the Qt for Python
project, Shiboken.

The idea of PyBind11 (and Shiboken)
is to expose C++ API to Python users,
meaning that you end up writing a Python script
using modules that originate in C++.

The idea of this project,
as stated in the previous messages,
is to have Python code (as a string)
within your C++ code.

No binding is generated, no wrapper,
is just a usage of the Python interpreter
C-API within C++.


Mark


[snip]


Cheers!

--
Dr. Cristián Maureira-Fredes
Senior R 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@qt-project.org
https://lists.qt-project.org/listinfo/development


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

2022-09-01 Thread Mark De Wit
This sounds like QPyBind11 to me?

Mark

-Original Message-
From: Development  On Behalf Of Cristián 
Maureira-Fredes
Sent: 31 August 2022 23:33
To: development@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 
>>>  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-fre...@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", );
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!")
button.clicked.connect(some_slot)

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


Cheers

--
Dr. Cristián Maureira-Fredes
Senior R 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@qt-project.org
https://lists.qt-project.org/listinfo/development
___
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development