Tag Interface

class pytools.tag.Taggable(tags=frozenset({}))[source]

Parent class for objects with a tags attribute.


A frozenset of Tag instances


New in version 2021.1.

class pytools.tag.Tag[source]

Generic metadata, applied to, among other things, pytato Arrays.


A fully qualified DottedName that reflects the class name of the tag.

Instances of this type must be immutable, hashable, picklable, and have a reasonably concise __repr__() of the form dotted.name(attr1=value1, attr2=value2). Positional arguments are not allowed.


Return repr(self).

class pytools.tag.UniqueTag[source]

A superclass for tags that are unique on each Taggable.

Each instance of Taggable may have no more than one instance of each subclass of UniqueTag in its set of tags. Multiple UniqueTag instances of different (immediate) subclasses are allowed.

Supporting Functionality

class pytools.tag.DottedName(name_parts)[source]

A tuple of strings, each of which is a valid Python identifier. No name part may start with a double underscore.

The name (at least morally) exists in the name space defined by the Python module system. It need not necessarily identify an importable object.

classmethod from_class(argcls)[source]

argcls (Any) –

Return type


class pytools.tag.NonUniqueTagError[source]

Raised when a Taggable object is instantiated with more than one UniqueTag instances of the same subclass in its set of tags.