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

Remove (most of) the code intended for python 2 #38048

Merged
merged 5 commits into from
Oct 29, 2024
Merged

Conversation

jhaigh0
Copy link
Contributor

@jhaigh0 jhaigh0 commented Sep 20, 2024

Description of work

Remove code which is taking precautions wrt python 2. Release 4.2.0 was the final release to support python 2, so I think there's little risk in doing this.
Also updated how simpleapi.py was handling function signatures as part of this.

I've only searched for code by looking for comments mentioning python 2 so I'm sure there are more places out there.

There are a couple of cpp boost instances which look like they could be changed, but this is supposed to be a quick maintenance task and they look like they'd be more complex problems. Let me know if you disagree.
https://github.com/mantidproject/mantid/blob/main/Framework/PythonInterface/core/inc/MantidPythonInterface/core/PythonObjectInstantiator.h#L80-L87
https://github.com/mantidproject/mantid/blob/main/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp#L54-L61

There are some comments implement with ContextDecorator after python2 is deprecated) which have been deleted. They are currently using @contextmanager which is based on ContextDecorator anyway

There is no associated issue.

To test:

  • ci tests pass
  • feel free to search for more code that I've missed

This does not require release notes because no user impact


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?
  • Do the release notes conform to the release notes guide?

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.

@jhaigh0 jhaigh0 added Maintenance Unassigned issues to be addressed in the next maintenance period. ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS labels Sep 20, 2024
@jhaigh0 jhaigh0 added this to the Release 6.12 milestone Sep 20, 2024
@jhaigh0 jhaigh0 marked this pull request as draft September 20, 2024 10:09
@jhaigh0 jhaigh0 force-pushed the remove_python_2 branch 3 times, most recently from c4ed2bd to 0a6fc7c Compare September 20, 2024 15:21
@jhaigh0 jhaigh0 force-pushed the remove_python_2 branch 3 times, most recently from 12a66c4 to dcbff1f Compare September 30, 2024 12:37
@jhaigh0 jhaigh0 marked this pull request as ready for review September 30, 2024 13:14
Copy link
Contributor

@jclarkeSTFC jclarkeSTFC left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of minor points. I also fired up Workbench (no errors or warnings) and tried a couple of the algorithms that have changes, worked fine, as far as I could tell.

With the changes to simpleapi might be worth considering a package build.

scripts/SANS/isis_instrument.py Show resolved Hide resolved
@@ -527,7 +525,7 @@ def CutMD(*args, **kwargs): # noqa: C901
return out_names[0]


_replace_signature(CutMD, ("\bInputWorkspace", "**kwargs"))
CutMD.__signature__ = LazyFunctionSignature(alg_name="CutMD", include_self=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why some algorithms need special treatment? E.g. CutMD and RenameWorkspace

jhaigh0 and others added 3 commits October 8, 2024 11:24
jclarkeSTFC
jclarkeSTFC previously approved these changes Oct 8, 2024
@thomashampson thomashampson self-assigned this Oct 10, 2024
Copy link

👋 Hi, @jhaigh0,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

@github-actions github-actions bot added the Has Conflicts Used by the bot to label pull requests that have conflicts label Oct 11, 2024
@github-actions github-actions bot removed the Has Conflicts Used by the bot to label pull requests that have conflicts label Oct 14, 2024
jclarkeSTFC
jclarkeSTFC previously approved these changes Oct 24, 2024
Copy link
Contributor

@thomashampson thomashampson left a comment

Choose a reason for hiding this comment

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

Looking good, just a couple of comments

buildconfig/CMake/Packaging/AddPythonPath.py.in Outdated Show resolved Hide resolved
Co-authored-by: thomashampson <thomas.hampson@stfc.ac.uk>
@thomashampson thomashampson merged commit 48e9b01 into main Oct 29, 2024
10 checks passed
@thomashampson thomashampson deleted the remove_python_2 branch October 29, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS Maintenance Unassigned issues to be addressed in the next maintenance period.
Projects
Development

Successfully merging this pull request may close these issues.

3 participants