Configure type rendering
During a debugging session, PyCharm shows you information about your variables, classes, threads, frames, and so on in the Debug tool window. In most cases, the default tool window layout ensures clear, comprehensive, and accurate rendering of all the necessary details and provides you with the most commonly used options and actions.
Type renderers are also used in the Python Console and Jupyter Variable View.
Custom type renderers
PyCharm allows you to provide a completely custom display format for various objects during a debugging session. This is done using renderers. A renderer is a special setup associated with a particular type that controls how the instances of this type are displayed in the debugger. This setup is based on custom expressions that provide high level of flexibility for displaying the data.
Renderers support all types including primitives and arrays. Also, renderers disregard all access modifiers, so you can access any field irrespective of whether it is encapsulated.
Renderers are particularly useful when you are working with custom collections, whose contents aren't easily readable, and you need to identify their contents at a glance.
Add a renderer
Right-click anywhere in the Variables tab and select Customize data views.
In the <control>Python Type Renderers</control> dialog configure the newly created renderer as required.
Apply the changes and preview the updates in the Variables view.
Renderer properties
Item | Description |
---|---|
Renderer name | The name of the renderer. This name is used for managing renderers and doesn't affect how actual data is displayed. |
Apply renderer to objects of type (fully-qualified name) | The object type to which this renderer applies. Enter the fully qualified name of the class. |
When rendering a node | This option determines how an object itself is displayed:
|
When expanding a node | This option determines how the contents of an object are displayed when it is expanded.
|
Append default children | Controls whether the fields of the object (that would be normally displayed when no renderer is specified) should appear along with the expression results. This option is only available with Use list of expressions. |
Remove a renderer
Right-click anywhere in the Variables tab and select Customize data views.
On the <control>Python Type Renderers</control> tab, select the renderer that you are going to remove and click Remove Delete.
Mute renderers
You can temporarily disable renderers without removing them altogether:
To mute a single renderer, right-click anywhere in the Variables tab and select Customize data views. On the <control>Python Type Renderers</control> tab, clear the box against the renderer you are going to mute.
When required, you can unmute the renderers using the same procedure.