# The Twisted Zope Interfaces FAQ

## Twisted components system in 2.0

Twisted code's own use of the `twisted.python.components` package has been updated to use Zope Interfaces in the 2.0 release.

New code developed starting with the 2.0 release of Twisted Core should use Zope Interfaces directly rather than using the twisted.python.components package.

## FAQ

### Why did Twisted switch to Zope Interfaces?

The twisted.python.components package is a large amount of on-going maintenance. Using the Zope Interface package also provides a greater level of compatibility between Twisted interfaces and Zope interfaces.

### Why did Twisted switch to Zope Interfaces rather than PyProtocols?

The Zope Interface package was chosen over PyProtocols because of its greater conceptual similarity to twisted.python.components.

### Will this affect my deployment?

No. Releases of Twisted Core will include Zope Interfaces.

### How can I update my own code?

Classes written using twisted.python.components declare which interfaces they implement in this style:

`class C: __implements__ = IFoo,`

This should be changed to:

`class C: zope.interface.implements(IFoo)`

### What about third party classes dependant on the old style of implements declarations?

Use `backwardsCompatImplements` to fix this.

`twisted.python.components.backwardsCompatImplements(C)`

### What about using third party classes?

If you are using third party libraries that only declare __implements__, these objects should be made compatible with `fixClassImplements`:

`# import o where o is some third party library from thirdparty.lib import o twisted.python.components.fixClassImplements(o.__class__)`

This will make sure that __implements__ declarations get converted to the new style of implements declarations.

## Acknowledgements

This document is the work of Jason A. Mobarak, with contributions from Mary Gardiner.

Index

Version: 10.2.0