six: metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Some time in the last 12 hours, our build system using gsutil
started failing and it appears to be related to six
1.11.0, which was just released.
$ gsutil
...
File "myproject/venv/lib/python2.7/site-packages/apitools/base/protorpclite/messages.py", line 1168, in <module>
class Field(six.with_metaclass(_FieldMeta, object)):
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
gsutil
declares a dependency on six>=1.9.0 (ugh) so it pulls in the just released 1.11.0. Rolling back to six 1.10.0 and gsutil runs alright. I’m not really involved in Python or gsutil, so maybe gsutil needs to fix something, no idea, but it seems like a breakage that’s not called out in the release notes or maybe something to fix.
cc @jdemeyer @benjaminp Possibly introduced in https://github.com/benjaminp/six/pull/191
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 17
- Comments: 28 (13 by maintainers)
Commits related to this issue
- Fixed TypeError: Error when calling the metaclass bases. Details: The `PywbemLoggers` class was defined by inheriting from `six.with_metaclass(MetaPywbemLoggers)` and it also defined the `__metaclas... — committed to pywbem/pywbem by andy-maier 7 years ago
- Trying to pin `six` dependency until fixed. https://github.com/benjaminp/six/issues/210 — committed to grow/grow by Zoramite 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to planetfederal/geonode by deleted user 7 years ago
- Merge pull request #73 from boundlessgeo/six_fix Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to planetfederal/geonode by deleted user 7 years ago
- Version constrain six, see https://github.com/benjaminp/six/issues/210 — committed to amirahav/geonode by deleted user 7 years ago
- Merge pull request #3300 from amirahav/version_constrain_six Version constrain six, see https://github.com/benjaminp/six/issues/210 — committed to GeoNode/geonode by travislbrundage 7 years ago
- [BEAM-2964] Exclude incompatible six release. Upstream bugs being tracked at https://github.com/google/apitools/issues/175 and https://github.com/benjaminp/six/issues/210 — committed to robertwb/incubator-beam by robertwb 7 years ago
- [BEAM-2964] Exclude incompatible six release. Upstream bugs being tracked at https://github.com/google/apitools/issues/175 and https://github.com/benjaminp/six/issues/210 — committed to apache/beam by robertwb 7 years ago
- [BEAM-2964] Exclude incompatible six release. Upstream bugs being tracked at https://github.com/google/apitools/issues/175 and https://github.com/benjaminp/six/issues/210 — committed to apache/beam by robertwb 7 years ago
- Version constrain six, see https://github.com/benjaminp/six/issues/210 — committed to cuttlefish/geonode by cuttlefish 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to planetfederal/geonode by deleted user 7 years ago
- FIX: do not use both `with_metaclass` and `__metaclass__` See https://github.com/benjaminp/six/issues/210 closes #276 — committed to tacaswell/pims by tacaswell 7 years ago
- FIX: do not use both `with_metaclass` and `__metaclass__` See https://github.com/benjaminp/six/issues/210 closes #276 — committed to soft-matter/pims by tacaswell 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to travislbrundage/geonode by deleted user 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to travislbrundage/geonode by deleted user 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to travislbrundage/geonode by deleted user 7 years ago
- Version constrain six see https://github.com/benjaminp/six/issues/210 — committed to travislbrundage/geonode by deleted user 7 years ago
- Fixed Choices to support six>1.8. (See https://github.com/benjaminp/six/issues/210) — committed to konr4d/dj.choices by konr4d 5 years ago
With so many different projects impacted by #191, often its best to revert the commit in question and cut a point release to mitigate the issue. Reverts are easier to get in. Later, you can write and discuss a new implementation with the maintainers and if there really is a breaking change, draft a changelog note about it.
I have a fix for the
__metaclass__
issue at #211.I have the same issue with some Google libraries:
Looking at the 3rd party package code that triggers the error, it boils down to this:
Removing the
__metaclass__
prevents the TypeError.Got the same issue using a Django package.
As discussed above, this is wrong: you should not combine
six.with_metaclass
and__metaclass__
. However, as many people seem to do this, it’s becoming clear that a fix is needed.The issue in
google-apitools
is the same: