Python Classes and Modules

From Derivative
Jump to navigation Jump to search

The following list of important Python classes and modules is roughly grouped together by subject.

Python Reference has an alphabetical list of all TouchDesigner Python pages on this wiki.

Operator Related Classes[edit]

The following classes are Python interfaces for operators and objects that operators use. Individual operator classes (e.g. TextTOP Class and RampTOP Class) are not listed but do exist in the td module, and links to each can be found here or by clicking on the Python Help button in their parameter dialog. These classes are found in the td module so do not need to be imported.

Helper Classes[edit]

The following helper objects are part of the td module and can thus be accessed anywhere, including expressions, without imports (e.g. absTime.frame).

Standard Python Modules[edit]

The td module also automatically imports a number of helpful standard modules, allowing them to be accessed in expressions through their namespace (e.g. math.cos(math.pi)):

  • collections - container datatypes
  • enum - support for enumerations
  • inspect - inspect live objects
  • math - mathematical functions
  • re - regular expression operations
  • sys - OS specific data and functions
  • traceback - stack utilities
  • warnings - warning control

TouchDesigner Utility Modules and Python Utilities[edit]

The following contain extended Python utilities for use with TouchDesigner.

3rd Party Packages[edit]

The following 3rd party packages are automatically installed with TouchDesigner. They are not in the td module, so must be imported explicitly to be used in scripts. The name in parentheses is the actual package name used (e.g. to use OpenCV, write this at top of script: import cv2). For information on adding or installing other Python modules, see Importing Modules.

  • asn1crypto (asn1crypto) - Parsing and serializing ASN.1 structures
  • Authlib (authlib) - Library to build OAuth and OpenID Connect servers.
  • Certifi (certifi) - Root Certificates for validating the trustworthiness of SSL certificates while verifying the identity of TLS hosts
  • CFFI (cffi) - Interaction with C code
  • Chardet (chardet) - The Universal Character Encoding Detector
  • Cryptography (cryptography) - High level recipes and low level interfaces to common cryptographic algorithms
  • idna (idna) - Support for the Internationalised Domain Names in Applications (IDNA) protocol
  • jsonpath (jsonpath_ng) - JSONPath tools for accessing and altering JSON structures
  • MWParserFromHell (mwparserfromhell) - An easy-to-use and outrageously powerful parser for MediaWiki wikicode
  • NumPy (numpy) - Fundamental package for scientific computing with Python
  • OpenCV (cv2) - Open source computer vision.
  • packaging (packaging) - Package tools including version handling, specifiers, markers, requirements, tags, utilities. Used for version string comparison.
  • ply (ply) - Parsing tools for lex and yacc.
  • pyparsing (pyparsing) - A library of classes that client code uses to construct parsing grammar directly in Python code.
  • Requests (requests) - The only Non-GMO HTTP library for Python, safe for human consumption
  • Requests OAuthlib (requests_oauthlib) - Easy-to-use Python interface for building OAuth1 and OAuth2 clients
  • urllib3 (urllib3) - HTTP client
  • PyYAML (yaml) - YAML parser and emitter

Installing Custom Packages and Modules[edit]

You can also install your own Python packages that are not included with TouchDesigner. For instructions, go here.