Skip to content

Conversation

@nesitor
Copy link
Member

@nesitor nesitor commented Oct 24, 2024

Related Clickup or Jira tickets : ALEPH-151

Self proofreading checklist

  • Is my code clear enough and well documented
  • Are my files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • Database migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Changes

Used tool bump-pydantic to migrate Pydantic V1 to Pydantic V2. Also added some manual modifications to fix orphan issues.

How to test

Ensure that everything works as usual without issues.

@nesitor nesitor self-assigned this Oct 24, 2024
@nesitor nesitor mentioned this pull request Oct 24, 2024
6 tasks
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch from eb31438 to 1982137 Compare October 24, 2024 16:46
Psycojoker
Psycojoker previously approved these changes Oct 24, 2024
Copy link
Contributor

@Psycojoker Psycojoker left a comment

Choose a reason for hiding this comment

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

Apart from some questions, LGTM

@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch 3 times, most recently from b472e50 to 5d068b0 Compare October 24, 2024 18:16
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch from 5d068b0 to e4e3d1e Compare October 24, 2024 18:27
@nesitor nesitor requested a review from Psycojoker October 24, 2024 19:11
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch from b5e05f1 to bad782f Compare October 24, 2024 19:44
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch from 7cbfce6 to ac9d738 Compare October 24, 2024 21:20
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch 5 times, most recently from bd9a9d6 to 88436b9 Compare October 24, 2024 22:17
@nesitor nesitor force-pushed the andres-migrate_pydantic_v2 branch from 88436b9 to ee28a85 Compare October 24, 2024 22:22
@nesitor nesitor marked this pull request as ready for review October 24, 2024 22:29
Copy link
Member

@1yam 1yam left a comment

Choose a reason for hiding this comment

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

Except the .model_dump_json() used on aiohttp.Client Response who is not a pydantic model.

Else LGTM

…yg_funct()

It used fixture_instance_message.item_content instead of fixture_instance_message_payg.item_content
so it raised some errors
…lues

- Since it returns string after migrating to Pydantic2, converting the test values into strings
…the best way

It raised some errors with mypy.
So I checked the documentation to find a better way to serialize the datetime by using the decorator
'@field_serializer'
@Antonyjin Antonyjin self-assigned this Apr 1, 2025
Antonyjin and others added 20 commits April 1, 2025 18:51
Replacing every deprecated functions by new ones:

- @validator → @field_validator
- class Config → model_config = ConfigDict()
- json_encoders → serialization
- orm_mode → from_attributes
- utcfromtimestamp() and pytz.utc.localize() → datetime.fromtimestamp(timestamp, tz=timezone.utc)
- utcnow() → datetime.now(timezone.utc)
@1yam 1yam force-pushed the andres-migrate_pydantic_v2 branch from a8b272e to 805ef37 Compare April 7, 2025 14:13
@nesitor
Copy link
Member Author

nesitor commented Apr 16, 2025

Closed in favour of #771

@nesitor nesitor closed this Apr 16, 2025
@nesitor nesitor deleted the andres-migrate_pydantic_v2 branch April 16, 2025 12: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.

5 participants