Python 2 or Python 3 for Octoprint


#1

Gina,
Just curious whether you moved to Python 3 for development. I've been a Patreon for a while now but don't always get a chance to watch the videos so it's something you may have already mentioned.
John


#2

No, I haven't yet. It's something still on the neverending Todo list.

I'm aware though that time is running out :wink:

The plan is to go for Python 3 compatibility for 1.4.0. Dropping Python 2 support and going Python 3 exclusive (asyncio :heart_eyes:) will probably make some plugins break severely so needs a bit of an overlap for people to adjust.


#3

I ask because I'm playing around with the 2.8" display for the Pi. Current support for a user image screen isn't adequate so I'm looking at doing it differently. To make a simple graphical status screen and user input screen. I tend to still use Python2 but perhaps should just concentrate on Python3.

Just thinking at the moment. Nothing concrete.


#4

Do you plan to do that as an OctoPrint plugin or as a standalone application? If the latter, just use whatever you feel comfortable with. However, in general it's probably wiser to start new development in Python 3 or just support both versions - which isn't that tricky to do actually, the challenge is porting existing code over.


#5

What I've found is most of the small displays out there for the Pi or the BeagleBone aren't that easy to use. I can do a Lazarus form using Pascal with indicators, gauges buttons, sliders etc. But making that show up on a smaller screen in a readable format has been a challenge.

I've also got some gauges written in python modeled after information in an Elektor Book on Python Programming. So far these screens just show things like temperature sensors etc. But I'd like to be able to make the equivalent of a small control screen with menus like my Electronic Lead Screw but with more graphics and colours.

A display on the Pi sitting by the 3D printer that could show what the camera is seeing. That could turn on the cabinet light, heater, etc. would be handy. Not sure though if that would be a plugin though. I also have a BeagleBone with a Replicape for a Delta printer. I'm waiting for the new Manga screen since the one I have is rather useless. But the Beagle does what the Arduino does on my other printer so I don't know how much would be plugin and how much part of the Replicape support.

So many questions. So few answers...


#6

Maybe @Jon_C would be able to turn some of the Replicape specific questions into answers.

In general though, if you want to create a control panel, you basically have two options, doing it via a standalone application that uses the API to interact with OctoPrint, or a plugin built into OctoPrint. There are advantages and disadvantages to both.

A standalone application would be my first choice since it decouples you from the OctoPrint process and therefore you don't have to be so extremely careful about resource utilisation. On the other hand you can only do and see what the API allowed you. Then again, it's exactly the same for the web interface (which uses the API as well), so this isn't as limiting as it may sound first.

A plugin on the other hand has the advantage that you can do things you wouldn't be able to do just via the API, eg intercept commands and such. Usually you wouldn't need this though for a "simple" controller screen. And the downside is that whatever you do will have to run in the same process as OctoPrint (usually at least) and such on the same CPU that also has to take care of everything else incl. running the print job itself.

Personally I'd go for standalone via API. Just fits the bill better. And if push comes to shove you can still pair that with a companion plugin that gives you some more control.


#7

I'm dusting off my Python skills from back in uni with some web courses. Is Python 3 on the roadmap for OctoPrint? In the near-ish future.


#8

For what it's worth, it sounds like sunset was pushed back to 2020.


#9

Yes, it is actively worked on, for OctoPrint 1.4


#10

Woops, that is old and I've been slow to get back here...

Regarding MangaScreen, @jcdammeyer I hope you've received it by now!!!

As to a UI, the Replicape team has done exactly what @foosel suggested and built an external app for touch screen, it's called Toggle

We have been slow updating it, but there is support for both sizes of the Manga Screen 2 and an ongoing development effort is hopefully going to get it ported to Python 3.

While Toggle was meant to run on a beaglebone with Manga Screen, it is possible to run it on any Debian/Ubuntu basis. The integration we did at the framebuffer as part of Umikaze (the Replicape Ubuntu distribution bundling the firmware & toggle) may need to be worked out differently based on your setup. But I have run it on the desktop with a mouse instead of touch input, and it supports any input that the Clutter library supports.


#11

Yeah. I do have the new MangaScreen. The old one still works with the Replicape and BBB but the touch screen doesn't really work well enough so that it's usable. It did go back for testing to the manufacturer and came back with a report that it worked fine. I think my definition of working is perhaps different.
In either case, March 2018 is the last time I did anything with this. The Delta Printer, BBB, Replicape and Manga are back in the box. The printer just gathering dust. My cheap far east Ardunio run Cartesian printer handles my 3D printing needs at the moment. A Pi2 via hardware wired Ethernet services as the interface. The simple LCD display and mechanical buttons are more than enough at the machine to do any initializations.
At some point I will return to the BBB and Replicape and the new MangaScreen. For now there aren't enough hours in a day.