Skip to content
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

qtvcp needs testing with python3 #819

Closed
rene-dev opened this issue May 3, 2020 · 41 comments
Closed

qtvcp needs testing with python3 #819

rene-dev opened this issue May 3, 2020 · 41 comments
Assignees
Labels

Comments

@rene-dev
Copy link
Collaborator

rene-dev commented May 3, 2020

qtpyvcp needs testing with python3, this should be an easy task.
running 2to3 -w should get most of the syntax problems fixed.

@c-morley
Copy link
Collaborator

c-morley commented May 5, 2020

Ok Rene sounds good.- i'll try to get to this soon.

@TurBoss
Copy link
Contributor

TurBoss commented May 11, 2020

Hello
Tested latest master today and managed to fix the rules
got every thing to work

Thank you so much !

@TurBoss
Copy link
Contributor

TurBoss commented May 11, 2020

well having some issues but fixing them

@TurBoss
Copy link
Contributor

TurBoss commented May 11, 2020

https://github.com/kcjengr/qtpyvcp/tree/Python3

installs with

pip install --upgrade -e .

@TurBoss
Copy link
Contributor

TurBoss commented May 12, 2020

hello,

managed to fix more errors but got a strange message on file load maybe from canon

PYTHON: exception during 'this' export:
ImportError: 'interpreter' is not a built-in module

@TurBoss
Copy link
Contributor

TurBoss commented May 12, 2020

Captura de pantalla de 2020-05-13 01-53-55

@dwrobel
Copy link
Contributor

dwrobel commented May 13, 2020

managed to fix more errors but got a strange message on file load maybe from canon

PYTHON: exception during 'this' export:
ImportError: 'interpreter' is not a built-in module

There is a separate issue #825 for that.

@TurBoss
Copy link
Contributor

TurBoss commented May 13, 2020

managed to fix more errors but got a strange message on file load maybe from canon

PYTHON: exception during 'this' export:
ImportError: 'interpreter' is not a built-in module

There is a separate issue #825 for that.

Thanks

@rene-dev
Copy link
Collaborator Author

this PR started: #934

@satiowadahc
Copy link
Contributor

@rene-dev Am I misunderstanding that qtpyvcp and qtvcp aren't quite the same thing? Should a separate issue be made for each? or should this one be re-titled to qtvcp and let the qtpyvcp project handle its own issue?

@rene-dev
Copy link
Collaborator Author

I cannot answer this question, I never used any QT stuff in linuxcnc.

@TurBoss
Copy link
Contributor

TurBoss commented Aug 27, 2020

I can port this to python3 but sadly i can't keep it working for python 2 and 3 at the same time

@rene-dev
Copy link
Collaborator Author

my proposal would be to update to python3 in master, the next release after 2.8 cannot realistically support python2.
If QT works with python3, why not use it in master.

@c-morley
Copy link
Collaborator

qtpyvcp is a separate project. I don't think this is the place to work on their problems unless it's something reasonable they need different in linuxcnc to function.

as for python3 and qtvcp - I agree python3 only for master as soon as I can get it to function/test a bit. (which shouldn't be long)

@rene-dev
Copy link
Collaborator Author

rene-dev commented Aug 28, 2020

ah, I didnt know that. why do we need 2 qt python implementations? how do they differ?
This issue was intended for the one that is bundled with linuxcnc.

@rene-dev rene-dev changed the title qtpyvcp needs testing with python3 qtvcp needs testing with python3 Aug 28, 2020
@satiowadahc
Copy link
Contributor

If I understand it right qtvcp uses gtk signalling and qtpyvcp uses well qt signalling.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

Is there a way to detect what version of python linuxcnc was compiled with? Maybe an environment variable.
I would like to have qtvcp work with both versions if possible.

@rene-dev
Copy link
Collaborator Author

rene-dev commented Sep 4, 2020

on an release version Im not aware how.
I dont recommend to bother with python2, its EOL since 9 Months, and new distros do not even have any python2 packages.
lets direct all the resources we have to the future.

@andypugh
Copy link
Collaborator

andypugh commented Sep 4, 2020

It seems that you can look at the "magic number" in one of the pyc files:
https://stackoverflow.com/questions/7807541/is-there-a-way-to-know-by-which-python-version-the-pyc-file-was-compiled

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

I really need to support both for a while. buster can be compiled with python2 support and of course people can use older distributions with master. If I add my python3 only code to qtvcp now, I break peoples configs.
I don't think the burden to support both is too bad, but I need an easy way to check which version.
an environmental variable set would work fine.
There has got to be a way to record the version of python used to compile with.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

andypugh: I'll see if I can make that technique work - thanks

@andypugh
Copy link
Collaborator

andypugh commented Sep 4, 2020

We can make Python3 a dependency for Master. All supported platforms have it available.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

The problem isn't that python3 isn't available, it's that its an all or nothing deal. Right now if you use python2 everything works. Not true for python3 yet and you can't run both at the same time.

@rene-dev
Copy link
Collaborator Author

rene-dev commented Sep 4, 2020

What doesn't work with python3? Switching python versions doesn't necessarily break a configuration. We need to make the switch at some point.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

I believe gladevcp, isn't converted yet?
if that is still true, then switching python versions will break configs if you use gladevcp/gscreen/gmoccapy and qtvcp.
That includes using gladvcp panels in AXIS.
Will python remaps work in either python version without changes?

@rene-dev
Copy link
Collaborator Author

rene-dev commented Sep 4, 2020

I have a branch where glade works, conveted to gtk3. All the widgets work(gremlin is still wip), its the gladevcp UIs that need work. Not much, probably a weekend per ui.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

well that confirms my point then.
Does the buldbot build binaries with python3 compiled in? I don't think so.
Are you ready to remove python2 from the build system?

My point is linuxcnc isn't completely python3 ready yet - and even when it is it will still likely break configs.
I don't want to break configs for no good reason until it is - if I can reasonably help it.

Anyways it seems i can get python version from code with if sys.version_info.major > 2:

@andypugh
Copy link
Collaborator

andypugh commented Sep 4, 2020

I think that the fact that Python2 is officially over, finsihed, dead and buried is a good enough reason to abandon it.

I think we should announce that Master / 2.9 will be Py3 only. At that point you can stop trying to support Py2 in Master.

I am not expecting 2.9 to be 7 years after 2.8. I wouldn't be surprised if it is nearer 6 months. Master is probably more releasable now than 2.8 was a year ago.

@c-morley
Copy link
Collaborator

c-morley commented Sep 4, 2020

Well when master can actualy be python3 only that could make some sense.
It's the chicken and an egg thing. I'm not merging python3 only qtvcp until linuxcnc fully supports python3.
but i will merge it when it supports both - then i can continue to develop and it doesn't break configs for people that use python2.

I don't really understand the problem with python2 - we have buster so it can support both so the work has already been done.
Now that the work for python3 is almost done then on the next distribution you would not have to do the work for python2 because oython3 work is done and well tested.
At least at the moment i don't see the reason to break configs for master in buster.

In the time we have discussed this i have the principal parts of qtvcp working on python2 and python3 - it's really not that hard.

I think 6 months for master this time is too fast actually. - well I guess it depends on when the six months starts from :)

@andypugh
Copy link
Collaborator

andypugh commented Sep 4, 2020

The 6 months starts now. The 2.8 release is uploading now.

@gmoccapy
Copy link
Collaborator

gmoccapy commented Sep 5, 2020 via email

@c-morley
Copy link
Collaborator

c-morley commented Sep 5, 2020

As soon as master is actually python3 only then qtvcp will be python3 only and I'll be happy about it.
The burden for python2 and 3 has not (so far anyways) been too much.
Things in linuxcnc seem to always to take much longer then we like.

As I mentioned I don't believe buildbot even produces python3 binaries - so why would I make qtvcp unusable until they do?

@rene-dev
Copy link
Collaborator Author

rene-dev commented Sep 5, 2020

buildbot does run the test with python3, but no packages currently.
http://buildbot.linuxcnc.org/buildbot/builders/1660.rip-buster-python3

sys.version_info.major does give you the version of the interpreter is running, not the version linuxcnc was compiled with. important difference, you cant load linuxcnc/hal modules compiled in one version in another version!

yes there are still some problems, but we might as well fix them now, and not in 2 years.

@gmoccapy
Copy link
Collaborator

gmoccapy commented Sep 5, 2020 via email

@satiowadahc
Copy link
Contributor

Now following versioning systems a complete break of the program is a major change. And typically versioning in major.minor.patch. So in that effect, is master going to python 3 only not a major change and should be going to 3.0.0 as well?

@rene-dev
Copy link
Collaborator Author

rene-dev commented Sep 5, 2020

most minor versions broke configs so far. just changing python version doesn't necessarily break configs. master cant be relied on anyway.

@simaoamorim
Copy link
Contributor

simaoamorim commented Sep 17, 2020

@rene-dev, @satiowadahc has a point, if a new version is not backwards compatible, then the major version should be increased (see https://semver.org/ and specifically https://semver.org/#how-should-i-handle-deprecating-functionality).

The fact that minor version bumps have broken configs so far is a kind of a red flag for any user without deep linuxcnc knowledge, because upgrading minor versions should be done in an incremental manner.
For instance, upgrading from 2.7.x to 2.8.x shouldn't need any changes to configurations, and any configuration that worked in 2.7.x should work out-of-the-box in 2.8.x, knowing that you just wouldn't use any new features implemented in 2.8 (I don't know if this upgrade breaks configs or not, just using it as an example).

Now, adding python3 support can be an incremental change if both versions are supported at the same time, meaning you can have scripts written for py2 and py3 and the same time in the linuxcnc universe, but as soon as you remove python2 support, you're breaking the incremental changes and so I agree with @satiowadahc, linuxcnc should move to version 3.0 at that point.

@rene-dev
Copy link
Collaborator Author

thats not how linuxcnc versions used to work in the past, most versions where the second number changed required config changes, the last number was bugfixing only.
back to topic, my arguments are:

  • master cannot be expected not to break configs, thats where the changes are happening
  • just changing the python and gtk version doesn't break configs, unless you have custom UI or python stuff.

@andypugh
Copy link
Collaborator

The "2" is a reference to EMC2, and I anticipate it will always be there. :-)

@c-morley
Copy link
Collaborator

I think the version of emc was set to 2 when HAL was added. Which seems a very good reason to raise the major version.
It could be argued mandating python 3 could be a valid reason too. Python is used extensively in linuxcnc.

Qtvcp works with python2 and 3 now, depending on how linuxcnc is compiled.
I think you can close this issue - any future problems found can be opened separately.

@rene-dev
Copy link
Collaborator Author

I tested it today, and all seems to work fine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants