Skip to content

Instantly share code, notes, and snippets.

@mthuurne
Last active December 10, 2019 00:26
Show Gist options
  • Save mthuurne/0022865c96ff6eda0c7b13bf396f4b89 to your computer and use it in GitHub Desktop.
Save mthuurne/0022865c96ff6eda0c7b13bf396f4b89 to your computer and use it in GitHub Desktop.
What is the type annotation status for Twisted's dependencies?

Twisted's Dependencies

What is the type annotation status for Twisted's dependencies?

Core

attrs

Support is built into mypy.

Automat

No type annotation support yet.

The source code includes partial type information in docstrings and via attrs.

Used internally, not part of Twisted's public interface.

constantly

No type annotation support yet.

Could this be handled just by annotations for the library itself or is a plugin required?

Hyperlink

No type annotation support yet, but there is a PR that adds type comments to the code itself.

This is used as an implementation dependency and is not currently part of Twisted's interface except for the backwards compatibility name twisted.python.url.URL.

incremental

No type annotation support yet.

Preferred solution is to add .pyi files in the package itself.

The source code does include type information in docstrings, which could be harvested to auto-generate stubs.

PyHamcrest

Type annotations are included in the source code. They will be included in the 2.0 release, not in the current 1.9.0 release.

Only used in test modules, so not relevant to Twisted's stubs.

zope.interface

A plugin for mypy exists.

Extra: TLS

pyOpenSSL, service_identity

pyOpenSSL has stubs for Python 2 in typeshed, but not for Python 3.

Some (mainly parameters) type information exists in the docstrings.

Exposed via twisted.protocols.tls, but mostly used internally.

IDNA

No type annotation support yet, no signs of any plans either.

Used internally, not part of Twisted's public interface.

Extra: Conch

cryptography

Used and exposed in various Conch modules.

Partial stubs exist in typeshed. Discussion on some blocking issues here.

bcrypt

Used internally in twisted.conch.ssh.keys.

pyasn1

Used internally in twisted.conch.ssh.keys.

appdirs

Used internally in twisted.conch.manhole_tap.

Extra: HTTP2

hyper-h2, Priority

No type annotation support yet. The developers seem interested in adding support in the future.

Some type information exists in the docstrings.

Exposed as part of twisted.web.http.H2Connection.

Extra: SOAP

SOAPpy

No releases since 2014, README suggests using a different library.

Main library doesn't support Python 3, but there is a fork that does. See also #9624.

Used by twisted.web.soap.

Extra: Serial

pyserial

No type annotation support yet, no signs of any plans either.

Used by twisted.internet.serialport. Some constants are exposed but all uses of the serial.Serial class seem to be wrapped.

Platform: Windows

pywin32

No type annotation support yet.

Exposed as part of Twisted's Win32 reactor, see twisted.internet.interfaces.IReactorWin32Events.

Used internally in a handful of modules.

Platform: macOS

pyobjc-core, pyobjc-framework-CFNetwork, pyobjc-framework-Cocoa

No type annotation support yet, but it is being considered.

Exposed as part of twisted.internet.cfreactor.CFReactor.

Is Cocoa actually used by Twisted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment