Draft
Conversation
…lity - Update setup.py to specify Python 3.6+ support - Update Django from 1.11 to 2.2 LTS (Python 3 compatible) - Update all dependencies to Python 3 compatible versions - Replace __unicode__ with __str__ in all models - Fix Python 2 imports (urllib2, urlparse, StringIO) to Python 3 equivalents - Convert print statements to print() functions Co-authored-by: eos87 <124766+eos87@users.noreply.github.com>
- Replace dict.iteritems/iterkeys/itervalues with items/keys/values - Replace unicode() calls with str() - Replace basestring with str - Fix except statements from 'except E, e:' to 'except E as e:' - Replace dict.has_key(x) with 'x in dict' - Update json_wrapper to use standard json module Co-authored-by: eos87 <124766+eos87@users.noreply.github.com>
- Fix broken print statement continuation in permissions.py - Replace 'async' variable name with 'task' (async is a reserved keyword in Python 3.5+) - Fix lambda tuple unpacking in filter functions (not supported in Python 3) - Wrap filter() results with list() for Python 3 compatibility Co-authored-by: eos87 <124766+eos87@users.noreply.github.com>
…atibility Django 2.0 requires on_delete parameter for all ForeignKey fields. Added on_delete=models.CASCADE to all ForeignKey fields in models. Co-authored-by: eos87 <124766+eos87@users.noreply.github.com>
- Fix file reading to use encoding parameter in open() instead of str() - Fix wordcount functions to check for bytes instead of str - Add BytesIO import and use it for binary data - Fix unicode type checks to use bytes checks - Fix json.dumps() usage (returns str in Python 3, not bytes) - Add None check before calling startswith() on filter lambda Co-authored-by: eos87 <124766+eos87@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate booktype codebase to Python 3
Migrate Booktype to Python 3
Feb 13, 2026
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.
Migrates codebase from Python 2 to Python 3.6+. Updates Django from 1.11 to 2.2 LTS and modernizes dependencies.
Dependency Updates
Django 2.0+ Compatibility
__unicode__()→__str__()in models (18 classes)on_delete=models.CASCADEto ForeignKey fields (59 fields)Python 3 Syntax
urllib2→urllib.request,urlparse→urllib.parse,StringIO→io.StringIOexcept E, e:→except E as e:.iteritems()→.items(),.has_key(x)→x in dictunicode()→str(),basestring→strasyncvariables (reserved keyword in Python 3.5+)lambda (a, b):→lambda item: ... item[0] ... item[1]String/Bytes Handling
All 387 Python files compile successfully with Python 3.12.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.