Skip to content

Use a built/bundled version of iventure-jsviz.js#61

Open
gnarf wants to merge 4 commits into
masterfrom
20170705-gnarf-jsviz-build
Open

Use a built/bundled version of iventure-jsviz.js#61
gnarf wants to merge 4 commits into
masterfrom
20170705-gnarf-jsviz-build

Conversation

@gnarf

@gnarf gnarf commented Jul 5, 2017

Copy link
Copy Markdown
Contributor

This uses the output from a npm run build from https://github.com/probcomp/iventure-jsviz/pull/5 which creates a dist/iventure-jsviz.js

@gnarf gnarf requested a review from fsaad July 5, 2017 17:34
Comment thread src/jsviz/jsviz.py Outdated
return Javascript(script.format(host=host, port=port))


def whenReady(script):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No camelcase for function names in python, when_ready.

Comment thread src/jsviz/jsviz.py Outdated


def whenReady(script):
"""execute your JS script when iventure-jsviz is ready"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Docsting should be punctuated as full sentence, and avoid vague references .e.g "your" (whose?)
"""Execute JS script when iventure-jsviz is ready."""

Comment thread src/jsviz/jsviz.py
return whenReady(
'interactive_bar(cell, %s)' % (
df.to_json(orient='split')
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For string formatting with a % sign and a single parameter, force the argument into a tuple using a trailing-comma (this behavior is needed mostly to handle python quirks):

return when_ready('interactive_bar(cell, %s)' % (df.to_json(orient='split'),))

@riastradh-probcomp

Copy link
Copy Markdown
Contributor

@gnarf: Can you write a README for how to use this?

@gnarf

gnarf commented Jul 6, 2017 via email

Copy link
Copy Markdown
Contributor Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants