Apistar still not working for 3.7


#1

@tom

When will we see an update that can bring apistar to python 3.7? Looks like it has been an open issue since June and the project has a PR waiting to correct it.


#2

To all who read this thread. For now you can monkey patch your code:

# MONKEY PATCHING FOR 37 SUPPORT
from abc import ABCMeta
from apistar.types import TypeMetaclass


def subclass_37_fix(cls, subclass):
    try:
        return ABCMeta.__subclasscheck__(cls, subclass)
    except TypeError:
        return False


TypeMetaclass.__subclasscheck__ = subclass_37_fix
# END MONKEY PATCH

from apistar import App, Route


def welcome(name=None):
    if name is None:
        return {'message': 'Welcome to API Star!'}
    return {'message': 'Welcome to API Star, %s!' % name}


routes = [
    Route('/', method='GET', handler=welcome),
]

app = App(routes=routes)

if __name__ == '__main__':
    app.serve('127.0.0.1', 5000, debug=True)


#3

Okey doke. 0.5.41 is now released with the Python 3.7 fix.

Ideally if someone could submit a PR adding 3.7-dev to the travis matrix, and resolving any remaining issues that’d be ace.