Create seqscore lib and migrate to Pydantic #7
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.