☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

What happened to callbacks in 0.9.3?

Community Support
Pythonic
Pythonic

I just upgraded to 0.9.3, I am trying to set the code for a callback as shown below, I get this error:

AttributeError: unexpected attribute ‘code’ to Callback, possible attributes are name, session or tags

code = """

console.log('Hello')

""" 



source.callback = Callback(args={'slider':slider}, code=code)
⌁   Link to post
Pythonic
Pythonic

Ok ok, I should have read the release first…

···

On Sunday, 30 August 2015 00:14:03 UTC+1, Pythonic wrote:

I just upgraded to 0.9.3, I am trying to set the code for a callback as shown below, I get this error:

AttributeError: unexpected attribute ‘code’ to Callback, possible attributes are name, session or tags

code = """
console.log('Hello')
""" 
source.callback = Callback(args={'slider':slider}, code=code)
⌁   Link to post
Bryan
Bryan

Well, I think the intent was for a working, smooth deprecation, so it should have worked and printed a warning.

···

On Aug 30, 2015, at 12:15 AM, Pythonic <gsp.sette@gmail.com> wrote:

Ok ok, I should have read the release first...

On Sunday, 30 August 2015 00:14:03 UTC+1, Pythonic wrote:
I just upgraded to 0.9.3, I am trying to set the code for a callback as shown below, I get this error:

AttributeError: unexpected attribute 'code' to Callback, possible attributes are name, session or tags

    code = """
    console.log('Hello')
    """

    source.callback = Callback(args={'slider':slider}, code=code)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4f660cea-10f1-40da-8c2c-3a21decf446f%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Bryan
Bryan

So, here is the problem: A deprecation function for bokeh.models.actions.Callback is in fact here:

  https://github.com/bokeh/bokeh/blob/master/bokeh/models/actions.py#L22

But bokeh.models convenience imports the new bokeh.models.callbacks, which has a new Callback base class here:

  https://github.com/bokeh/bokeh/blob/master/bokeh/models/callbacks.py#L11

Most people are probably doing "from bokeh.models import Callback" so they are getting the new base class Callback model that does not take any properties (and so is complaining), instead of getting the deprecation function.

All, apologies for the inconvenience form the inadvertently abrupt API change. To summarize, you should now do:

  from bokeh.models import CustomJS

and use "CustomJS" anywhere you previously used "Callback".

Bryan

···

On Aug 30, 2015, at 1:01 AM, James Bednar <jbednar@continuum.io> wrote:

Aron A. and I found that it just broke, with no deprecation, but he thought that it was not something documented from 0.9.2 and thus not needing it. Apparently not!

Jim

On Sat, Aug 29, 2015 at 6:46 PM, Bryan Van de Ven <bryan@bokeh.org> wrote:
Well, I think the intent was for a working, smooth deprecation, so it should have worked and printed a warning.

> On Aug 30, 2015, at 12:15 AM, Pythonic <gsp.sette@gmail.com> wrote:
>
> Ok ok, I should have read the release first...
>
>
>
> On Sunday, 30 August 2015 00:14:03 UTC+1, Pythonic wrote:
> I just upgraded to 0.9.3, I am trying to set the code for a callback as shown below, I get this error:
>
>
> AttributeError: unexpected attribute 'code' to Callback, possible attributes are name, session or tags
>
> code = """
> console.log('Hello')
> """
>
> source.callback = Callback(args={'slider':slider}, code=code)
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
> To post to this group, send email to bokeh@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4f660cea-10f1-40da-8c2c-3a21decf446f%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/B6530BEF-442A-490E-AE3D-03AFC8761C52%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Pythonic
Pythonic

Many thanks for the feedback (in any case I should have read the release before posting, but good if it can help clarify for other people)

And yes, definitely I can imagine most are doing “from bokeh.models import Callback”

···

On Sunday, 30 August 2015 01:16:49 UTC+1, Bryan Van de ven wrote:

So, here is the problem: A deprecation function for bokeh.models.actions.Callback is in fact here:

    [https://github.com/bokeh/bokeh/blob/master/bokeh/models/actions.py#L22](https://github.com/bokeh/bokeh/blob/master/bokeh/models/actions.py#L22)

But bokeh.models convenience imports the new bokeh.models.callbacks, which has a new Callback base class here:

    [https://github.com/bokeh/bokeh/blob/master/bokeh/models/callbacks.py#L11](https://github.com/bokeh/bokeh/blob/master/bokeh/models/callbacks.py#L11)

Most people are probably doing “from bokeh.models import Callback” so they are getting the new base class Callback model that does not take any properties (and so is complaining), instead of getting the deprecation function.

All, apologies for the inconvenience form the inadvertently abrupt API change. To summarize, you should now do:

    from bokeh.models import CustomJS

and use “CustomJS” anywhere you previously used “Callback”.

Bryan

On Aug 30, 2015, at 1:01 AM, James Bednar jbe...@continuum.io wrote:

Aron A. and I found that it just broke, with no deprecation, but he thought that it was not something documented from 0.9.2 and thus not needing it. Apparently not!

Jim

On Sat, Aug 29, 2015 at 6:46 PM, Bryan Van de Ven bry...@continuum.io wrote:

Well, I think the intent was for a working, smooth deprecation, so it should have worked and printed a warning.

On Aug 30, 2015, at 12:15 AM, Pythonic gsp....@gmail.com wrote:

Ok ok, I should have read the release first…

On Sunday, 30 August 2015 00:14:03 UTC+1, Pythonic wrote:

I just upgraded to 0.9.3, I am trying to set the code for a callback as shown below, I get this error:

AttributeError: unexpected attribute ‘code’ to Callback, possible attributes are name, session or tags

code = """
console.log('Hello')
"""
source.callback = Callback(args={'slider':slider}, code=code)

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/4f660cea-10f1-40da-8c2c-3a21decf446f%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/B6530BEF-442A-490E-AE3D-03AFC8761C52%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled