10gen / mongo-orchestration

Apache License 2.0
7 stars 11 forks source link

Upgrade to CherryPy >= 9 #291

Closed ShaneHarvey closed 1 year ago

ShaneHarvey commented 2 years ago

We currently pin to CherryPy>=3.5.0,<9.0.0. CherryPy 8.9.1 is over 5 years old: https://pypi.org/project/CherryPy/8.9.1/

We should resolve whatever issue stopped us from using 9 (a bottle incompatibility I think?) and upgrade to a modern version.

eramongodb commented 1 year ago

This is currently blocking use of mongo-orchestration with Python 3.11 which removed the getargspec function (deprecated since 3.0):

Traceback (most recent call last):
  File "/.../venv/lib/python3.11/site-packages/mongo_orchestration/server.py", line 132, in run
    run(get_app(), host=self.args.bind, port=self.args.port,
  File "/.../venv/bin/bottle.py", line 3172, in run
    server.run(app)
  File "/.../venv/bin/bottle.py", line 2807, in run
    from cherrypy import wsgiserver # This will fail for CherryPy >= 9
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../venv/lib/python3.11/site-packages/cherrypy/__init__.py", line 71, in <module>
    from cherrypy import _cpdispatch as dispatch  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../venv/lib/python3.11/site-packages/cherrypy/_cpdispatch.py", line 214, in <module>
    getargspec = inspect.getargspec
                 ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'

This comment suggests a possible workaround for the import error observed with CherryPy >= 9:

try:
    from cheroot.wsgi import Server as WSGIServer
except ImportError:
    from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer
eramongodb commented 1 year ago

This may also require bottle>=0.12.23.