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

Chore: Python 2 deprecation in lib #779

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

iLLiCiTiT
Copy link
Member

Changelog Description

Remove Python 2 compatibility from functions in ayon_core.lib.

Additional info

Classes do no inherit from object. Simplified doubled imports for Py2 and Py3 compatibility of configparser and lru_cache. Use WeakMethod directly from weakref and warn on import of python_2_comp.py.

Testing notes:

  1. Go through code and check possible errors I made.
  2. Validate everything is working as expected.

@ynbot ynbot added type: enhancement Improvement of existing functionality or minor addition size/S labels Jul 16, 2024
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

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

  • Tray works
  • Tray loader works
  • Launcher works
  • Maya 2024 works, incl. workfiles, publishing, loading and managing
  • Fusion 18 works, incl. workfiles, publishing, loading and managing

Code seems fine.

Remove python_2_comp.py file now

I have my doubts about whether it's really worth it to have backwards compatibility for python_2_comp. I can't find any usage across the codebases and I wonder if anyone would've ever touched it at all. And even if they would - their logic wouldn't be valid for Py3 anyway. So I'd personally opt for removing python_2_comp.py completely.

@iLLiCiTiT

@BigRoy BigRoy assigned iLLiCiTiT and unassigned BigRoy Aug 28, 2024
@iLLiCiTiT
Copy link
Member Author

Remove python_2_comp.py file now

We have to be somewhat careful about breaking backwards compatibility. I can't know if there is an addon that is using it, having it there with warning for some time won't hurt.

their logic wouldn't be valid for Py3 anyway

It would be Py3 valid. The content was Py2 and Py3 compatible, you could import it to support both.

Note, start filename with underscore if should not be imported publicly.

@iLLiCiTiT iLLiCiTiT merged commit d9cf63b into develop Aug 28, 2024
6 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/python-2-deprecation branch August 28, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants