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

Support __doc__ argument in create_model() #7863

Merged
merged 4 commits into from Oct 20, 2023

Conversation

chris-spann
Copy link
Contributor

@chris-spann chris-spann commented Oct 18, 2023

Change Summary

Fixes runtime error when using __doc__ argument for create_model()

Related issue number

fix #7481

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @samuelcolvin

@chris-spann chris-spann marked this pull request as ready for review October 18, 2023 17:09
@chris-spann
Copy link
Contributor Author

please review

@sydney-runkle
Copy link
Member

Hi @chris-spann,

Thanks so much for your contribution! ⭐

I think we'll want to add support explicitly for the __doc__ argument to the create_model function by modifying the signature of the create_model function in main.py and assigning the docstring of the new class within the create_model function as well.

Please update 👍

@chris-spann
Copy link
Contributor Author

chris-spann commented Oct 18, 2023

Thank you @sydney-runkle for the review! Please let me know if I've adequately addressed your comment in my latest commit. Please review.

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Hi @chris-spann,

LGTM other than a few small changes I left comments for. Once you add those small changes, I'll approve and merge.

Thanks again for your contribution. This looks great 🌟

tests/test_main.py Outdated Show resolved Hide resolved
tests/test_create_model.py Show resolved Hide resolved
@sydney-runkle
Copy link
Member

@chris-spann,

Apologies, you were actually spot on with the work from your second commit. I forgot that we actually don't support docstring inheritance in V2, that was only in V1 (see my comment here).

Your changes look great, I'll merge here in a sec 👍.

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution! 🎈

@sydney-runkle sydney-runkle merged commit 6a4b329 into pydantic:main Oct 20, 2023
60 checks passed
@chris-spann chris-spann deleted the support-doc-in-create-model branch October 20, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support __doc__ argument in create_model()
3 participants