Skip to content

Migrate codebase from Python 2 to Python 3#5

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/run-command-script
Draft

Migrate codebase from Python 2 to Python 3#5
Copilot wants to merge 5 commits intomasterfrom
copilot/run-command-script

Conversation

Copy link

Copilot AI commented Feb 16, 2026

BBChop was written for Python 2, which reached end-of-life in 2020. This migration enables the tool to run on modern Python 3 interpreters.

Core Changes

Syntax modernization:

  • print statements → print() functions
  • raw_input()input()
  • String exceptions → proper Exception classes

Built-in changes:

  • xrange()range() (with list(range()) where mutability required)
  • file()open()
  • dict.has_key(key)key in dict
  • dict.iteritems()dict.items()

Operators and imports:

  • operator.divoperator.truediv
  • Integer division /// where needed
  • reduce imported from functools

Attribute changes:

  • func.func_namefunc.__name__

Example

Before:

print "test %d passed" % i
if d.has_key((i,j)):
    for x in xrange(len(ds)):

After:

print("test %d passed" % i)
if (i,j) in d:
    for x in range(len(ds)):

Testing

The main bbchop script and 4/5 test suites (cseTest, testdag, testDagRead, entropiesTest) pass with Python 3.12.3.

Original prompt

Run


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 16, 2026 03:52
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to run specified commands Migrate codebase from Python 2 to Python 3 Feb 16, 2026
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.

2 participants