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

Added a documentation page with a pythreejs example. #262

Merged
merged 16 commits into from
Aug 13, 2021

Conversation

moorepants
Copy link
Collaborator

No description provided.

@welcome
Copy link

welcome bot commented Oct 17, 2020

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.

Welcome to the EBP community! 🎉

@moorepants
Copy link
Collaborator Author

I get:

image

@moorepants
Copy link
Collaborator Author

moorepants commented Oct 17, 2020

Here's some of the console output:
image

@moorepants
Copy link
Collaborator Author

Ok, I can get the objects to display, just not the display() call. Thanks @sandertyu.

@moorepants
Copy link
Collaborator Author

When display() is called I get TypeError: this.kernel is undefined in the console, among other things.

docs/index.rst Outdated
@@ -100,5 +100,6 @@ Horizon 2020 European Research Infrastructure project (676541).
config_reference
howto/initialize_cells
minimal_example
pythreejs-example
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to add the example under examples section of the docs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but none of those are in the Sphinx docs. This table of contents toc typically shows all the rst files. The examples in examples/ need to be moved into the Sphinx docs and then we could have an examples section in the table of contents.

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe creating an examples directory in the sphinx docs is appropriate for these? It might make sense to move all of the existing examples in there

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 to moving all of our example pages to examples/ and adding a section in the docs for them specifically

I don't know that we need a separate index file for examples, we can just link them from the front page like:

.. toctree::
   :caption: Examples

   examples/ex1
   examples/ex2
   etc

does that make sense?

@moorepants
Copy link
Collaborator Author

I'm not sure what to do to get the second example working. I haven't yet found any clues other than maybe #36 and #111 aren't solved.

@moorepants
Copy link
Collaborator Author

@minrk Are there any tips for getting Ipython.display.display() to work?

@minrk
Copy link
Collaborator

minrk commented Oct 19, 2020

It's not display that's not working. Display works fine (try display(Math("$x=5$"))). It's what is being displayed that isn't working. I'm not sure exactly what's different that's making it not work, but it's useful to have the examples to share with jupyterlab and/or widgets folks who might have more insight.

@moorepants
Copy link
Collaborator Author

This example now works with the latest thebe:
image

@moorepants
Copy link
Collaborator Author

The lint test failure is fixed in #424.

@moorepants
Copy link
Collaborator Author

@TimStewartJ you could pull this branch and build the docs locally to test this example. Reviewing this PR will help you see how the example is supposed to work.

@moorepants
Copy link
Collaborator Author

@TimStewartJ will you review this PR for me?

Copy link
Contributor

@TimStewartJ TimStewartJ left a comment

Choose a reason for hiding this comment

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

Other than the comments I've left, it looks good to me.

@@ -0,0 +1,139 @@
=================
pythreejs Example
Copy link
Contributor

Choose a reason for hiding this comment

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

Every other title is capitalized, maybe this one should be too.

=================

Thebe can display output from pythreejs_. The examples are taken from the
pythreejs documentation and are licensed BSD 3 Clause.
Copy link
Contributor

Choose a reason for hiding this comment

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

A link to https://pythreejs.readthedocs.io/en/stable/examples/ or https://github.com/jupyter-widgets/pythreejs/tree/master/examples might be helpful here.

Also, I would change the wording from

... and are licensed BSD 3 Clause.

to

... and are licensed under the BSD 3-Clause License.

to match the wording of the other Thebe docs pages and pythreejs's license.

var y = Math.cos(v);
var z = Math.cos(u+v);

out.set(x,y,z)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line should have a semicolon. I've tested it with one and it works as intended.

out.set(x,y,z)
}
"""
surf_g = ParametricGeometry(func=f, slices=16, stacks=16);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this line probably shouldn't have a semicolon. It also works without it as intended.

@moorepants moorepants merged commit 915159d into jupyter-book:master Aug 13, 2021
@moorepants moorepants deleted the pythreejs-example branch August 15, 2021 19:34
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.

5 participants