-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Upgrade NVDA codebase to Python 3 #7105
Comments
Python's 2to3 script can be used for this request. Its developers included 2to3 into Python 3. |
Hi, A few years ago, I tried this approach and it produced mixed results. Although 2to3 did work to some extent, the resulting code needed corrections. Also, this is just not as easy as letting the current code run through this script: dependencies must be satisfied, and we need just two more dependencies in order to even start transition planning, namely SCons and wxPython (wxPython is another story, which is covered in #7077). Thanks. |
Hi, Although the actual transition plan is a bit cloudy at the moment, @jcsteh suggests via IRC that next year would be a good timeframe, and @LeonarddeR concurring with this thinking. A tentative plan is thus: Prerequisites: wxPython 4 testing must be completed i.e. merged into master and tested in at least two NVDA stable releases. For the purposes of this plan, N refers to NVDA release with wxPython 4, N+1 referring to next one and so on.
The above plan is subject to change. Thanks. |
Is it possible to build a NVDA distribution, which contains selectable Python 2.7 runtime and Python 3.x runtime simultaneously?
|
Thanks for your thoughts. I don't think having both versions in the same distribution is feasible/workable:
|
Would you maybe consider that by the time Python 3 versions are stable that
it be only a 64 bit app?
Or can it be made to install in both 64 and 32 bit systems. It would get
rid of the issue of people attempting to install it in xp, as will I am sure
happen otherwise.
Brian
|
I don't want to start the whole Xp discussion over again (#6718), but I disagree with this. When moving to Python 3, we should target the last version available at the time of the switch. |
Hi, hence the “ideal” case. In reality, 3.5 or higher should be targeted (3.6 is optimal), hence we can officially start working on #6718 as well. Thanks.
|
Thanks for your clarification. Just for reference, one major argument for not targetting 3.4 is this overview. Note that the EOL date for Python 3.4 is 2019-03-16. After this date, major security risks won't be patched any more. |
Hi, Laying the initial foundation in an internal branch (located at a personal fork of NVDA source code): The trivial case at this time is winreg versus _winreg compatibility. Because API's and side effects are the same, this is perhaps the easiest milestone: import winreg, and if not, use _winreg and rename it to winreg. I'm intentionally using the newer winreg.* methods to incorporate forward thinking principles. For future reference: if anyone wants to investigate Python 3 compatibility (for personal research purposes), or wish to test and send PR's, please do NOT send them to NV Access yet (there are higher priority works to be done, hence I propose p3 for this year). Instead, use josephsl/NVDA branch py3000 for now. In doing this, I recommend folks to follow the below advice and guidelines:
Note: the above procedure is for those who're thinking about tackling this issue for personal research purposes. During this process, someone should write a report to be sent to NV Access, collecting our data and findings. When meeting ambiguous code or code paths that could work well on both 2 and 3: try either strict compliance or compatibility approach. The following winreg and dictionary key iteration gives examples of these approaches:
Strict: import winreg and use winreg.*
Strict: for key in dict.keys(): pass Once you choose an approach, please do not be tempted to switch methods, otherwise you'll end up with more headaches than before. Thanks. |
I am concerned about the long tail of addons that will either never be ported or will require community intervention or otherwise will be slow to Python 3 and recommend moving up the timeline for pushing addon developers into at least using the subset of Python that is compatible with both versions to as early as possible. |
To @ctoth: As for add-ons, I'm taking your advice by making sure future versions of my add-ons are source-compatible with both 2 and 3. Sometime this year, I'll advise others to follow suit. Thanks. |
Follow-up to SCons: see #7520 for an update. With that in place, we're ready to start researching. Thanks. |
Waiting for #7546 to come to master branch before continuing. Thanks. |
Before we can move to Python 3 (nvaccess#7105), two important dependencies must be satisfied: wxPython 4 (nvaccess#7077) and SCons (nvaccess#7520). As of September 18, 2017, both were satisfied, although wxPython 4 is still in beta testing phase. For now, upgrade SCons to 3.0.0, which supports Python 2.7, 3.5, and 3.6. Key changes include changing print statements to print function and no more Environment.gettextMoFile attribute unless it has changed somehow. Upgrading to SCons 3 is one of the prerequisites to transitioning to Python 3.x.
Update: Once #7568 is part of NVDA master, that's when I propose code should be checked in. Thanks. |
I belief that first, all dependencies for Python 3 should be satisfied, so this includes the update to WX Python Phoenix 4.0 being incorporated into Master. |
Hi, yep, that’ll be done as part of a pull request once wxPython 4 officially ships (now up to beta 2). Thanks.
|
If I may make a users comment here, using my idiot head.." As you will want testing to at least be done by as many basic users as possible when the major issues are corrected, it is then when it can be put out in a master. As I've said before, I'm OK to test at present with portable versions of new builds in my bog standard windows 7. I'm expecting to get some more modern machines soon so will be up to speed then, but do have a history of using legacy software simply cos it works. Lastly in this issue, there are comments about xp, but as you have already dropped support there, don't let it mean that you also drop support for legacy software as well. |
Hi, I’ll make sure all app modules that ships with NVDA are properly ported, or if not completely, at least made compatible with both 2 and 3. Thanks.
|
Hmm, this seems like an interesting idea, though I wonder whether py2exe can deal wit this while freezing the code. That needs to be found out. |
Because various calls to xrange are used by generators, change them by calling range function (in Python 3, range returns generators).
…cess#7105. Comment from Reef Turner (NV Access): add explanatory comment, prefixing the comment with '# Py3 review required'. Because some changes are based on another issue (nvaccess#9067, for example), prefix the review comment with issue number references as appropriate.
…Module.dumpOnCrash. Re nvaccess#7105.
… statement changes in Python 3, applicable to log viewer and input core. Re nvaccess#7105.
…tually no longer needed in Python 3. Re nvaccess#7105. In order to deal with Unicode and non-Unicode paths, a dedicated function was provided to convert a package path to Unicode and return it. Since Python 3 can handle Unicode directly, consider removing this function altogether if no longer needed.
I'm going to close this issue now, as I think it has served it's purpose. It has been superceded by the Python 3 project board |
…#7105) Impacts both the add-ons state and the updater state files. Both are now written using pickle protocol 0 so that Python 2 version of NVDA can read them in case of downgrading. Re nvaccess#10224 (comment)
…10255) Impacts both the add-ons state and the updater state files. Both are now written using pickle protocol 0 so that Python 2 version of NVDA can read them in case of downgrading. Re #10224 (comment)
Hi,
This issue serves as an umbrella issue for several related issues, one of them being #7077.
Python 3 introduces changes to syntax and inner workings of Python. Some of the changes include:
Upgrading to Python 3 will require huge coordination, as NVDA developers, add-on writers, translators, users and others will need to adapt new attitudes, assumptions and so on. In terms of dependencies, the only thing left is SCons (wxPython is discussed in #7077).
Thanks.
The text was updated successfully, but these errors were encountered: