Page 1 of 1

Porting Python 3 to the QL

Posted: Wed Apr 15, 2020 8:03 am
by NormanDunbar
Morning ql_freak,

Continued from viewtopic.php?f=9&t=3231 as the subject isn't related to the content!

porting Python 3 to the QL will most likely not be possible. I looked into it a while back. Even porting 2.7 or any of the 2.x versions, as far as I remember, will not be possible because there is "something" that is needed to do the port, that the QL doesn't have. It's Python! Much of the Python build nowadays is built with Python - if I remember correctly.

I think the oldest versions were written in plain C, which might have ported, but those are not available now (and are too out of date) so it's a non starter. :(

If I have time during a coffee break today, I'm still working - apparently, I'm essential - I'll see if I can flesh out the ramblings above with some facts. Otherwise I'm about as useful as Donald Trump. (Who by the way, is not circumcised. He's a complete prick! :D :D :D )


Cheers,
Norm.

Re: Porting Python 3 to the QL

Posted: Wed Apr 15, 2020 8:26 am
by tofro
Norman,

there's µPython, an implementation for microcontrollers, which is fully written in C, optimized for "constrained environments" (that sounds familiar...) and would be a good candidate for a port if someone invested the time.

Tobias

and: don't - ever - compare yourself with DT - That's the start of a very serious inferiority complex :D

Re: Porting Python 3 to the QL

Posted: Wed Apr 15, 2020 10:45 am
by Derek_Stewart
Hi,

I downloaded the current stable version, Python 3.7.7

I compiled the source on my Linux laptop, which compiled okay and installed it to my system.

I looked at the source code to Python 3.7.7 which looks like C source code to me and referring to the Python Developers documentation, in the section pertaining to porting to another operating system. The test indicates that the makefile is required to be changed to suit the target operating system.

So I think Python is portable with C68, just needs the makefile and configuration files ammended to suit the QL.

This sounds easy, but I have been struggling with this for a while. Looks like back to studying the MAKE documentation.

Maybe another idea would be write a Python library to run Superbasic files in Python.

Re: Porting Python 3 to the QL

Posted: Sat Apr 18, 2020 2:56 pm
by Artificer
Hi,

I like Python and have found it easy to use on the RPi - I used it to create a python script to input files via the serial port from my QL system and pass them to CUPs for printing.

At the moment I can print text files and html files directly from the QL to the printer via the RPi and CUPS. What I found when writing the script is that Python often needs bespoke libraries imported for the interpreter in many scripts so developing a python interpreter for the Q68 could involve the creation of equivalent smsq/e libraries to run many of the scripts that exist out there.

I think that there would be an immense amount of support work to maintain a Q68 python implementation capable of making use of available python scripts.

So to get away from the negative I could see that it might be possible to create a conversion program that converts superbasic to Python to run QL programs natively on other systems a bit like CPORT

Cheers