You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Static type checkers, based on pyright won't work correctly due to the hierarchy of the exported classes and modules (examples from LSP / VSCode pylance presented on screenshots). It means, that for instance smart tools like mypy will definitelly work correctly, but real-time type checkers will distruct developers all the time.
The base classes, or let's say what do you call Generic classes are placed on the same level from the hierarchy perspective which means that it is quite hard to use. According to some sorts of best-practices it is recommended having something like the infrastructure layer for the project that is in development.
2.1. In this PR you'll find the infrastructure layer that encapsulates all the shared logic for the whole application and make it linear from modules importing perspective (now, there is no imports on the same level)
All the if TYPE_CHECKING: lines are removed due to it's unnecessary. Basically this line might be useful if you have some architecture issues (circular imports) in your code but seems there is no reason to overcomplicate the project with additional if statement in all concrete implementations. Even thought if we decide having them in the project I would recommend using from __future__ import annotations over the if TYPE_CHECKING:
All the docstrings are unified
Imports are simplified with __all__. Since the __all__ could be used to control wild imports in Python this is definitely a good way to go with in my opinion. In the old version of the code the controll of the import is on the __init__.py which make developers to think about a couple of places to export their modules. With current approach you control your concrete SSO implementation in your single file which make the code more robust from changes perspective. Like, all the names that are allowed to be imported from this module are defined in this module itself. And, the way to import this module is defined on the level above (on the package level).
So basically this is the result of the typings improvements:
❌ Patch coverage is 92.20779% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.07%. Comparing base (cb86159) to head (be1555c). ⚠️ Report is 95 commits behind head on master.
Hi @parfeniukink, thanks! From the first read I'd say it's very nice, although I am not a huge fan of the infrastructure subpackage name. I'll have another look, preferably tomorrow and either approve or propose some actual changes. Good job!
Hi @parfeniukink, thanks! From the first read I'd say it's very nice, although I am not a huge fan of the infrastructure subpackage name. I'll have another look, preferably tomorrow and either approve or propose some actual changes. Good job!
Well, yeah. I agree with the infrastructure naming, but anyway, I just chose the default naming for the shared module right from the DDD approach since there are no other approaches discussed/declared yet. And I hope you agree that at least any of the familiar design approaches in the dev community is better than no one :)
btw, I think that infrastructure layer is kind of a good naming bud not for the 3-rd party package, like fastapi-sso which must be a part of the infrastructure layer in other applications 😄
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
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.
2.1. In this PR you'll find the infrastructure layer that encapsulates all the shared logic for the whole application and make it linear from modules importing perspective (now, there is no imports on the same level)
if TYPE_CHECKING:lines are removed due to it's unnecessary. Basically this line might be useful if you have some architecture issues (circular imports) in your code but seems there is no reason to overcomplicate the project with additionalifstatement in all concrete implementations. Even thought if we decide having them in the project I would recommend usingfrom __future__ import annotationsover theif TYPE_CHECKING:__all__. Since the__all__could be used to control wild imports in Python this is definitely a good way to go with in my opinion. In the old version of the code the controll of the import is on the__init__.pywhich make developers to think about a couple of places to export their modules. With current approach you control your concrete SSO implementation in your single file which make the code more robust from changes perspective. Like, all the names that are allowed to be imported from this module are defined in this module itself. And, the way to import this module is defined on the level above (on the package level).So basically this is the result of the typings improvements: