pinax / pinax-theme-bootstrap

A theme for Pinax based on Twitter's Bootstrap
Other
268 stars 137 forks source link

pinax-theme-bootstrap and the current version of django-appconf (1.0.4) that it installs are incompatible. #149

Open pcusa-jim opened 4 years ago

pcusa-jim commented 4 years ago

We are using pinax-theme-bootstrap and encountered an issue with the https://pypi.org/project/django-appconf/ because the latest version, 1.0.4, throws a SyntaxError on "from appconf import AppConf" in pinax_theme_bootstrap/conf.py. We pip installed django-appconf version 1.0.3 to resolve the issue. I actually think that django-appconf released a bug, but we encountered it from installing pinax-theme-bootstrap, so I'm reporting it to you.

Here's a shell test I ran:

from appconf import AppConf Traceback (most recent call last): File "", line 1, in File "/Users/jphares/.virtualenv/covid19/lib/python2.7/site-packages/appconf/init.py", line 1, in from .base import AppConf # noqa File "/Users/jphares/.virtualenv/covid19/lib/python2.7/site-packages/appconf/base.py", line 107 class AppConf(metaclass=AppConfMetaClass): ^ SyntaxError: invalid syntax

blag commented 2 years ago

This should be closed - it's not an issue in pinax-theme-bootstrap or in django-appconf.

Your issue is that you're trying to use Python 2.7 with django-appconf, which only supports Python 3.

Version 1.0.3 of django-appconf used metaclass syntax that was compatible with Python 2:

class AppConf(six.with_metaclass(AppConfMetaClass)):
    """
    An app setting object to be used for handling app setting defaults
    gracefully and providing a nice API for them.
    """

But django-appconf version 1.0.4 updated to Python 3-only metaclass syntax:

class AppConf(metaclass=AppConfMetaClass):
    """
    An app setting object to be used for handling app setting defaults
    gracefully and providing a nice API for them.
    """

And that is the root of your issue.

The easiest solution is to use Python 3 for your project. Python 2.7 is dead-dead as of January 1st, 2020, and Python 3 has been around for longer than 10 years.