hylang / hy

A dialect of Lisp that's embedded in Python
http://hylang.org
Other
4.81k stars 368 forks source link

A new Try Hy #1816

Closed Kodiologist closed 2 years ago

Kodiologist commented 4 years ago

I deleted our documentation's links to http://try-hy.appspot.com (https://github.com/hylang/tryhy) because it's not up to date (hylang/tryhy#6), and we can't update it because we don't control it. But an in-browser Hy shell would still be a nice thing to have, especially to get newbies playing with Hy. Perhaps it can be implemented entirely in JavaScript with e.g. Skulpt so we can host it on GitHub or Read the Docs.

gilch commented 4 years ago

Skulpt is Python2 only (and 2.6-ish at that). Didn't we just drop support for that? Brython might be an option, but I'm not sure if enough of the standard library is implemented to run Hy.

The most complete browser Python I've seen is Pyodide. It's basically CPython compiled via Emscripten, so it could probably run Hy. But it's a fairly big download, so the page would load slowly.

I also wonder if a free python anywhere beginner account would be sufficient for our needs.

Kodiologist commented 4 years ago

Skulpt is Python2 only

Oh dang, so it is (skulpt/skulpt#777).

refi64 commented 4 years ago

Maybe related to #1738?

Kodiologist commented 4 years ago

Yeah, if we had both, Try Hy clearly ought to be on or linked from the fancy landing page.

proppy commented 4 years ago

Curious if https://wapm.io/package/python could also be potential solution

(btw https://github.com/hylang/tryhy/pull/7, sorry for the delay)

albertjan commented 3 years ago

Hi there, skulpt support python3 syntax now. 😄

allison-casey commented 3 years ago

Saw ya'll were looking for a Hy Playground page akin to Coconut and what not so I went ahead and built one, ya'll are welcome to it if you'd like it.

You can find a link to the WIP version here.

try-hy-interpreter

Still a few things to fix up with it, namely:

This is essentially the same setup the Coconut uses for its landing page interpreter, just a aws lambda serverless flask app deployed to a github io page.

Kodiologist commented 3 years ago

Looks cool. I think it will suffice just as well as proppy's. The important thing is that we control the live instance, so we can update the Hy version when we do a new Hy release.

allison-casey commented 3 years ago

I'd be happy to transfer ownership of the app and client code to hylang once I iron out the bugs and clean up the codebase. I'll do a little write up with how to deploy everything to lambda and githubio so ya'll can do whatever you want with it.

Kodiologist commented 3 years ago

Thanks, that sounds great. Do you want to join the hylang organization?

allison-casey commented 3 years ago

Sure! That would certainly help justify how much time i spend looking through the compiler lol

allison-casey commented 3 years ago

managed to knock out the ui stuff, codemirror syntax mode, the stack trace filtering, and wrote up how to deploy the app and client. It'll be a bit before my github.io deployment updates all the changes and it doesn't have linting on errors, but it looks like it does everything that the coconut interpreter does well enough.

Repo can be found here.

@Kodiologist How would you like me to transfer ownership to hy-lang?

Kodiologist commented 3 years ago

I think that now that you're a member of hylang, you can use some part of the repository control panel on GitHub to move the repository to hylang. Then I guess either you need to give me and @refi64 the credentials to deploy the code to that Amazon service, or we need to create a new Amazon account for Hy development. I'm not familiar with AWS (or Node.js, or Zappa, or ClojureScript, etc.).

allison-casey commented 3 years ago

I moved it over to hylang, under the core team. I don't have access to the repo anymore since i'm not core but I think you can give me permission specifically for this repo. If you do, I can set up an initial deployment under a dedicated hylang aws account and give you those credentials so you can take it from there.

Once that's up, you can probably get away with just iframe'ing it into the hy landing page.

Kodiologist commented 3 years ago

The repository settings list you as having the "Write" role, so you should still have access. Are you getting an error message when you try to read from it or push to it?

allison-casey commented 3 years ago

was just worried I didn't have permission to muck around with github io with just write permissions, but it looks like it worked out fine (You should change the github.io link in the description though). Interpreter is up here, using my lambda endpoint for now. I can set up an aws account for hylang, but I think you should probably do that since that's what will have admin controls over the endpoint.

Once a root account is made, you can add me as an IAM user to the account and i can set up a hylang endpoint from there.

Kodiologist commented 3 years ago

but I think you should probably do that since that's what will have admin controls over the endpoint

Okay, I'll take a crack at it tomorrow.

paultag commented 3 years ago

This rules, and I love all of this, nice work everyone :100:

paultag commented 3 years ago

(but specifically, @allison-casey - thank you!)

Kodiologist commented 3 years ago

@allison-casey I've created an AWS account for Hy with an IAM user for you. Do you have a PGP key so I can email you an encrypted copy of your credentials?

Kodiologist commented 3 years ago

Also, could you arrange the service to be automatically shut off when we exceed the free usage tier? I'd hate to have my credit card maxed out because somebody decided to DDoS our Hy console.

allison-casey commented 3 years ago

I sent my public key to your email. I'll see what I can do about the aws tier, luckily aws lambda with zappa is absurdly cheap/free. I'll enable usage alerts and I've also debounced the console so we'll hopefully see it before anything gets out of hand.

allison-casey commented 3 years ago

Fixed the css issues and moved it all over to the hylang dedicated endpoint. Idk what ya'll were planning to do in terms of landing pages but something like this seems to work okay

.. raw:: html

   <div style="margin: 2em 0 2em 0">
     <iframe
       style="width: 100%; height: 25em;"
       src="https://hylang.github.io/hy-interpreter/"
       title="TryHy!">
     </iframe>
   </div>

Gives us something like landing-page

Let me know if you want me to change the theme around or if you find something thats broken

Kodiologist commented 3 years ago

Nice! I think I'll just add a direct link to the https://hylang.github.io/hy-interpreter/ from the README so the user gets a full browser window for it.

proppy commented 2 years ago

Is that OK to archive https://github.com/hylang/tryhy now that this is closed? Or would you prefer to re purpose the repo for something else?

Kodiologist commented 2 years ago

Go ahead and archive it, sure. Thanks.

Kodiologist commented 2 years ago

It turns out that the AWSes we're using will start charging based on usage after a year of use, so I guess we need to replace this again.

I've had some success using Brython for a different project, so perhaps that's a good choice.

allison-casey commented 2 years ago

gosh darn it bezos, just let us have this.

Anyways, do we know how much they would actually start charging? We have absurdly low usage rates for what Amazon is usually marketing towards. If it's not bad i'd be down to pay for it.

Kodiologist commented 2 years ago

Good question. I looked earlier and found usage numbers, but it's not clear how much we'd be paying if we were paying.

scauligi commented 2 years ago

Brython seems like a good route, since it looks like it does everything client side? With AWS I'm just wary of someone submitting a pathological program for giggles and we're left footing the bill.

Kodiologist commented 2 years ago

@allison-casey Can you either decommission all the AWSes or give Amazon a payment method for yourself?

Kodiologist commented 2 years ago

I believe that charges start on November 30th.

allison-casey commented 2 years ago

I'll change the payment this weekend

proppy commented 2 years ago

re: Brython, would something like https://github.com/pyodide/pyodide also work?

Kodiologist commented 2 years ago

Allie is generously bankrolling AWS for us, so things are good for the time being.