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

Upgrade to Python 3.10 #35915

Merged
merged 23 commits into from
Aug 24, 2023
Merged

Upgrade to Python 3.10 #35915

merged 23 commits into from
Aug 24, 2023

Conversation

thomashampson
Copy link
Contributor

@thomashampson thomashampson commented Aug 11, 2023

Description of work
Upgrade Python to 3.10.

Purpose of work
Last year conda-forge announced they were dropping support for Python 3.7 when 3.11 was released. If we expect similar for the release of Python 3.12, then they will drop support for Python 3.8 in October this year. Therefore we should move away from Python 3.8 for the upcoming release.

Summary of work
Mostly fixing deprecation warnings, but some obscure things had broken due to low-level Python changes, including:

  • lhs_info() stopped working correctly in some cases
  • a scoping issue with the GIL release
  • a long path syntax issue on Windows
  • quasielastic bayes has been removed from the Windows package temporarily while we attempt to rebuild the package for Python 3.10. That will be in a separate PR.

See individual commits for more information. The work has been separated out by commit in a logical way.

To test:

Fixes #35228


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review
  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Are the release notes saved in a separate file, using Issue or PR number for file name and in the correct location?
Functional Tests
  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@thomashampson thomashampson changed the title 35228 python 3 10 upgrade Upgrade to Python 3.10 Aug 11, 2023
thomashampson and others added 22 commits August 14, 2023 17:45
Needed to remove the setuptools pin to resolve dependencies.

Co-authored-by: Jonathan Haigh <[email protected]>
Iterables has been moved to collections.abc and was derecated from within collections
a while ago. In Python 3.10 it was removed.

Co-authored-by: Jonathan Haigh <[email protected]>
Python 3.10 no longer uses implicit conversion with loss from a float to an int

Co-authored-by: Jonathan Haigh <[email protected]>
Co-authored-by: Jonathan Haigh <[email protected]>
Co-authored-by: Martyn Gigg <[email protected]>
Limited the scope of the GIL release so that manipulating python objects
can be done within the function. Previously it worked, but the behaviour was
changed for Python 3.10. See here:
https://docs.python.org/3/c-api/dict.html#c.PyDict_GetItem

Co-authored-by: Jonathan Haigh <[email protected]>
Co-authored-by: Martyn Gigg <[email protected]>
WorkbenchStartupTest was failing in Python 3.10. Something was prepending
the Windows long path syntax to the MANTIDPATH env variable. You cannot mix
back and forward slashes in long paths, so here we have addressed that.

Co-authored-by: Jonathan Haigh <[email protected]>
It's not compatible with Python 3.10. We will replace it with quickBayes
when that is ready.
@thomashampson thomashampson force-pushed the 35228_python_3_10_upgrade branch from b8e6408 to 770876a Compare August 14, 2023 16:45
This function will do nothing in Python>=3.9 and was been called from Py_Initialize() since 3.7
https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
@thomashampson thomashampson added ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS Extra Attention Testers and Gate keepers should pay extra attention as this affects core aspects. labels Aug 18, 2023
@thomashampson thomashampson added this to the Release 6.8 milestone Aug 18, 2023
@thomashampson thomashampson marked this pull request as ready for review August 18, 2023 11:33
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes were made to this file to fix the failing tests before we understood that there was a problem with the lhs_info() function. The fix in funcinspect.py would have solved the problem anyway. I don't think there's any harm in keeping these changes in.

@robertapplin robertapplin self-assigned this Aug 23, 2023
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the Windows and Linux installers, and they seem to be working as normal. No errors when loading, plotting or using some of the interfaces. Looks good to me

@SilkeSchomann SilkeSchomann merged commit a5d5d8d into main Aug 24, 2023
@SilkeSchomann SilkeSchomann deleted the 35228_python_3_10_upgrade branch August 24, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extra Attention Testers and Gate keepers should pay extra attention as this affects core aspects. ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move to Python 3.10
4 participants