Skip to content

fix(python): update deserialization templates and typing issues #3780

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

Merged
merged 17 commits into from
Sep 24, 2024

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Sep 19, 2024

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-2787 https://algolia.atlassian.net/browse/DI-2915

Changes included:

supersede #3758

this pr updates the python template in order to better leverage pydantic and improve usage in general:

  • add field descriptions rather than pydantic description, better lsp support and native syntax
  • fix some typing issues
  • leverage pydantic extra fields for native additional properties support
  • remove pydantic validation of boundaries (length, gt etc.) in order to prevent potential outage due to outdated specs
  • assert the top level to_dict unwrap in tests rather than the model-level one, this allows us to have a more concrete usage, as it's unlikely that users will iterate over the fields to parse them

@shortcuts shortcuts self-assigned this Sep 19, 2024
@algolia-bot
Copy link
Collaborator

algolia-bot commented Sep 19, 2024

✔️ Code generated!

Name Link
🪓 Triggered by f604a08f1dd65d340ebc95fda233964d5d6ce2fe
🍃 Generated commit 891573403a6b72d477ee4656e6cb60ef77861a2c
🌲 Generated branch generated/fix/python-pydantic-warnings
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
python 1026

@shortcuts shortcuts changed the title fix(python): pydantic warnings and template update fix(python): update deserialization templates and typing issues Sep 20, 2024
@shortcuts shortcuts marked this pull request as ready for review September 23, 2024 10:34
@shortcuts shortcuts requested a review from a team as a code owner September 23, 2024 10:34
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

spec correctness >>> pydantic shit

@@ -0,0 +1,6 @@
argcomplete==3.5.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

is the CI deleting this file everytime ? I see it everywhere

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it doesn't push it on the CI but I can't understand why ahaha

@shortcuts shortcuts merged commit 4666c01 into main Sep 24, 2024
16 checks passed
@shortcuts shortcuts deleted the fix/python-pydantic-warnings branch September 24, 2024 11:54
algolia-bot added a commit that referenced this pull request Sep 24, 2024
… (generated) [skip ci]

Co-authored-by: Clément Vannicatte <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-python that referenced this pull request Sep 24, 2024
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.

3 participants