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

Python 3.12 support #1898

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BryceGattis
Copy link
Contributor

This PR updates Rez to support Python 3.12, but is currently WIP.

Known TODOs:

Need to update vendored packaging package as it relies on six module which currently seems to rely on the imp module which was removed in Python 3.12. Perhaps we can get #1731 merged to fix this?

Confirm if we can remove special if statement that was avoiding a forced reload in plugin_managers.py

@BryceGattis
Copy link
Contributor Author

The vendored packaging package error is this:

  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Code\rez\rezbuild312\Scripts\rez\rez.exe\__main__.py", line 7, in <module>
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\_entry_points.py", line 69, in run_rez
    return run()
           ^^^^^
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\_main.py", line 156, in run
    opts = parser.parse_args(arg_groups[0])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\argparse.py", line 1904, in parse_args
    args, argv = self.parse_known_args(args, namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\argparse.py", line 1914, in parse_known_args
    return self._parse_known_args2(args, namespace, intermixed=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\argparse.py", line 1943, in _parse_known_args2
    namespace, args = self._parse_known_args(args, namespace, intermixed)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\argparse.py", line 2188, in _parse_known_args
    stop_index = consume_positionals(start_index)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\argparse.py", line 2141, in consume_positionals
    take_action(action, args)
  File "C:\Program Files\Python312\Lib\argparse.py", line 2018, in take_action
    action(self, namespace, argument_values, option_string)
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\_util.py", line 139, in __call__
    self._setup_subparser(parser_name, parser2)
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\_util.py", line 145, in _setup_subparser
    help_ = parser.setup_subparser(parser_name, parser)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\_main.py", line 48, in __call__
    mod.setup_parser(parser)
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\cli\selftest.py", line 67, in setup_parser
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\tests\test_pip_utils.py", line 14, in <module>
    from rez.vendor.packaging.requirements import Requirement as packaging_Requirement
  File "e:\code\rez\rezbuild312\Lib\site-packages\rez\vendor\packaging\requirements.py", line 12, in <module>
    from rez.vendor.six.six.moves.urllib import parse as urlparse
ModuleNotFoundError: No module named 'rez.vendor.six.six.moves'

I confirmed this error does not appear in a Python 3.11 build of Rez.

@BryceGattis
Copy link
Contributor Author

The errors seem to be related to this class as it seems to rely on functions that were associated with the old imp module.

@BryceGattis BryceGattis changed the title Add updates for Python 3.12 support Python 3.12 support Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant