Create seqscore lib and migrate to Pydantic#7
Closed
Wollaston wants to merge 3 commits intobltlab:devfrom
Closed
Conversation
Member
|
I took a quick look and things look sane. Let's meet next week to talk over the restructuring of the library vs cli. I want to get an idea of if it's absolutely necessary and what alternatives are to the current approach. |
Author
|
Closed in favor of not restructuring library at this time |
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.
This PR is twofold:
seqscorerepo into a workspace with the mainseqscorecli as the workspace root, and the newseqscore-libproject as the library backend for the CLI. The intention is so that this can be published/distributed separately and used as a library. This uses uv to effectively manage and package this.Note Pydantic provides automatic type validations and conversions. So, depending on configuration, some LSPs/Type Checkers may not know this and throw errors. If you run
mypyand the pre-commit script, it will show that all types have been statically checked.One notable change is with the
LabeledSequenceimplementation. Previously, this overwrote the__iter__dunder method to returnself.tokensas an Iterable. This couldn't be done with Pydantic as it relies on__iter__for its internal validation. There only appeared to be a few calls that expected this functionality, so those just call thetokensfield of the instance to get anIterableand the Pydantic default__iter__is maintained for its expected internal use elsewhere.Pydantic does not currently support opting certain fields out of
__hash__and__eq__so forLabeledSequenceagain, those are manually implemented to maintain the original functionality.