Annoying logging to console when using panel tabulator with styling

Given the following:

import numpy as np
import pandas as pd
import panel as pn

pn.extension('tabulator')
style_df = pd.DataFrame(np.random.randn(4, 5), columns=list('ABCDE'))
styled = pn.widgets.Tabulator(style_df)


def color_negative_red(val):
    """
    Takes a scalar and returns a string with
    the css property `'color: red'` for negative
    strings, black otherwise.
    """
    color = 'red' if val < 0 else 'black'
    return 'color: %s' % color


def highlight_max(s):
    """
    highlight the maximum in a Series yellow.
    """
    is_max = s == s.max()
    return ['background-color: yellow' if v else '' for v in is_max]


styled.style.applymap(color_negative_red).apply(highlight_max)

styled.servable()
panel serve app.py

There is console output:

(<function Styler.applymap.<locals>.<lambda> at 0x7f2a36c7bbe0>, (<function color_negative_red at 0x7f2a36c7bac0>, None), {})
(<function Styler.apply.<locals>.<lambda> at 0x7f2a36c7bc70>, (<function highlight_max at 0x7f2a36c7bb50>, 0, None), {})

This is annoying when I have an app that is applying a lot of styling in different places, then that’s all I see in the console.

My guess is there’s a debugging console.log somewhere in the codebase left behind.

1 Like

It’s my fault, I left a stray print. Good news is that this precipitated us adding linting to catch this in the future. Will be fixed in 1.3.5 tomorrow.

2 Likes

Panel 1.3.5 postponed until tomorrow due to COVID taking hold in my house :slight_smile:

1 Like

Thanks @philippjfr I see that the release is now out! I hope that you and family are recovering well :pray: