split validators to help avoid circular dependencies#2463
Closed
dmarek-flex wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
@yaugenst-flex For your Pydantic knowledge |
Collaborator
|
One way to get around this is to just import the module within the validator. It's a relatively common pattern in Python, but it does hide the module dependencies somewhat. I was also getting pretty confused with all the different places where we put validators in #2433 so eventually this all should be cleaned up. In that light, I think this change is ok for now if you need it. We have a lot of circular dependencies that we generally manage to get around by just throwing everything into one big file... |
momchil-flex
approved these changes
May 16, 2025
Collaborator
momchil-flex
left a comment
There was a problem hiding this comment.
Ah. Well this is fine by me and is kind of how we've been doing things. :D
Contributor
Author
|
great ill just make these changes directly in my other PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Can we do something like in this PR to help avoid circular dependencies? In my upcoming feature branch
ModeSpecis importing my own module which itself importing validators. I already resolved many other circular dependencies by splitting my own modules, but this seems like a fairly reasonable split to me.