What happened to callbacks in 0.9.3?

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)

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)

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 <[email protected]> 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 [email protected].
To post to this group, send email to [email protected].
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.

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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
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.

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 [email protected] 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 [email protected] 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 [email protected] 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 [email protected].

To post to this group, send email to [email protected].

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 [email protected].

To post to this group, send email to [email protected].

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.