Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of user-defined models #2800

Merged
merged 58 commits into from Sep 28, 2015
Merged

Conversation

mattpap
Copy link
Contributor

@mattpap mattpap commented Sep 1, 2015

This will include split of bokehjs as well at some point. This PR is intentionally based on master. To test this, try out glyphs/custom example. Click on a circle and a popup window should appear with a message including fill color of the circle.

This is required to make sure bokehjs doesn't depend on require()
provided by the parent environment. It's also helpful for debugging.
This is needed to support meaningful module identifiers. By default,
monotonically increasing counter is used by browserify, to reduce
bundle size. However, we need to identify modules after compilation,
so we need more meaningful IDs. New IDs are based on module path,
just system-independent and with prefix and extension removed.
This allows users to extend bokehjs' functionality with custom
behaviour, e.g. add new tools, actions/callbacks, etc. To make
a custom model, the user has to provide __implementation__ field
which is a string with CoffeeScript source code.
Conflicts:
	bokeh/embed.py
	bokehjs/package.json
@damianavila damianavila modified the milestones: 0.9.4, 0.10.0 Sep 2, 2015
@datnamer
Copy link

datnamer commented Sep 4, 2015

Hi Matt,

Thanks for working on this, I'm looking forward to it.

It would be great to be able to easily use pyscript , like in #2799, instead of writing JS for this feature, as an option. Is this feasible?

@fpliger
Copy link
Contributor

fpliger commented Sep 9, 2015

@mattpap this is really awesome! If I understand correctly the goal it'd also make very easy to write "bokeh extentions" to add new sets of widgets based on other web UI libs out there..

@mattpap
Copy link
Contributor Author

mattpap commented Sep 9, 2015

@datnamer, pyscript is just a different syntax from what is supported in this PR, so it's not a concern of this PR. But yes, I think it's feasible to support it as soon as we figure out the semantics of this feature. It actually may be even simpler to implement than the current in-browser compilation of coffeescript. On a side note, bokeh is not only Python, but also R, Scala, etc., so whatever "nice" syntax we support, we have to also have the common default for other languages/platforms/runtime environments.

@mattpap
Copy link
Contributor Author

mattpap commented Sep 9, 2015

to add new sets of widgets based on other web UI libs out there..

@fpliger, this might be the case, but it depends how deeply such developments have to integrate with bokehjs. For now I'm only considering simple extensions like this Popup callback. The problem is that bokehjs's components are tightly bound together, use private APIs a lot, etc., so it may not be that simple.

@datnamer
Copy link

@mattpap Gotcha, makes sense. +1 on my end to extensive custom UI and widget support :)

@mattpap
Copy link
Contributor Author

mattpap commented Sep 21, 2015

@damianavila, both merged. I'm still working on making bokeh-widgets.js optional (at least in file_html() case), but this doesn't have to happen in this PR.

This way there is little chance we will interfere with the parent
environment. It would be best if we didn't have to set any globals
at all, but this may not be possible.
@damianavila
Copy link
Contributor

Some tests are still failing @mattpap

Also, this a big PR... I have made a general overview and looks OK at overall, but next time we should be more strict with ourselves and not merge big PRs like this one just before the release without an actual detailed review...

Please @mattpap don't take this against you... I certainly know this PR has low probabilities to introduce bugs, essentially because you write it, but we should make our review process better...

ping @bokeh/core, sorry to be annoying with these kind of things, but I think this is pretty important...

BTW, testing the examples now ...

I will push the fix for the building machinery to get this new js and css into the CDN and merge this one after the test are fixed...

I'm still working on making bokeh-widgets.js optional (at least in file_html() case), but this doesn't have to happen in this PR.

Yes, I agree...

@mattpap
Copy link
Contributor Author

mattpap commented Sep 21, 2015

Some tests are still failing

@damianavila, the fun part is that I ran py.test and it was all green. Obviously it should fail. The error is trivial and introduced during merge. The bonus is that, although py.test picks up the same number of tests locally and on travis-ci, it doesn't matter what I put in those tests, it always succeeds.

@mattpap
Copy link
Contributor Author

mattpap commented Sep 21, 2015

Just now I noticed this: 453 tests deselected by "-m 'nondestructive'". Can anyone explain this? @birdsarah?

@mattpap
Copy link
Contributor Author

mattpap commented Sep 21, 2015

Please @mattpap don't take this against you... I certainly know this PR has low probabilities to introduce bugs, essentially because you write it, but we should make our review process better...

@damianavila, I'm actually against merging this PR as-is, because, on the contrary, it has very high probability of introducing (possibly subtle) bugs. I'm just following the general desire to have this merged for 0.10.

ping @bokeh/core, sorry to be annoying with these kind of things, (...)

That's not annoying. The sole fact that you are forced to ping the team multiple times is annoying.

'css_files' : ['%sbokehjs/static/css/bokeh%s.css' % (root_url, _min)],

def mk_url(comp, tp):
_comp = '-' + comp if comp else ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also worried about this line... because you get something like:

...bokehjs/static/js/-bokeh.min.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a bug. Originally comp was one of '' or 'widgets'. I moved the bokeh- prefix, make this more readable. The fun part is that server examples work. Why? Because, server doesn't use resources. I'm not sure really what uses this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a3cbc22.

@mattpap
Copy link
Contributor Author

mattpap commented Sep 21, 2015

I am missing something something obvious about why you put that code in place?

No. The same thing as with server resource URLs.

@bryevdv
Copy link
Member

bryevdv commented Sep 22, 2015

That's not annoying. The sole fact that you are forced to ping the team multiple times is annoying.

Everyone is fully committed or more likely over-committed at the moment. While I can see how this might be annoying from your viewpoint, this sort of comment is easy to read as an indictment against individuals, and is not very productive (in my opinion).

Regarding this PR: it's late in the release schedule, let's hold off.

@damianavila
Copy link
Contributor

Regarding this PR: it's late in the release schedule, let's hold off.

OK, let's wait for this one... retrying the examples they do not always work for me (sometimes clicks do not raise the alert) and with more time, making bokeh-widgets optional could be done here (or in a subsequent PR) and all the task enumerated here completed... thanks for the discussion and let continue with the review of this one after the release.

@damianavila damianavila removed this from the 0.10.0 milestone Sep 22, 2015
@bryevdv
Copy link
Member

bryevdv commented Sep 23, 2015

@mattpap please create a dev_0.11 branch from master, and re-submit this PR against that branch. We will target 0.11 for both this change and the new server, and release 0.10.x until both features are ready. Also outline what is remaining on this PR and expected effort, and what could be considered work for follow-on PRs against dev_0.11. One task I'd like to mention is splitting off the crossfilter as well, potentially even making it an example of an extensible model (i.e., don't build any bokeh-crossfilter.js to put on CDN)

@mattpap
Copy link
Contributor Author

mattpap commented Sep 23, 2015

@bryevdv, I think this PR should be left as-is and merged just after 0.10 release, and of course followed up by a few PRs with finishing touches. This way the team will have a chance to test this properly over, hopefully, sufficiently long period of time.

@bryevdv
Copy link
Member

bryevdv commented Sep 23, 2015

Merged into master? That implies there are no 0.10.x releases to me. I think something as big as changing BokehJS file structure can't go in a point release. Perhaps that's ok.

@mattpap
Copy link
Contributor Author

mattpap commented Sep 23, 2015

Yes, I should have said that explicitly, I think the next release should be 0.11, especially if we want to keep up with the 1.0 plan, you've proposed.

@mattpap mattpap added this to the 0.11 milestone Sep 23, 2015
@damianavila
Copy link
Contributor

@bryevdv, I think this PR should be left as-is and merged just after 0.10 release, and of course followed up by a few PRs with finishing touches. This way the team will have a chance to test this properly over, hopefully, sufficiently long period of time.

OK, going forward with this one, I will merge this now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants