Porting Python 3 to the QL

Tell us about your other hobbies & none QL related items here :)
Post Reply
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Porting Python 3 to the QL

Post 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.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
tofro
Font of All Knowledge
Posts: 2688
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Porting Python 3 to the QL

Post 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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Porting Python 3 to the QL

Post 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.


Regards,

Derek
User avatar
Artificer
Brittle Membrane
Posts: 120
Joined: Fri Nov 24, 2017 8:43 am

Re: Porting Python 3 to the QL

Post 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


Post Reply