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

Migrate models to pydantic 2 #17262

Merged
merged 182 commits into from Jan 11, 2024
Merged

Migrate models to pydantic 2 #17262

merged 182 commits into from Jan 11, 2024

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Jan 10, 2024

Continuation of #16527 ... sorry for the huge PR, but there's not much one can do incrementally.

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.

@mvdbeek mvdbeek added kind/refactoring cleanup or refactoring of existing code, no functional changes and removed area/dependencies area/libraries Data libraries area/objectstore area/testing/api area/client area/packaging labels Jan 10, 2024
@github-actions github-actions bot added this to the 24.0 milestone Jan 10, 2024
@mvdbeek mvdbeek requested review from a team and davelopez January 10, 2024 09:39
@@ -0,0 +1,1731 @@
openapi: 3.0.3
Copy link
Member

Choose a reason for hiding this comment

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

Does this file need to be included in the repo?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah - expanded diff for the same question 😆.

@@ -31,7 +31,8 @@ version = 23.1.0.dev0
include_package_data = True
install_requires =
galaxy-util
pydantic[email]<2
pydantic[email]>=2
pycryptodome
Copy link
Member

Choose a reason for hiding this comment

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

I cannot find where this is used?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's used for id encoding and decoding via IdEncodingHelper

Copy link
Member Author

Choose a reason for hiding this comment

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

which I could make a type-only import

Copy link
Member

Choose a reason for hiding this comment

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

which I could make a type-only import

That's probably better, otherwise you'd need to require galaxy-data .

@@ -9,6 +9,7 @@ classifiers =
Natural Language :: English
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be a number of merge issues with this file, can you please double-check?

AnyUrl,
url_regex,
)
from pydantic.networks import AnyUrl # url_regex,
Copy link
Member

Choose a reason for hiding this comment

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

Can the commented-out code be removed?

Comment on lines 511 to 512
def _hack_fastapi_4428(as_dict) -> RepositoryMetadata:
return RepositoryMetadata(root=as_dict)
Copy link
Member

Choose a reason for hiding this comment

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

This can probably just be dropped since it's called only in one place?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, thank you!

Copy link
Member

@jmchilton jmchilton left a comment

Choose a reason for hiding this comment

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

This is wildly ambitious and I am grateful for our test coverage. Really, really impressive @mvdbeek.

@mvdbeek mvdbeek merged commit e341ced into galaxyproject:dev Jan 11, 2024
56 checks passed
@mvdbeek mvdbeek deleted the pydantic_v2_2024 branch January 11, 2024 08:36
nsoranzo added a commit to nsoranzo/galaxy that referenced this pull request Jan 15, 2024
nsoranzo added a commit that referenced this pull request Jan 15, 2024
@davelopez
Copy link
Contributor

Amazing indeed! Thank you so much for taking care of all this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants