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

[24.1] Pin pydantic to >=2.7.4 #18423

Merged

Conversation

nsoranzo
Copy link
Member

Pydantic <2.7.4 is broken on Python>=3.12.4 , see
pydantic/pydantic#9609 . Fixed upstream in pydantic/pydantic#9639 .

Fix the following traceback in startup test on Python 3.12:

Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/bin/galaxyctl", line 10, in <module>
    sys.exit(galaxyctl())
             ^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1682, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1729, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 59, in get_command
    return name_to_command(name)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 45, in name_to_command
    mod = __import__(mod_name, None, None, ["cli"])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/commands/cmd_stop.py", line 4, in <module>
    from gravity import process_manager
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/process_manager/__init__.py", line 14, in <module>
    from gravity.config_manager import ConfigManager
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/config_manager.py", line 18, in <module>
    from gravity.state import ConfigFile, service_for_service_type
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/state.py", line 42, in <module>
    class ConfigFile(BaseModel):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 286, in __new__
    cls.__try_update_forward_refs__()
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 807, in __try_update_forward_refs__
    update_model_forward_refs(cls, cls.__fields__.values(), cls.__config__.json_encoders, localns, (NameError,))
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 554, in update_model_forward_refs
    update_field_forward_refs(f, globalns=globalns, localns=localns)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 520, in update_field_forward_refs
    field.type_ = evaluate_forwardref(field.type_, globalns, localns or None)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 66, in evaluate_forwardref
    return cast(Any, type_)._evaluate(globalns, localns, set())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

Example: https://github.com/galaxyproject/galaxy/actions/runs/9581802216/job/26419972297

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

Thank you!

@nsoranzo nsoranzo force-pushed the release_24.1_pydantic_2.7.4 branch from f7e8469 to c3ef080 Compare June 19, 2024 18:26
@mvdbeek
Copy link
Member

mvdbeek commented Jun 19, 2024

ERROR: No matching distribution found for pydantic>=2.7.4; extra == "config_template"

guess we have to split this per python version ?

Pydantic <2.7.4 is broken on Python>=3.12.4 , see
pydantic/pydantic#9609 .
Fixed upstream in pydantic/pydantic#9639 .

Fix the following traceback in startup test on Python 3.12:

```
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/bin/galaxyctl", line 10, in <module>
    sys.exit(galaxyctl())
             ^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1682, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/click/core.py", line 1729, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 59, in get_command
    return name_to_command(name)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/cli.py", line 45, in name_to_command
    mod = __import__(mod_name, None, None, ["cli"])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/commands/cmd_stop.py", line 4, in <module>
    from gravity import process_manager
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/process_manager/__init__.py", line 14, in <module>
    from gravity.config_manager import ConfigManager
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/config_manager.py", line 18, in <module>
    from gravity.state import ConfigFile, service_for_service_type
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/gravity/state.py", line 42, in <module>
    class ConfigFile(BaseModel):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 286, in __new__
    cls.__try_update_forward_refs__()
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/main.py", line 807, in __try_update_forward_refs__
    update_model_forward_refs(cls, cls.__fields__.values(), cls.__config__.json_encoders, localns, (NameError,))
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 554, in update_model_forward_refs
    update_field_forward_refs(f, globalns=globalns, localns=localns)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 520, in update_field_forward_refs
    field.type_ = evaluate_forwardref(field.type_, globalns, localns or None)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.12/site-packages/pydantic/v1/typing.py", line 66, in evaluate_forwardref
    return cast(Any, type_)._evaluate(globalns, localns, set())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
```

Example: https://github.com/galaxyproject/galaxy/actions/runs/9581802216/job/26419972297
@nsoranzo nsoranzo force-pushed the release_24.1_pydantic_2.7.4 branch from c3ef080 to 88d3849 Compare June 19, 2024 18:31
@nsoranzo
Copy link
Member Author

ERROR: No matching distribution found for pydantic>=2.7.4; extra == "config_template"

guess we have to split this per python version ?

I've just reverted the change for the packages that are listed in packages/packages_for_pulsar_by_dep_dag.txt .

@nsoranzo nsoranzo merged commit 7cfb10e into galaxyproject:release_24.1 Jun 20, 2024
42 of 50 checks passed
@nsoranzo nsoranzo deleted the release_24.1_pydantic_2.7.4 branch June 20, 2024 09:26
@jdavcs jdavcs added this to the 24.1 milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants