Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Python 3.12 #11

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cms/io/web_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@

import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.wsgi as tornado_wsgi
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
from datetime import datetime, timedelta
from functools import wraps

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/contestannouncement.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@

"""

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/contestquestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@

import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/contestuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
import re
import zipfile

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/admin/handlers/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
import logging
import traceback

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
import logging
import traceback

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@

import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/contest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
import ipaddress
import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
import os.path
import re

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@

import logging

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/tasksubmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
import logging
import re

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/contest/handlers/taskusertest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
import logging
import re

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
import tornado4.web as tornado_web
except ImportError:
Expand Down
7 changes: 7 additions & 0 deletions cms/server/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
from functools import wraps
from urllib.parse import quote, urlencode

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
from tornado4.web import RequestHandler
except ImportError:
Expand Down
3 changes: 2 additions & 1 deletion cmscontrib/loaders/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import imp
import logging
import os
import subprocess
Expand Down Expand Up @@ -146,6 +145,8 @@ def get_task(self, get_statement=True):
if os.path.exists(task_cms_conf_path):
logger.info("Found additional CMS options for task %s.", name)
with open(task_cms_conf_path, 'rb') as f:
# TODO(veluca): consider fixing this
import imp
task_cms_conf = imp.load_module('cms_conf', f,
task_cms_conf_path,
('.py', 'r', imp.PY_SOURCE))
Expand Down
7 changes: 7 additions & 0 deletions cmstestsuite/unit_tests/grading/ParameterTypesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

import unittest

import collections
try:
collections.MutableMapping
except:
# Monkey-patch: Tornado 4.5.3 does not work on Python 3.11 by default
collections.MutableMapping = collections.abc.MutableMapping

try:
from tornado4.web import MissingArgumentError
except ImportError:
Expand Down
23 changes: 14 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# We are currently targeting the versions shipped in Ubuntu 20.04.

tornado>=4.5,<4.6 # http://www.tornadoweb.org/en/stable/releases.html
psycopg2>=2.8,<2.9 # http://initd.org/psycopg/articles/tag/release/
# Fix tornado version to be sure that it will work with our patch
tornado==4.5.3 # http://www.tornadoweb.org/en/stable/releases.html
# Set psycopg2 version for Python 3.11
psycopg2==2.9.7 # http://initd.org/psycopg/articles/tag/release/
sqlalchemy>=1.3,<1.4 # http://docs.sqlalchemy.org/en/latest/changelog/index.html
netifaces>=0.10,<0.11 # https://bitbucket.org/al45tair/netifaces/src/
pycryptodomex>=3.14,<3.15 # https://github.com/Legrandin/pycryptodome/blob/master/Changelog.rst
pycryptodomex==3.19.0 # https://github.com/Legrandin/pycryptodome/blob/master/Changelog.rst
psutil>=5.5,<5.6 # https://github.com/giampaolo/psutil/blob/master/HISTORY.rst
requests>=2.22,<2.23 # https://pypi.python.org/pypi/requests
gevent>=21.12.0,<21.13 # http://www.gevent.org/changelog.html
werkzeug>=0.16,<0.17 # https://github.com/pallets/werkzeug/blob/master/CHANGES
requests==2.32.3 # https://pypi.python.org/pypi/requests
# Slightly higher version for Python 3.11 support
gevent==23.9.0.post1 # http://www.gevent.org/changelog.html
werkzeug<1.0
backports.ssl-match-hostname==3.7.0.1
# Limit greenlet version for compatibility with gevent
greenlet>=3.0rc1
patool>=1.12,<1.13 # https://github.com/wummel/patool/blob/master/doc/changelog.txt
bcrypt>=3.1,<3.2 # https://github.com/pyca/bcrypt/
chardet>=3.0,<3.1 # https://pypi.python.org/pypi/chardet
babel>=2.7,<2.8 # http://babel.pocoo.org/en/latest/changelog.html
# Set babel version for Python 3.11
babel==2.12.1 # http://babel.pocoo.org/en/latest/changelog.html
pyxdg>=0.26,<0.27 # https://freedesktop.org/wiki/Software/pyxdg/
Jinja2>=3.0,<3.1 # http://jinja.pocoo.org/docs/latest/changelog/
pyjson5>=1.6,<1.7
Expand Down
Loading