fix: Add compatibility module for StrEnum and assert_never (#12) #18
+28
−11
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
This pull request is a fix to the #12
This pull request introduces a new compatibility module to support Python versions earlier than 3.11, ensuring that features like
StrEnumandassert_neverare available across all supported environments. The main changes involve refactoring imports throughout the codebase to use these compatibility shims, improving cross-version compatibility and maintainability.Python compatibility improvements:
chatkit/_compat.pythat provides backports forStrEnumandassert_neverfor Python versions < 3.11.chatkit/errors.py,chatkit/agents.py,chatkit/server.py, andtests/helpers/mock_widget.pyto useStrEnumandassert_neverfrom the new_compatmodule instead of directly from the standard library.assert_neverfrom thetypingmodule in files where it is now provided by_compat.These changes ensure that the codebase remains functional and consistent across both older and newer Python versions.