Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix circular import withvalidate_call#10807

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sydney-runkle merged 3 commits intomainfromfix-circular-ref
Nov 11, 2024
Merged

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runklesydney-runkle added the relnotes-fixUsed for bugfixes. labelNov 10, 2024
@cloudflare-workers-and-pagesCloudflare Workers and Pages
Copy link

cloudflare-workers-and-pagesbot commentedNov 10, 2024
edited
Loading

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:21f5813
Status: ✅  Deploy successful!
Preview URL:https://4db4e229.pydantic-docs.pages.dev
Branch Preview URL:https://fix-circular-ref.pydantic-docs.pages.dev

View logs

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedNov 10, 2024
edited
Loading

CodSpeed Performance Report

Merging#10807 willnot alter performance

Comparingfix-circular-ref (21f5813) withmain (421c2fb)

Summary

✅ 44 untouched benchmarks

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedNov 10, 2024
edited
Loading

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  validate_call_decorator.py
  pydantic/_internal
  _generate_schema.py
  _validate_call.py
Project Total 

This report was generated bypython-coverage-comment-action

@Viicos
Copy link
Member

It should be the other way around I think, the_generate_schema module should importVALIDATE_CALL_SUPPORTED_TYPES andValidateCallSupportedTypes in anif TYPE_CHECKING: block/ inside thematch_type call. More generally, this circular import is a sign that things are not properly isolated. I think it would make sense to defineVALIDATE_CALL_SUPPORTED_TYPES andValidateCallSupportedTypes in the_generate_schema module, and let_validate_call import from there. After all, a_call_schema isn't only limited to@validate_call, you can very much doTypeAdapter(some_callable).

sydney-runkle reacted with thumbs up emoji

@Viicos
Copy link
Member

Additionally, there's thetest_init_export that was supposed to catch these issues

@pytest.mark.filterwarnings('ignore::DeprecationWarning')
deftest_init_export():
fornameindir(pydantic):
getattr(pydantic,name)

but it probably requires cleaningsys.modules before eachgetattr call, and I couldn't make it work

@sydney-runkle
Copy link
ContributorAuthor

Additionally, there's the test_init_export that was supposed to catch these issues

I don't think this matters, as we're using two_internal files, so it's not supposed to catch them there...

@Viicos
Copy link
Member

Additionally, there's the test_init_export that was supposed to catch these issues

I don't think this matters, as we're using two_internal files, so it's not supposed to catch them there...

The idea is that we should have a test making sure that everyfrom pydantic import x top level import works. This one does but becausepydantic is already imported in various places (in different test files during pytest test collection, etc), it did not catch the circular import, and I find it a bit concerning as this could happen at any time

sydney-runkle reacted with thumbs up emoji

@sydney-runklesydney-runkle merged commit96876ef intomainNov 11, 2024
54 checks passed
@sydney-runklesydney-runkle deleted the fix-circular-ref branchNovember 11, 2024 22:17
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ViicosViicosViicos approved these changes

Assignees
No one assigned
Labels
relnotes-fixUsed for bugfixes.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Circular ref error withvalidate_call
2 participants
@sydney-runkle@Viicos

[8]ページ先頭

©2009-2025 Movatter.jp