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

Enhancement (of new feature): JupyterLab docker image and documentation for manim and IPython #977

Merged
merged 8 commits into from
Jan 31, 2021

Conversation

behackl
Copy link
Member

@behackl behackl commented Jan 28, 2021

Motivation

Follow-up to #943: documentation and docker image. The ultimate goal of this PR is to have a Jupyter notebook in, e.g., example_scenes which can be run with one click (e.g. via a badge) in an interactive environment (Google colab / binder / suggestions welcome).

Overview / Explanation for Changes

Work in progress.

Oneline Summary of Changes

- Enhancement (of new feature): JupyterLab docker image and documentation for manim and IPython (:pr:`PR NUMBER HERE`)

Acknowledgements

Reviewer Checklist

  • Newly added functions/classes are either private or have a docstring
  • Newly added functions/classes have tests added and (optional) examples in the docs
  • Newly added documentation builds, looks correctly formatted, and adds no additional build warnings
  • The oneline summary has been included in the wiki

@behackl
Copy link
Member Author

behackl commented Jan 29, 2021

I have not found a good solution of how to run our image on mybinder.org yet. Unfortunately, poetry is not yet supported (but might be, at some point: jupyterhub/repo2docker#972), but only setup.py builds.

Otherwise, we would have to create a new repository containing the setup for an appropriate environment (either via a Dockerfile or using conda and some apt-installs; both seem to be possible), and add the ipython notebook there. I'm not particularly in favor of this approach, but I don't really see another way around it right now.

@naveen521kk
Copy link
Member

I have not found a good solution of how to run our image on mybinder.org yet. Unfortunately, poetry is not yet supported (but might be, at some point: jupyterhub/repo2docker#972), but only setup.py builds.

I don't know how things work there. Why not try for a build from PyPi packages? It contains a setup.py.
Or if that doesn't work you can use build to easily get source archives ready from which you can install from. Also, I don't see a particular use case in creating a new-repo just for this.

@behackl
Copy link
Member Author

behackl commented Jan 29, 2021

Have a look at https://mybinder.org/ -- It takes the link to a repository or gist, and then provides an environment based on what it finds there.

Given that installation via poetry is not supported yet, I don't see a way other than

  • including an environment.yml to our main repository (which I feel is sort of weird)
  • or setting up an appropriate environment in a new repository.

I don't see a better way yet; in particular I can't install via pypi or run custom commands without adding a root-level Dockerfile (which I want to avoid).

@behackl
Copy link
Member Author

behackl commented Jan 29, 2021

I've played around a bit more; as long as poetry-based installations are not supported, there is not much we can do (from this repository).

However, after slightly modifying the existing Dockerfile (with the changes from this PR), and a rather simple gist (see https://gist.github.com/behackl/725d956ec80969226b7bf9b4aef40b78), I can offer an interactive environment like this: https://mybinder.org/v2/gist/behackl/725d956ec80969226b7bf9b4aef40b78/HEAD -- I've just tested the deployed version, and it seems to work (cool stuff; I'm pretty excited about it!)

If you are, for now, satisfied with such an approach, I'd recommend that we include a README badge to this binder environment and advertise it here and there in the documentation.

Please try it out and let me know whether an approach like that would be okay with you.

@behackl
Copy link
Member Author

behackl commented Jan 30, 2021

I've added some documentation and included an explicit hint that the worksheet is only temporary.

If organization-level gists were possible, I would have used that one -- the only other way is a separate repository, which I sort of feel is overkill. I'm willing to change that, though, if any of you think that it would be more appropriate.

This covers everything I wanted to do for this PR, it is ready for review.

@behackl behackl marked this pull request as ready for review January 30, 2021 12:04
@kolibril13
Copy link
Member

Nice!
The binder example works fine for me, and I really like this convenient way of using manim.
One nitpick: our new badges look like this:
image
Here the question: why is the label of the docker image "jupyter"?
Are there two docker files, one for manim only and one for manim+jupyter?
In this case, it would make sense to have two separate docker badgets.
And further idea: do we want to sort the badgets like this: 1. pypi , 2. docer, 3. lunch binder 4... rest ?

@behackl
Copy link
Member Author

behackl commented Jan 30, 2021

Here the question: why is the label of the docker image "jupyter"?

This is a side effect of how I needed to set things up: I needed a tagged docker image corresponding to the changes from this branch; I've named the tag jupyter for now -- but that can be changed to v0.2.1 as soon as it is released. (The otherwise usual choice, latest is not allowed on binder.)

The badge always displays the most recently pushed image; the same is currently shown on master -- and it will be fixed as soon as we merge any other PR (at which point the badge will display latest again).

Are there two docker files, one for manim only and one for manim+jupyter?

There is one Dockerfile for manim which also includes the installation of jupyterlab; the old image was more minimal, this new one also contains a jupyterlab installation. And not included in this PR is the Dockerfile required for deploying the environment to binder, which is simply

FROM manimcommunity/manim:jupyter
COPY --chown=manimuser:manimuser . /manim

or so.

In this case, it would make sense to have two separate docker badgets.

One binder-badge and one Docker-badge is the way to go.

And further idea: do we want to sort the badgets like this: 1. pypi , 2. docer, 3. lunch binder 4... rest ?

I'm fine with reordering the badges in any way you see fit; would you simply commit your suggestion?

@kolibril13
Copy link
Member

Nice!
I've reordered them now.
Looks good to me now

@behackl behackl mentioned this pull request Jan 31, 2021
@behackl behackl merged commit 60c225a into ManimCommunity:master Jan 31, 2021
@behackl behackl deleted the jupyterlab-docs-and-docker branch January 31, 2021 17:24
@naveen521kk
Copy link
Member

naveen521kk commented Jan 31, 2021

@behackl did you miss out google collab link?

@behackl
Copy link
Member Author

behackl commented Jan 31, 2021

@behackl did you miss out google collab link?

After messing around to get a working version of binder up and running, I didn't want to invest a similar amount of energy into a colab worksheet. If you want to go ahead and prepare one, I'm happy to review it -- but I don't want to take care of it myself.

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