Conversation
Otherwise ruff check can fail on things ruff format fixes.
Only runs over ossdbtoolsservice and tests_v2. Does not follow imports, which would end up checking other projects. This is to scope the linting to where new development will happen. Skips checking ossdbtoolsservice.language.completion. This module was particularly tricky to fix with typing. Could be tackled in future, but for now allow this to continue to be untyped.
224bc93 to
94f1c82
Compare
mmcfarland
approved these changes
Feb 19, 2025
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 adds mypy checks to scripts/lint.sh
Runs mypy over
ossdbtoolsserviceandtests_v2directories, except forossdbtoolsservice.language.completionmodule. That module proved very hard to type without breaking the code, so it's left untyped for now. Other modules likesmoandpgsmoare left untyped, as well astests.Generally, the goal here was to leave functionality unchanged. However in order to fix types I did need to refactor a number of things. However this should be transparent to the consumer, except that error messages in cases where required values are not sent should be more clear.
One functionality change made was that the SaveAsJsonWriter was serializing all values as strings; I modified to check if it's a serializable type and if so serialize the direct value.
Another strategy was to de-abstract the project away from supporting multiple open source DBs when convenient. There is no actual implementation for other DBs, and this is a PG specific project; the concept of different provider types in the codebase is simply a maintenance burden.
A lot of changes were due to the way the message models were created, with
Serializableobjects needing a parameterless__init__. This required a lot of validation around if properties were None throughout the handler code. Going forward we should only usepydantic.BaseModelmodels to ensure validation happens up front and we can write code against the intended property types. Pydantic model support is already implemented in the MessageServer.There's a lot of
# noqacomments around the codebase without a good reason to no QA; this PR removes a lot of them and we should keep deleting those whenever we see them without justification.