Skip to content

Conversation

YazdanRa
Copy link

@YazdanRa YazdanRa commented Oct 9, 2025

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 StrEnum and assert_never are 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:

  • Added a new module chatkit/_compat.py that provides backports for StrEnum and assert_never for Python versions < 3.11.
  • Updated imports in chatkit/errors.py, chatkit/agents.py, chatkit/server.py, and tests/helpers/mock_widget.py to use StrEnum and assert_never from the new _compat module instead of directly from the standard library.
  • Removed direct imports of assert_never from the typing module 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant