Skip to content

✨ Support common pydantic types - #723

Closed
lachaib wants to merge 46 commits into
fastapi:masterfrom
lachaib:lachaib/issue181
Closed

✨ Support common pydantic types#723
lachaib wants to merge 46 commits into
fastapi:masterfrom
lachaib:lachaib/issue181

Conversation

@lachaib

@lachaib lachaib commented Dec 21, 2023

Copy link
Copy Markdown

This PR is "functional" as in "it does what was expected"

  • Support pydantic common types while keeping pydantic an optional dependency
  • Works in lists and tuples
  • Documentation with examples and test on examples

However, don't hesitate to request more tests, docs, or improvements on the code if needed to fit with the current standards

Fixes #181

@lachaib
lachaib force-pushed the lachaib/issue181 branch 2 times, most recently from 23988ad to 08d1fac Compare December 21, 2023 13:11
@lachaib

lachaib commented Dec 21, 2023

Copy link
Copy Markdown
Author

@tiangolo in order to add a basic pydantic support, we'd need to drop python 3.6, and I'd say it's about time 😏
Would you agree with that? Do you want me to open another pull request to do so? I'd be glad to help.

Edit: seems it's already submitted here #556

@svlandeg svlandeg added feature New feature, enhancement or request p3 labels Feb 28, 2024
@lachaib
lachaib force-pushed the lachaib/issue181 branch 4 times, most recently from debccf1 to 2a48587 Compare March 28, 2024 22:36
@svlandeg

Copy link
Copy Markdown
Member

@tiangolo in order to add a basic pydantic support, we'd need to drop python 3.6, and I'd say it's about time 😏

Hi! Note that Python 3.6 support was recently dropped in 0.11.0.

@lachaib

This comment was marked as resolved.

@svlandeg

This comment was marked as resolved.

@pypae pypae mentioned this pull request Apr 24, 2024
7 tasks
@pypae

pypae commented Apr 26, 2024

Copy link
Copy Markdown

Looks great, I'd love to see this get merged!

Could we somehow also support custom types defined by users like pydantic?

@lachaib

lachaib commented May 12, 2024

Copy link
Copy Markdown
Author

Looks great, I'd love to see this get merged!

Me too 😁

Could we somehow also support custom types defined by users like pydantic?

TBH I think this PR covers most of cases we need for now and I prefer to keep it minimalistic to get a chance for it to be merged soon.
On a personal project I managed to go a bit further and I'd really be glad to see Typer include all the features I made (some from inspiration of existing PRs) but small steps are always better.

@lachaib
lachaib force-pushed the lachaib/issue181 branch 3 times, most recently from 0ac6ec0 to 707839e Compare May 17, 2024 09:39
@benglewis

Copy link
Copy Markdown

@tiangolo Is this PR being considered?

@svlandeg svlandeg added the dependencies Pull requests that update a dependency file label Jul 25, 2024

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @lachaib, thanks for this nice work! Really appreciate the detailed tests and documentation as well.

I'm going to spend some time going through this PR in detail - I might leave some more review comments in the process, and might also push a few changes directly to your branch 🙏

@svlandeg

svlandeg commented Jul 25, 2024

Copy link
Copy Markdown
Member

It looks like this PR is now failing, as we recently added Python 3.12 to the CI. I'll put this in draft while we work on it 🚧

@svlandeg
svlandeg marked this pull request as draft July 25, 2024 14:26
Comment thread docs/tutorial/parameter-types/pydantic-types.md
Comment thread tests/test_tutorial/test_parameter_types/test_pydantic_types/test_tutorial001.py Outdated
Comment thread typer/main.py Outdated
@lachaib
lachaib marked this pull request as ready for review July 25, 2024 23:12
@svlandeg svlandeg changed the title [FEATURE] Support for common pydantic types ✨ Support common pydantic types Jul 26, 2024
@lachaib

lachaib commented Jul 30, 2024

Copy link
Copy Markdown
Author

@svlandeg thanks for your additions, I'm wondering now what's next for this PR and how may we move forward to merging?

@github-actions

This comment was marked as resolved.

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Recap of status of PR:

Recent conflicts fixed and PR brought up-to-date with latest changes on master (uv, test suite, etc).

I'm waiting for validation of the idea by Tiangolo, cf my earlier comments here. If he's happy to go ahead with this PR, one thing we should definitely do is make the pydantic-types.md doc page more extensive, describe the individual examples in more detail, etc.

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions

Copy link
Copy Markdown
Contributor

This PR modifies dependency files (pyproject.toml or uv.lock), which is restricted to members of the fastapi organization on GitHub.

If you need a dependency change, please open a discussion describing what you need and why.

Closing this PR automatically.

@svlandeg

svlandeg commented May 18, 2026

Copy link
Copy Markdown
Member

This PR modifies dependency files (pyproject.toml or uv.lock), which is restricted to members of the fastapi organization on GitHub.

If you need a dependency change, please open a discussion describing what you need and why.

Closing this PR automatically.

This is a new policy. I'll keep the PR closed but on my board. We'll be picking up this work in the near future, but will probably start from scratch anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file feature New feature, enhancement or request p3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Support for common pydantic types

5 participants