-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python3 support #3278
Python3 support #3278
Conversation
2a83773
to
c85643f
Compare
Hi,
|
One more:
|
c85643f
to
79c6fa6
Compare
Thanks. I think those two errors should be fixed now. (Follow the "git fetch ; git checkout" commands above to pull the latest code.) Separately, if you just want to get printing, it will probably be easier to install python2. Otherwise, feel free to continue testing. -Kevin |
8e4fadf
to
b55c594
Compare
It worked good enough to successfully print several models, then after restart I got this:
|
Should be fixed now. -Kevin |
e3969f0
to
4134c90
Compare
Not sure if this was already known or not but buildcommands.py is not python3 compatible in this branch, so the firmware for the controlled boards must be built on a separate device that has python2 support. |
Can't get klippy to communicate with my BTT SKR 1.4s using this branch. Getting a command format mismatch error. Tested exact same firmware on master branch without issue. Here's the klippy.log: |
7660e92
to
9d91e17
Compare
I updated this branch to also change buildcommands.py to Python3.
This branch isn't always kept in sync with the master branch, so in general, it will be necessary to compile and flash the micro-controller using code on this branch. (That is, it may not be possible to use the micro-controller code from the master branch with the host code from this branch.) That said, I just rebase'd this branch with the latest master branch, so there should no longer be a conflict right now. -Kevin |
Hi, |
Thanks. I made some additional changes for webhooks python3 support. -Kevin |
86bc2c6
to
af7343d
Compare
With this branch klipper cannot connect to a linux-process MCU: "Unable to open port: File or stream is not seekable." Apparently it's the same issue as here: stefanholek/term#1 , with hopefully an easy fix. |
Another webhooks error:
|
af7343d
to
0878807
Compare
Thanks. The last two reported errors should now be fixed. -Kevin |
0878807
to
c429fbd
Compare
I'm using this branch rebased on top of master on a regular basis. It sometimes requires small fixes when some updates on master break that. I will eventually batch them in a PR, but I don't want to bother @KevinOConnor each time. If you encounter some difficulties rebasing this branch, feel free to check out my fork that may (or may not) be more current relative to master. But keep in mind that the combination with master changes and my modifications on top are only tested by me. |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
b290b5d
to
7479e70
Compare
The error checking is not complete in this change - the code should handle the case where an input string is not valid utf8. The code will continue to run on Python2 after this change, however the execution time on Python2 is measurably slower after making this change. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
034aadc
to
4601f9d
Compare
I have changed this branch so that the code is now capable of running on either Python2 or Python3. I've also updated the automated build tests to run on both versions of Python. I intend to commit this branch in a few days. This branch will not switch the installation to Python3. That will come at a later date and in a separate PR. In the interim, it is hoped that the updated build tests will catch any new code additions that result in a Python incompatibility. Even after committing this branch, there is still likely to be areas of the code that are not compatible with Python3. If anyone finds a compatibility issue, please report it. -Kevin |
4601f9d
to
62743aa
Compare
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add wrappers for some common Python modules so that the code can run on both Python2 and Python3. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a test case to verify that every optional module successfully loads on both Python2 and Python3. This is intended to catch syntax and module imports that are not compatible between Python versions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
62743aa
to
cc63fd5
Compare
@wlhlm I don't see that as a bug as we should really close the door on Python 2 code. It is working as designed for Python 3 and is the proper coding going forward. For outdated Klipper machines running Python 2, they have a choice: a) dead-end and maintain their firmware as-is without further support, or b) rebuild the host and client images with a fresh Python 3 build. It is possible to have Python 2 and 3 running concurrently, you just have to point to the Python 3 venv, instead of the other. There could be an upgrade installation but I think that's too much of a time sink and maintenance issue than just asking for a service & client rebuild. |
Klipper still is officially Python 2. This means even brand new installations will resort to a Python 2 venv. As long as this is the case, @wlhlm is correct and it should be considered a regression. |
This branch tracks changes to the Klipper host code so that it can run on Python3. It is intended for developers that wish to test and develop Klipper on Python3.
There are no immediate plans to switch Klipper from Python2 to Python3.
For those that do wish to test, it will require pulling this branch, installing a python3 virtualenv, and running the new code. For example:
At a minimum, Python version 3.6 or later is necessary.
If during testing you find an issue, please report as a comment on this PR. Code fixes for Python3 should be submitted as PRs against this branch (work-python3-20200620).
-Kevin
P.S. Please don't comment here requesting we convert to Python3. Please don't comment here to inform us of the pending doom of Python2. We've known about the state of Python2 for over a decade. We'll switch to Python3 if and when we feel that is appropriate - it will not be based on the schedules of any other projects.