Add Python 2/3 dual-compatibility for Python 3.6 integration - #45
Open
noahzaozao wants to merge 1 commit into
Open
Add Python 2/3 dual-compatibility for Python 3.6 integration#45noahzaozao wants to merge 1 commit into
noahzaozao wants to merge 1 commit into
Conversation
The Learningtribes fork imports cleanly but crashes at runtime on Python 3 in the discovery/index paths, blocking the py36 lock. Fix the Py2-only idioms so the fork runs under both 2.7 and 3.6: - utils: basestring -> six.string_types; collections.Iterable -> collections.abc fallback import - result_processor: dict.itervalues() -> six.itervalues(); exception .message -> six.text_type(); shlex.split() unicode handling guarded by six.PY2 (Py3 splits unicode directly) - api: isinstance(x, (str, unicode, ...)) -> six.string_types + (bytes, bytearray) - elastic: exception .message -> six.text_type() (6 sites, including two broken '...%s'.format(e.message) logging calls) - tests/mock_search_engine + test_views: basestring/unicode() -> six; bytes.translate(None, str) -> unicode filter - setup.py/tox.ini: declare Python 3.6, add six dependency, add py36 tox env - add standard from __future__ header to modernized modules Verified: compileall clean, 0 Py2-only patterns, and real-module runtime checks pass under Python 3. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
The Learningtribes fork imports cleanly but crashes at runtime on Python 3 in the discovery/index paths, blocking the py36 lock. Fix the Py2-only idioms so the fork runs under both 2.7 and 3.6:
collections.abc fallback import
six; bytes.translate(None, str) -> unicode filter
Verified: compileall clean, 0 Py2-only patterns, and real-module runtime checks pass under Python 3.