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

support Python3.11 #2418

Merged
merged 13 commits into from Dec 5, 2022
Merged

Commits on Oct 15, 2022

  1. use default_factory for mutable defaults

    When trying to import hydra in Python 3.11, it throws following error:
    ```python
      File "/home/user/projects/iterative/hydra/hydra/conf/__init__.py", line 75, in JobConf
        @DataClass
         ^^^^^^^^^
      File "/home/user/.pyenv/versions/3.11-dev/lib/python3.11/dataclasses.py", line 1221, in dataclass
        return wrap(cls)
               ^^^^^^^^^
      File "/home/user/.pyenv/versions/3.11-dev/lib/python3.11/dataclasses.py", line 1211, in wrap
        return _process_class(cls, init, repr, eq, order, unsafe_hash,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/.pyenv/versions/3.11-dev/lib/python3.11/dataclasses.py", line 959, in _process_class
        cls_fields.append(_get_field(cls, name, type, kw_only))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/.pyenv/versions/3.11-dev/lib/python3.11/dataclasses.py", line 816, in _get_field
        raise ValueError(f'mutable default {type(f.default)} for field '
    ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory
    ```
    
    This is due to a recent change in dataclasses in Python 3.11 that
    disallows mutable to be set as a default value. This is done
    via check for hashability.
    
    See python/cpython#88840.
    Note that I am trying to add support for Python 3.11 to hydra. This
    seems like a major blocker.
    
    For reproducibility, I used the following command to search for these:
    ```console
    rg ".*: .* = [A-Z].*\(.*\)"
    ```
    skshetry committed Oct 15, 2022
    Configuration menu
    Copy the full SHA
    b090e96 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2022

  1. add test

    skshetry committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    0e856a6 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2022

  1. Configuration menu
    Copy the full SHA
    88dc0ae View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5a94eef View commit details
    Browse the repository at this point in the history
  3. add news file

    Jasha10 committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    873bdd8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0948a33 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    17eeeae View commit details
    Browse the repository at this point in the history
  6. rm unused import

    Jasha10 committed Dec 2, 2022
    Configuration menu
    Copy the full SHA
    fb248e4 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2022

  1. Configuration menu
    Copy the full SHA
    307397f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4be1961 View commit details
    Browse the repository at this point in the history
  3. fixup test regex

    Jasha10 committed Dec 3, 2022
    Configuration menu
    Copy the full SHA
    8c5e913 View commit details
    Browse the repository at this point in the history
  4. fixup regex for windows test

    Jasha10 committed Dec 3, 2022
    Configuration menu
    Copy the full SHA
    c1b7ea5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    af94ac3 View commit details
    Browse the repository at this point in the history