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

Migrating to latest aiida: pydantic 2, graphene 3 #75

Merged
merged 9 commits into from
Nov 20, 2024
Merged

Conversation

eimrek
Copy link
Member

@eimrek eimrek commented Nov 19, 2024

In order to make this project work with AiiDA 2.5+, this pr migrates to

  • pydantic 2
  • fastapi 0.115.5 (previous version was not comptaibly with pydantic 2)
  • starlette.graphql (which was removed from starlette/fastapi) was replaced with starlette-graphene3
  • and as a result, graphene 2 also needed to be migrated to graphene 3

In the process of these migrations, the following things were changed:

  • tests that start aiida processes needed to be set as async and use an async test client, otherwise there was an event-loop conflict with aiida;
  • the upload file endpoint was not working with the previous approach, and now uses Fastapi's upload file that can handle large files in a manner that doesn't need to load it fully into memory.

Fixes #70

@eimrek eimrek requested a review from agoscinski November 19, 2024 22:42
aiida_restapi/models.py Outdated Show resolved Hide resolved
aiida_restapi/models.py Outdated Show resolved Hide resolved
aiida_restapi/models.py Outdated Show resolved Hide resolved
aiida_restapi/models.py Outdated Show resolved Hide resolved
aiida_restapi/models.py Outdated Show resolved Hide resolved
eimrek and others added 5 commits November 20, 2024 09:43
Co-authored-by: Alexander Goscinski <[email protected]>
Co-authored-by: Alexander Goscinski <[email protected]>
Co-authored-by: Alexander Goscinski <[email protected]>
Co-authored-by: Alexander Goscinski <[email protected]>
Co-authored-by: Alexander Goscinski <[email protected]>
Copy link
Collaborator

@agoscinski agoscinski left a comment

Choose a reason for hiding this comment

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

Went through it with @eimrek. For some changes it is not very clear why they were needed, but it works and it follows FastAPI guidelines (specifically the async client). Also the create_upload_file has to be adapted in the future to directly stream the byte string, but with that needs more work most likely on the aiida-core side. So it looks fine, merging it to make more progress on the endpoints!

Since we change the linter and formatter in the next PR we ignore failing pre-commit in the CI. RTD failure we fix in a future branch

@eimrek eimrek merged commit b7a57cb into master Nov 20, 2024
6 of 9 checks passed
@eimrek eimrek deleted the pydantic-2 branch November 20, 2024 08:52
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.

Compatibility with aiida-core 2.5
2 participants