How to add significance stars to a Plotly boxplot

There is no general (ie smart/automatic) way to add significance asterisks or brackets in Plotly. Use shapes for brackets and annotations for asterisks/daggers/etc.

This helper function I wrote previously for making the bracket shape may be of use to you:

function bracket(xcent, width, y, yoffset, legheight; yref="y")
    path("""
            M $(xcent - width/2) $(y + yoffset - legheight)
            V $(y + yoffset)
            H $(xcent + width/2)
            V $(y + yoffset - legheight)
        """; xref="paper", yref=yref, line_width=1.5)
end