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

feat!: Set up gitpod IDE - a browser-based/zero-install VSCode clone - #591

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lemmy
Copy link

@lemmy lemmy commented Apr 11, 2020

Set up gitpod IDE - a browser-based/zero-install VSCode clone - for the Dafny online tutorial.

Try it out yourself at https://gitpod.io/#https://github.com/dafny-lang/dafny/

Screencast/demo at https://tla.msr-inria.inria.fr/kuppe/gitpod-dafny.mp4

rise4fun has reached its lifetime and capacity (TLA has started to use a similar setup for its examples: https://github.com/tlaplus/Examples/blob/master/README.md)

@lemmy
Copy link
Author

lemmy commented Apr 11, 2020

If the image statement in .gitpod.yml is changed from:

image:
  file: .gitpod.dockerfile

to:

image: lemmster/gitpod-dafny:latest

the initial time to spin up the instances is reduced from a few minutes to 20-30 seconds. However, it adds an additional dependency (to my custom docker image).

@robin-aws
Copy link
Member

#594 should fix the SSL-related build failure once it's merged

Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

This is an awesome approach! I love being able to leverage the VS Code plugin for this.

A few top-level suggestions:

  • Can we add the "Ready to Code" link to the readme as gitpod suggests too? [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/dafny-lang/dafny)
  • It would be good to address a couple additional gaps between what's in the repo and whats on rise4fun.com as well (this could be in a follow-up PR though):
  • It's unfortunate that the gitpod preview window doesn't highlight Dafny code correctly, but that's something I happen to be investigating right now anyway. :)

Comment on lines +10 to +11
- command: gp open Docs/OnlineTutorial/guide.md
- command: gp open Docs/OnlineTutorial/guide.dfy
Copy link
Member

Choose a reason for hiding this comment

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

This is a good start, but can we go a little further and open the guide.md preview automatically as well? Ideally I'd love for the initial state to be guide.dfy on the left and the preview on the right.

Copy link
Author

Choose a reason for hiding this comment

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

I pinged the authors of gitpod and they say neither is currently supported.

Copy link
Member

Choose a reason for hiding this comment

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

That's too bad. I would suggest we add some instructions at the top of guide.dfy for opening the preview then.

Alternatively, we could render the content with a markdown engine that supports Dafny syntax (I'm about to add a KDE syntax definition which pandoc can use) and commit the result, just as we do for the Dafny reference.

@@ -0,0 +1,11 @@
image: lemmster/gitpod-dafny:latest
Copy link
Member

Choose a reason for hiding this comment

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

Let's just use the dockerfile for now as you suggested, to avoid the dependency. I'm assuming you only have to wait for the instance spin-up the first time you open a repo in gitpod?

Copy link
Author

Choose a reason for hiding this comment

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

I'd assume they have clever caching for all users, but I actually don't know. Here is what I did to create the image:

sudo apt install docker.io
## login with your docker hub credentials.
docker login
## in the local git repository:
docker build -t lemmster/gitpod-dafny -f .gitpod.dockerfile .
## Publish on docker hub.
docker push lemmster/gitpod-dafny

In other words, you could create your own pre-build image.

Copy link
Member

Choose a reason for hiding this comment

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

Cool - I'd be happy to consider maintaining such an image under the dafny-lang umbrella in the future. Are you comfortable with deferring that for now?


vscode:
extensions:
- [email protected]:y0vNEkuQw4SUFvPIFxLkEA==
Copy link
Member

Choose a reason for hiding this comment

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

Do you know what the ID after the colon is for?

Copy link
Author

Choose a reason for hiding this comment

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

With gitpod one has to manually install extension by:

a) Manually download VSCode extension from https://marketplace.visualstudio.com/items?itemName=correctnessLab.dafny-vscode
b) Spin-up a gitpod instance
c) Manually install correctnessLab.dafny-vscode-0.17.1.vsix in gitpod
d) .gitpod.yml is modified and lists new extension

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, I read up on the docs and this looks standard, I was just curious.

@robin-aws
Copy link
Member

One further thought: it might make sense to move the tutorial and samples to a separate repository, just as TLA+ has done. It may be somewhat confusing to assume that someone loading the Dafny repo itself in gitpod is intending to use the tutorial rather than develop Dafny itself.

@lemmy
Copy link
Author

lemmy commented Apr 13, 2020

One further thought: it might make sense to move the tutorial and samples to a separate repository, just as TLA+ has done. It may be somewhat confusing to assume that someone loading the Dafny repo itself in gitpod is intending to use the tutorial rather than develop Dafny itself.

Please have a look at https://github.com/lemmy/dafny-sort/

@lemmy
Copy link
Author

lemmy commented Apr 13, 2020

This is an awesome approach! I love being able to leverage the VS Code plugin for this.

A few top-level suggestions:

* Can we add the "Ready to Code" link to the readme as gitpod suggests too? `[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/dafny-lang/dafny)`

* It would be good to address a couple additional gaps between what's in the repo and whats on rise4fun.com as well (this could be in a follow-up PR though):
  
  * https://rise4fun.com/Dafny/tutorial/Guide has links at the bottom to the additional tutorial files (Lemmas.md etc.)
  * https://rise4fun.com/Dafny has several nice, simple Dafny samples linked in the bottom left corner (e.g. Hello.dfy) which would be good to include

* It's unfortunate that the gitpod preview window doesn't highlight Dafny code correctly, but that's something I happen to be investigating right now anyway. :)

For gitpod, it might make more sense to convert the markdown guide into a single or set of .dfy files => No need to copy snippets from markdown.

Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

Shoot, just realized I never hit the submit button on this.

For gitpod, it might make more sense to convert the markdown guide into a single or set of .dfy files => No need to copy snippets from markdown.

I think these end up being different beasts, though - a markdown guide can narrate things selectively, out of order, etc. A source file with lots of comments can't do that.

@@ -0,0 +1,11 @@
image: lemmster/gitpod-dafny:latest
Copy link
Member

Choose a reason for hiding this comment

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

Cool - I'd be happy to consider maintaining such an image under the dafny-lang umbrella in the future. Are you comfortable with deferring that for now?


vscode:
extensions:
- [email protected]:y0vNEkuQw4SUFvPIFxLkEA==
Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, I read up on the docs and this looks standard, I was just curious.

Comment on lines +10 to +11
- command: gp open Docs/OnlineTutorial/guide.md
- command: gp open Docs/OnlineTutorial/guide.dfy
Copy link
Member

Choose a reason for hiding this comment

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

That's too bad. I would suggest we add some instructions at the top of guide.dfy for opening the preview then.

Alternatively, we could render the content with a markdown engine that supports Dafny syntax (I'm about to add a KDE syntax definition which pandoc can use) and commit the result, just as we do for the Dafny reference.

@lemmy
Copy link
Author

lemmy commented Apr 28, 2020

@robin-aws May I assume that you are going to put on the finishing touches that you mention above?

@robin-aws
Copy link
Member

@robin-aws May I assume that you are going to put on the finishing touches that you mention above?

I'm not sure when we'll have the time to in the immediate future, to be honest, but I'm willing in theory.

We're also still thinking about the best way to host the tutorial, so we may let this sit for a little while longer just to make sure the experience is optimal for new users/contributors to Dafny.

@parno
Copy link
Collaborator

parno commented Sep 21, 2020

This seems like a cool idea! I'd love to use something like this in my classes.

FWIW, when I try running the GitPod (https://gitpod.io/#https://github.com/dafny-lang/dafny/), it looks like it's setup to work on the Dafny project, but when I open a Dafny file (e.g., myfile.dfy), it seems like the Dafny extension is not installed; it doesn't prompt me to install the Dafny extension, and when I search for extensions via VS Code, it doesn't find any.

@lemmy
Copy link
Author

lemmy commented Sep 21, 2020

This seems like a cool idea! I'd love to use something like this in my classes.

FWIW, when I try running the GitPod (https://gitpod.io/#https://github.com/dafny-lang/dafny/), it looks like it's setup to work on the Dafny project, but when I open a Dafny file (e.g., myfile.dfy), it seems like the Dafny extension is not installed; it doesn't prompt me to install the Dafny extension, and when I search for extensions via VS Code, it doesn't find any.

The link only works with this PR merged (it is not). If you want to toy with Dafny on Gitpod, you can try https://gitpod.io/#https://github.com/lemmy/dafny-sort/

In the long run, Github codespaces are, perhaps, be the better infrastructure to build all of this on.

@parno
Copy link
Collaborator

parno commented Sep 21, 2020

Ah, okay, thanks that makes sense. I didn't look carefully enough at the URLs.

@lemmy
Copy link
Author

lemmy commented Jan 27, 2021

Is there still interest in this PR?

@robin-aws
Copy link
Member

Hi lemmy! I agreed with your point about codespaces being potentially a better option, and I've been trying to find time to evaluate that before investing any more here. Since codespaces isn't generally available yet there's still a possibility this is the right call.

Let's keep this open for a bit longer at least while I investigate.

@robin-aws
Copy link
Member

@lemmy: I followed your TLA link to look at how they hooked gitpod up, but I don't see any evidence of it there any more: https://github.com/tlaplus/Examples/blob/master/README.md

Am I missing something or was the integration removed?

@lemmy
Copy link
Author

lemmy commented Feb 3, 2021

@lemmy: I followed your TLA link to look at how they hooked gitpod up, but I don't see any evidence of it there any more: https://github.com/tlaplus/Examples/blob/master/README.md

Am I missing something or was the integration removed?

I haven't gotten around to adding it for all examples. It's only on for one of them: https://gitpod.io/#https://github.com/lemmy/BlockingQueue/blob/master/BlockingQueue.tla

The config is at https://github.com/lemmy/BlockingQueue/blob/master/.gitpod.yml

@ghuntley
Copy link

👋 from Gitpod. I've added all of the folks in the dafny-lang GitHub organization as pre-qualified for automatic plan upgrades as part of our open-source program which provides unlimited compute. Let me know if you have any questions or need any help.

https://www.gitpod.io/blog/gitpod-for-opensource

@parno
Copy link
Collaborator

parno commented Mar 20, 2022

In light of the comment above re: free Gitpod, and given that GitHub Codespaces have been out for a while now, should we try to pick one for hosting (a) A version of the interactive Dafny tutorial, and/or (b) a setup for people wanting to help develop Dafny? The old Rise4Fun was a useful resource to point newcomers at as a zero-effort way to trying out Dafny.

@cpitclaudel
Copy link
Member

That would be very nice. In the long run, though, I would like to do something a bit more ambitious for the Dafny tutorial (something like Alectryon or fslit).

@cpitclaudel
Copy link
Member

cpitclaudel commented Mar 20, 2022

(I'm not sure whether it's a one-time thing or whether it's like that every time but I tried opening the GitPod link above and "pulling the container image" takes a very long time — compare with the experience of loading up F* + Z3 in https://people.csail.mit.edu/cpitcla/fstar.js/stlc.html, which is a few seconds at most)

image

@lemmy
Copy link
Author

lemmy commented Mar 21, 2022

@cpitclaudel I assume startup takes longer with custom Docker containers. If you open, e.g., https://gitpod.io/#https://github.com/lemmy/z3_tutorial, the IDE appears within 10 seconds and is fully provisioned in under 30 seconds.
Gitpod/Codespaces cannot compete with an entirely browser-based in terms of startup time. On the other hand, you get a full-blown IDE with all the bangs and whistles.

@cpitclaudel
Copy link
Member

@lemmy very nice, thanks!

@lemmy
Copy link
Author

lemmy commented Mar 24, 2022

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.

5 participants