tskit icon indicating copy to clipboard operation
tskit copied to clipboard

Document Pyodide/PyScript usage.

Open benjeffery opened this issue 2 years ago • 4 comments

Advertise possibilities, advise of limitations and give an example of loading a ts from a URL and plotting it.

benjeffery avatar May 11 '22 10:05 benjeffery

How do we load from a URL easily? We marked https://github.com/tskit-dev/tskit/issues/1566 as low priority, but maybe this now moves it up the stack?

hyanwong avatar May 27 '22 11:05 hyanwong

#1566 won't help here, unless we specifically write it to detect it is running in Pyodide. This is because you can't open sockets like normal Python due to the web security model, so modules like requests don't work. I'll figure out the fetching code - you have to call JavaScript methods to do the fetching.

benjeffery avatar May 27 '22 12:05 benjeffery

Ah, yes, of course. I forgot about requests not being allowed. I guess it would also be useful to be able to display SVGs or Matplotlib output, which is going to be more JS faffing.

hyanwong avatar May 27 '22 12:05 hyanwong

I don't that the faffing there is so bad. Jupyterlite is always an option.

benjeffery avatar May 27 '22 13:05 benjeffery