Skip to content

Conversation

aminalaee
Copy link
Contributor

@aminalaee aminalaee commented Aug 9, 2022

Change Summary

Some imports indirectly get ForwardRef and other types from .typing instead of typing module. I came across this when I was working on something else.

Closes #4182

Related issue number

None

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@aminalaee
Copy link
Contributor Author

This will also close #4182 to keep consistency in pydantic.typing.__all__

@samuelcolvin
Copy link
Member

This will also close #4182 to keep consistency in pydantic.typing.__all__

Thanks, if this is closing issues, please put them in the PR body so they get auto-closed.

Please update.

@github-actions github-actions bot added the awaiting author revision awaiting changes from the PR author label Aug 9, 2022
@aminalaee
Copy link
Contributor Author

please review

@github-actions github-actions bot added ready for review and removed awaiting author revision awaiting changes from the PR author labels Aug 9, 2022
@hramezani
Copy link
Member

Thanks @aminalaee for the patch 👍

There are some other ForwardRef that can be replaced:

  • from pydantic.typing import ForwardRef
  • There are some tests that have from pydantic.typing import ForwardRef that can be replaced by from typing import ForwardRef:
    def test_basic_forward_ref(create_module):
    @create_module
    def module():
    from typing import Optional
    from pydantic import BaseModel
    from pydantic.typing import ForwardRef

@hramezani
Copy link
Member

hramezani commented Aug 9, 2022

please update

@github-actions github-actions bot added awaiting author revision awaiting changes from the PR author and removed ready for review labels Aug 9, 2022
@aminalaee
Copy link
Contributor Author

Thank you for the review @hramezani . I'd only checked the top imports, this should be ok now. please review.

@github-actions github-actions bot added ready for review and removed awaiting author revision awaiting changes from the PR author labels Aug 10, 2022
Copy link
Member

@hramezani hramezani left a comment

Choose a reason for hiding this comment

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

Thanks @aminalaee for the update 👍

@samuelcolvin
Copy link
Member

Hi @aminalaee please update to add a change file.

Otherwise LGTM.

@pydantic-hooky pydantic-hooky bot added awaiting author revision awaiting changes from the PR author and removed ready for review labels Aug 10, 2022
@aminalaee
Copy link
Contributor Author

Sorry I'd forgotten to add that. please review again.

@pydantic-hooky pydantic-hooky bot added ready for review and removed awaiting author revision awaiting changes from the PR author labels Aug 10, 2022
@samuelcolvin samuelcolvin merged commit 1f83221 into pydantic:master Aug 11, 2022
@samuelcolvin
Copy link
Member

Thanks so much.

@aminalaee aminalaee deleted the fix-imports-from-typing branch August 11, 2022 12:22
auphofBSF pushed a commit to auphofBSF/sqlmodel that referenced this pull request Oct 18, 2022
current pydantic 1.10.2
see pydantic/pydantic#4358
Fix imports indirectly from pydantic typing #4358
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.

"MappingIntStrAny" not declared in __all__
4 participants