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

[REFACTOR] argilla server: using pydantic v2 #5666

Merged
merged 32 commits into from
Nov 20, 2024

Conversation

frascuchon
Copy link
Member

@frascuchon frascuchon commented Nov 4, 2024

Description

An alternative work of pydantic v2 upgrade with the latest changes from develop.

The main problems I found:

  • The Optional values are now required. This will affect how schemas are returned since default values are sets, including them as part of the schema result (record without responses or suggestions, for example)
  • I found some serialization errors when the response body (an error) contains a ValueError object. The same is working with pydantic <2
  • Automatic type conversion is not working anymore. This means that many client requests may fail ( values are not automatically converted to str, or some complex structures (record fields may be affected by this). We can still define custom model_validators, but we must apply them carefully.

Closes #4935

Refs #5508

Type of change

  • Refactor (change restructuring the codebase without changing functionality)

How Has This Been Tested

Checklist

  • I added relevant documentation
  • I followed the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • I confirm My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@frascuchon frascuchon requested a review from jfcalvo November 4, 2024 13:26
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 98.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 91.77%. Comparing base (6e63b04) to head (4bd1522).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...rver/src/argilla_server/api/schemas/v1/webhooks.py 93.33% 2 Missing ⚠️
...-server/src/argilla_server/errors/error_handler.py 93.33% 1 Missing ⚠️
argilla-server/src/argilla_server/jobs/hub_jobs.py 0.00% 1 Missing ⚠️
argilla-server/src/argilla_server/models/mixins.py 66.66% 1 Missing ⚠️
argilla-server/src/argilla_server/utils.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5666      +/-   ##
===========================================
+ Coverage    91.55%   91.77%   +0.22%     
===========================================
  Files          165      161       -4     
  Lines         6675     6725      +50     
===========================================
+ Hits          6111     6172      +61     
+ Misses         564      553      -11     
Flag Coverage Δ
argilla-server 91.77% <98.33%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@frascuchon frascuchon force-pushed the refactor/argilla-server/using-pydanticV2 branch from f14425f to ff30ee1 Compare November 5, 2024 12:17
@frascuchon frascuchon changed the title [DRAFT] [REFACTOR] argilla server: using pydantic v2 [REFACTOR] argilla server: using pydantic v2 Nov 6, 2024
frascuchon and others added 2 commits November 6, 2024 16:49
# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

Closes #5633

**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: José Francisco Calvo <[email protected]>
Co-authored-by: José Francisco Calvo <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@frascuchon frascuchon added this to the v2.5.0 milestone Nov 14, 2024
Copy link
Member

@jfcalvo jfcalvo left a comment

Choose a reason for hiding this comment

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

Masive effort! 💪

argilla-server/.env.dev Outdated Show resolved Hide resolved
argilla-server/pyproject.toml Show resolved Hide resolved
argilla-server/pyproject.toml Show resolved Hide resolved
@frascuchon frascuchon requested a review from jfcalvo November 19, 2024 13:28
@jfcalvo jfcalvo self-requested a review November 20, 2024 09:55
@jfcalvo jfcalvo merged commit 9cf0a63 into develop Nov 20, 2024
6 checks passed
@jfcalvo jfcalvo deleted the refactor/argilla-server/using-pydanticV2 branch November 20, 2024 09:56
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.

[CONFIG] Resolve python requirements for python version and dependencies with server.
2 participants