refactor: merge cyclicly imported files into library.py #1067
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.
Note
Blocked by #942, #948, and #1058 due to refactoring in overlapping areas.Summary
While I started this with the intention to merely clean up the Pyright errors inside the core library files, I ended up falling down the rabbit hole of discovering that the entire alchemy library directory has been riddled with cyclical imports that while not causing runtime issues, apparently do cause behind the scenes issues with Pyright and other type checkers while also indicating deeper issues with the architectural layering (see Eric Traut's comment on this as well as DetachHead's comment).
To address these issues I've chosen to merge nearly all of the code from
models.py,fields.py,joins.py,visitors.py, anddefault_color_groups.pyintolibrary.py. In the process I've also addressed any Pyright issues along the way but have otherwise left the code unchanged. While this increases the size oflibrary.pyby about 33%, it does end up grouping together a lot of highly related functionality that maybe shouldn't have been siloed off into their own co-dependent files to begin with. I'd be happy to break out any code that doesn't need to be in here at this point, but this file may just need to be a big boy to avoid these types of cycles...Tasks Completed