Guild icon
PyScript ๐Ÿ’ป
๐Ÿ—‘ | Server Dump / โ•ฐโ•ธi-made-this
Made something cool with PyScript. Share and celebrate it in here..!
Avatar
simple interactive matplotlib visualization: https://test-pyscript.spaturno.repl.co/
14:19
Code:
โœ… 1
Avatar
Jeff Glass 24/05/2022 17:10
This was posted in a couple other categories, but just for posterity, here's 7 examples of basic GUIs built with PyScript: https://jeff.glass/post/7-guis-pyscript/
Let's build 'The 7 GUIs' with Python in the Browser using PyScript
๐Ÿ‘ 4
โœ… 1
Avatar
ChaoticWombat 25/05/2022 15:18
Hey guys! I've put it out there! But at this moment it's just giving the title and nothing else lol https://fromwindowstolinux.github.io/
โœ… 2
๐Ÿ‘ 2
Avatar
Jeff Glass 31/05/2022 20:13
Uploading images using Pyscript, and processing them with Pillow: https://jeff.glass/post/pyscript-image-upload/
How to upload images into Pyscript and work with them in Pillow in-browser
โœ… 3
Avatar
nmstoker โœจ 01/06/2022 00:11
I posted this on the PyScript discourse forum, so apologies to those who are seeing this a second time, but i put together a Chess Match Viewer here https://about.nmstoker.com/chess2.html It leverages some great code in the pre-existing Python-Chess package. You can:
  • load a few games
  • start and pause playback
  • click on pieces to show their attack options (that part works out which piece you clicked in the SVG and feeds it into Python-Chess)
๐Ÿ‘ 4
โœ… 1
00:11
โœ… 3
Avatar
Avatar
nmstoker โœจ
I posted this on the PyScript discourse forum, so apologies to those who are seeing this a second time, but i put together a Chess Match Viewer here https://about.nmstoker.com/chess2.html It leverages some great code in the pre-existing Python-Chess package. You can:
  • load a few games
  • start and pause playback
  • click on pieces to show their attack options (that part works out which piece you clicked in the SVG and feeds it into Python-Chess)
Deleted User 02/06/2022 13:15
Amazing I love it! helps me with analyzing some older games, amazing piece of work (edited)
โœ… 1
Avatar
Jeff Glass 04/06/2022 16:41
This is also up on the Pyscript forum, but Jan-Hendrik_Muller over there had a neat idea about using Pyscript as a way to explore the various filters and processors in Sci-Kit image, but allowing the user to select and Emoji and a filter and view the result: https://jeff.glass/post/scikit-image-processing/ It's very much a demo/work in progress (only 6 emojis and 4 filters), but it may be a useful demo for things like:
  • Fetching an image from a remote url using pyfetch
  • Converting images from Pillow back and forth to formats that numpy/scikit work with
  • Outputing images from Pillow to the page (via BytesIO and createObjectURL)
(edited)
A demo for the folks on the PyScript forum of image processing with Scikit inside PyScript
โœ… 2
Avatar
Avatar
Jeff Glass
This is also up on the Pyscript forum, but Jan-Hendrik_Muller over there had a neat idea about using Pyscript as a way to explore the various filters and processors in Sci-Kit image, but allowing the user to select and Emoji and a filter and view the result: https://jeff.glass/post/scikit-image-processing/ It's very much a demo/work in progress (only 6 emojis and 4 filters), but it may be a useful demo for things like:
  • Fetching an image from a remote url using pyfetch
  • Converting images from Pillow back and forth to formats that numpy/scikit work with
  • Outputing images from Pillow to the page (via BytesIO and createObjectURL)
(edited)
Jan-Hendrik Mรผller 05/06/2022 10:57
Really cool demo! I think with some fine-tuning, this could be a really nice applet idea for the https://scikit-image.org/ start page, similar to the one that numpy has.
โœ… 1
๐Ÿ‘ 1
Avatar
whatsavalue 30/06/2022 18:52
18:52
this was originally a normal python app which i was making for a project (edited)
18:52
but i epically ctrl+c ctrl+v'ed it into py-script
๐Ÿ‘ 2
Avatar
using pyscript as a javascript replacement
โœ… 1
Avatar
Jeff Glass 22/08/2022 01:30
There's been some excellent questions about how to reference JavaScript objects/functions from PyScript and vice versa (by @zaki ๐Ÿ‡ฑ๐Ÿ‡ฐ , @John S , @Ash and others), so I thought I'd put together what we've found in one place: https://jeff.glass/post/pyscript-js-functions/
How to Pass Objects from Python to JavaScript and Back
โค๏ธ 2
Avatar
Avatar
Jeff Glass
There's been some excellent questions about how to reference JavaScript objects/functions from PyScript and vice versa (by @zaki ๐Ÿ‡ฑ๐Ÿ‡ฐ , @John S , @Ash and others), so I thought I'd put together what we've found in one place: https://jeff.glass/post/pyscript-js-functions/
Thats great! You can also use the pyoidide create_proxy to create a JS proxy for a pyscript object. I've used it create button with a pyscript callback, I haven't tested how general it is
16:31
This works fine on one computer, but not another, both running chrome 101. <py-button id="getscans" label="Load Scans"> def on_click(evt): print(&a...
Avatar
Jeff Glass 22/08/2022 17:16
For sure create_proxy is super useful, but it just creates a JsProxy wrapper around an existing Python object; it doesn't (on its own) make that object available in the JS namespace
17:16
Using something like addEventListener is what creates a reference in JS to that object
Avatar
I just see a lot of questions about that around that specific use of pyscript object in JS (edited)
Avatar
Avatar
Jeff Glass
There's been some excellent questions about how to reference JavaScript objects/functions from PyScript and vice versa (by @zaki ๐Ÿ‡ฑ๐Ÿ‡ฐ , @John S , @Ash and others), so I thought I'd put together what we've found in one place: https://jeff.glass/post/pyscript-js-functions/
Wow, that's awesome. I'll give it a full read over soon, thanks.
Avatar
Blastoderm 22/08/2022 23:10
I've got this callback event which works w/o create_proxy(): p.canvas.oncontextmenu = lambda e: False Perhaps on...() type events are an exception? (edited)
Avatar
Jeff Glass 22/08/2022 23:17
Maybe? I think it may also have to do with object lifetime - in theory Pyodide is proxying most non-basic onjects everything between JS and Python anyway, unless you tell it to try to convert (to_js/toJs and toPy)
23:17
ish?
Avatar
Blastoderm 23/08/2022 04:21
Here's the link for the code containing oncontextmenu(): https://Glitch.com/edit/#!/self-avoiding-walk-ii-pyscript That lambda callback really disables right-clicking menu trigger w/o create_proxy(). Click at "PREVIEW" button on the bottom right in order to run it. (edited)
Avatar
Jeff Glass 23/08/2022 13:17
Firstly, that's an awesome set of demos!
13:21
And I agree with you - create_proxy() isn't always necessary. Pyodide is always either proxying or converting objects between Python and JS whenever objects get passed. create_proxy is just a useful sledgehammer when for some reason Pyodide either unwraps something incorrectly (so it can't be accessed/called) or it's referenced in such a way that it would normally be garbage collected/freed before the other language has a chance to access it
๐Ÿ‘ 1
Avatar
Jeff Glass 29/09/2022 16:18
I built an online demo of the Rich terminal formatting library, both to show off a cool library and explore how non-browser focused libraries can be run in PyScript with a little adaptation https://jeff.glass/project/richdemo/ (edited)
The Rich terminal formatting library, running in the browser with PyScript
๐Ÿ™Œ 1
16:19
Though personally, I think the Rich formatted REPL outputs may have actual use in a PyScript-focused project
๐Ÿคฏ 1
๐Ÿ‘๐Ÿฝ 1
16:20
There's also a companion blog post, where I try to describe the process of adapting Rich's output methods to work under PyScript, and modifying PyScript's element.write to work with Rich. Might be of interest to those trying similar adaptations: https://jeff.glass/post/pyscript-rich/
Patching the Rich formattier to output to Pyscript
Avatar
Jeff Glass 10/10/2022 19:01
Made a quick demo for a Reddit user, showing what PyScript was truly made for: playing fun sounds on the internet: https://dev.jeff.glass/pyscript-audio/index.html
19:02
A good excuse to learn about HTMLAudioElement for sound in the browser
Avatar
Avatar
Jeff Glass
Made a quick demo for a Reddit user, showing what PyScript was truly made for: playing fun sounds on the internet: https://dev.jeff.glass/pyscript-audio/index.html
nice ๐Ÿ”Š ๐Ÿ˜‚
13:20
I never realized that you can use paths to access arbirary files. I wonder whether we should call it files = [...] then
Avatar
Jeff Glass 11/10/2022 16:31
Yeah thereโ€™s probably a better name - โ€œpathsโ€ takes a list of arbitrary URLs and, for each one, fetches the contents at that URL and stores it in the Emscripten virtual file system in the same location as the executing Python script, with the same name as the last part of the URL.
16:32
fetch-to-localโ€ฆ isnโ€™t great but maybe more descriptive than paths
16:33
Itโ€™s be nice if we could make clear that the parameter is a list of URLs
Avatar
but then we open a can of worms, because I might want to specify in which directories to put them
17:33
like, if I to files = ['./a.py', 'foo/b.py'], it's obvious that b.py should be written in the foo directory of the virtual FS
17:34
but if I use a full URL, then it's unclear where to put it
Avatar
Jeff Glass 11/10/2022 17:40
Agreed, weโ€™d want to extend the syntax to allow the user to (optionally?) specify the destination in the file system, maybe defaulting to the location of the executing scripts
17:40
But to be fair, the list that paths takes is already URLs, itโ€™s just that most folks are using them for only relative URLs
17:43
With your example above (assuming both the files actually exist on the network), youโ€™d be able to do: with open(โ€˜a.pyโ€™, โ€˜rโ€™) as fp: print(fp.read()) with open(โ€˜b.pyโ€™, โ€˜rโ€™) as fp: print(fp.read()) Because all objects in paths are copied to the same location as the executing script (edited)
Avatar
FabioRosado 11/10/2022 17:48
Does that mean that when adding a module the directory structure is preserved?
Avatar
Jeff Glass 11/10/2022 17:50
Nope, currently everythingโ€™s loaded โ€œflatโ€ into the same folder as the running script https://github.com/pyscript/pyscript/issues/519
17:51
(That issue references py-env, but loadFromFile() is the same now in py-config https://github.com/pyscript/pyscript/blob/bc513400c5a431238d0b294a8162254e0ca8294f/pyscriptjs/src/interpreter.ts#L39)
Avatar
FabioRosado 11/10/2022 17:57
Ah gotcha thank you for the references! I wonder if we may see issues such as x not found when trying to import specific files. At least in Dask you need to do a โ€œdanceโ€ to get it to work
Avatar
Nope, currently everythingโ€™s loaded โ€œflatโ€ into the same folder as the running script
yes sure, I was mostly thinking aloud and imagining how a possible config API could look like, not describing the current status
(edited)
๐Ÿ‘ 1
Avatar
Jeff Glass 11/10/2022 17:58
@antocuni Yeah sorry was replying to @FabioRosado - should have said! (edited)
Avatar
FabioRosado 11/10/2022 17:59
@antocuni Iโ€™m very excited for your proposal on the config and the whole lifecycle ๐Ÿ˜„
Avatar
thanks :). It's a big task but it's slowly becoming more manageable
18:02
the next step is to kill the global runtimeLoaded store
Avatar
FabioRosado 11/10/2022 18:05
Iโ€™d be happy to give a hand with some stuff as well ๐Ÿ˜„ Iโ€™ve been thinking about typing but I still need to brush up my typescript skills haha
Avatar
Avatar
FabioRosado
Iโ€™d be happy to give a hand with some stuff as well ๐Ÿ˜„ Iโ€™ve been thinking about typing but I still need to brush up my typescript skills haha
don't tell me ๐Ÿ˜‚ ๐Ÿคฆโ€โ™‚๏ธ
Avatar
FabioRosado 11/10/2022 18:10
Haha Mariana mentioned that book to me as well ๐Ÿคฃ The official one is a nice introduction to typescript
Avatar
I think it's because I mentioned it to her ๐Ÿ˜…
Avatar
FabioRosado 11/10/2022 18:14
Oh thatโ€™s why ๐Ÿ˜„
Avatar
Jeff Glass 11/10/2022 18:33
Ooo maybe something to put on the Christmas list ๐Ÿ˜
Avatar
it's the first and only book which I read about typescript, so I cannot really compare to other books, but it was very useful for me to grasp the fundamentals and to be able to work on it
19:39
(before that I knew very little about js and literally nothing about TS)
Avatar
Avatar
Jeff Glass
Ooo maybe something to put on the Christmas list ๐Ÿ˜
FabioRosado 11/10/2022 20:00
Not sure if you like to read from a screen but the handbook is nice as well (but itโ€™s the only one Iโ€™ve read so far ๐Ÿ˜„) https://www.typescriptlang.org/docs/handbook/intro.html
Your first step to learn TypeScript
Avatar
Jeff Glass 21/10/2022 20:17
A new blog post - using Asyncio in PyScript (2022.09.1) https://jeff.glass/post/pyscript-asyncio/ (edited)
Working with concurrency in PyScript
๐Ÿ‘ 1
20:18
Since we only have one OS process to work with, and for the moment only one thread and no web workers (yet!), cooperative multitasking is super helpful for doing more-than-one-thing at once (edited)
Avatar
Avatar
Jeff Glass
A new blog post - using Asyncio in PyScript (2022.09.1) https://jeff.glass/post/pyscript-asyncio/ (edited)
nice blog post @Jeff Glass ! While reading it, I realized something which might not be obvious on the surface. JS and Python async are really two different beasts, and the fact that they are semantically so similar makes things even more confusing
21:31
when you call a JS async function, it is automatically scheduled and added to the event loop
21:32
but in Python, an async function is basically a generator, and it will be executed only if you create a task for it
Avatar
Alex Ptakhin 01/11/2022 21:29
Hello! After @antocuni presentation at PyBerlin tried PyScript and was very inspired (Thank you!). Tried it with making small app with WebSockets, FastAPI and pydantic, where we use the same models for client and server. And want to play more in this direction ๐Ÿ™‚ https://github.com/aptakhin/pyscript-websocket-example
Avatar
Avatar
Alex Ptakhin
Hello! After @antocuni presentation at PyBerlin tried PyScript and was very inspired (Thank you!). Tried it with making small app with WebSockets, FastAPI and pydantic, where we use the same models for client and server. And want to play more in this direction ๐Ÿ™‚ https://github.com/aptakhin/pyscript-websocket-example
Jeff Glass 01/11/2022 21:50
Very cool @Alex Ptakhin!
๐Ÿ‘ 1
Avatar
Avatar
Alex Ptakhin
Hello! After @antocuni presentation at PyBerlin tried PyScript and was very inspired (Thank you!). Tried it with making small app with WebSockets, FastAPI and pydantic, where we use the same models for client and server. And want to play more in this direction ๐Ÿ™‚ https://github.com/aptakhin/pyscript-websocket-example
I'm glad to have been of inspiration :). Cool stuff!
๐Ÿ‘ 1
Avatar
not sure if it's been shared in this server yet, but check this out ๐Ÿ˜‹ https://www.anaconda.com/blog/going-back-end-less-with-pyscript
Python Always Saves the Day When I was working as developer advocate at Read the Docs , one of the major themes we observed after talking to many scientific users was friction when writing in reStructuredText (reST). reST is a powerful markup language commonly found in the Python ecosystem; itโ€™sโ€ฆ
๐Ÿฅฐ 1
๐Ÿคฉ 1
๐Ÿ‘ 3
Avatar
so, I have not tried PyScript yet, but I created this new Chicago crimes repo to eval. different tools and ways of loading data that might be interesting for some Py devs here trying Polars, duckdb, etc. https://github.com/RandomFractals/chicago-crimes (edited)
Exploring Chicago crimes dataset with Jupyter notebooks, DuckDB, Malloy and new Panel/PyScript data and dashboard tools. - GitHub - RandomFractals/chicago-crimes: Exploring Chicago crimes dataset w...
Avatar
I plan to add PyScript, Panel, and Malloy demo apps there next this month.
20:27
also, I did not make this, but I think it's a good example of a slim Py app: https://twitter.com/AliTrack/status/1589503887769493510 (edited)
embedding @Panel_org in Flask-AppBuilder as Dashboards, with #hvplot,#plotly,#altair examples. #flask https://t.co/BFXzkQZx23
Avatar
oh, yeah, I did make these for devs using vscode. wonder if anyone uses them. I did notice a spike in Vega Viewer usage recently as more devs use Vega-Lite and Altair in Py too. Tabular data viewer is the one I am currently working on to add parquet data views ... https://twitter.com/TarasNovak/status/1586478977409253376
We did write 9 @code #dataViz ๐Ÿ“ˆ #geoData ๐Ÿ—บ๏ธ & #dataPreview ๐Ÿˆธ #dataTools ๐Ÿ› ๏ธ that some 470+K devs & #dataScientists tried & enjoyed using. Give them a whirl: ๐Ÿ“ฅ https://t.co/A9j1WU83bf More to come soon. Sponsor: ๐Ÿ’– https://t.co/olbQDFPE86
Avatar
I will be adding some PyScript and Panel examples to my Chicago crimes data repo next week. Meanwhile, check out Malloy vscode data tools. Neat, eh? https://twitter.com/TarasNovak/status/1593606654037147648
Updated #ChicagoCrimes with #MalloyData tools example & more info in docs: ๐Ÿง https://t.co/BRs00eXOUX Clone that data repo & install Malloy @code extension to try it out: ๐Ÿ“ฅ https://t.co/xxaDWX3fpE #dataTools ๐Ÿ”ฌ ...
๐Ÿ‘ 2
Avatar
Paul Everitt 18/11/2022 15:16
@Taras Is it ok if we add this to Awesome PyScript?
Avatar
Avatar
Paul Everitt
@Taras Is it ok if we add this to Awesome PyScript?
let's do it after I add PyScript examples. Currently that repo only has data loading examples with various tools, none of which are in browser. However, I plan to add charts and simple dashboards with Vizzu, Panel, streamlit & plain PyScript that will be more like simple web apps. Then I think we can add it to Awesome PyScript repo.
๐Ÿ‘ 2
Avatar
Jeff Glass 22/11/2022 22:00
Shared this over in the Textualize discord as well, but one of my current side investigations is getting Textual (a Terminal User Interface library) running in PyScript. Lots of rough edges yet, but very satisfying so far. (edited)
๐Ÿคฉ 2
๐Ÿ‘ 1
Avatar
ok. gonna share this bit here. I doubt we'll get there with PyScript soon, but this informal CSV data loading test might provide some useful insights for Py devs here: https://twitter.com/TarasNovak/status/1595400170010714117
Hey #dataNerds ๐Ÿค“, good news: #DuckDB v0.6 brings reading CSV data on par with #PyArrow & #Polars & loads 1.66 GB of #ChicagoCrimes data in 1.9s with 12 cores/24 threads when experimental parallel CSV reader & unordered insertion are enabled. ๐Ÿง https://t.co/Fa4a8R8gMK #dataTools
13:59
I do plan to get some PyScript/Panel app demo version done and posted on that repo github pages later this week.
Avatar
I think @madhurt is working on similar things ๐Ÿ˜Š
Avatar
Avatar
3l3ktr4
I think @madhurt is working on similar things ๐Ÿ˜Š
is he working on enabling that in PyScript? Some of it is already possible via wasm, but I doubt the multi-threading part will ever let us read gigs of data in a browser that fast. Web specs are sort of there now, but I have not seen anyone read over 1GB in the browser in under 2 secs just yet.
18:33
so my pyscript demo app will just use the 2022 dataset you can find in that repo, not all historical since 2001.
Avatar
Hi @Taras duckdb can already be compiled to WASM, I am just trying to build it for pyodide. There's an open PR on the pyodide repository for this. I have tried it and was able to build 0.4.0 locally but wasn't able to build 0.6.0. The next step for me is basically contacting pyodide folks about this and hopefully collaborating on this and pushing it forward.
Avatar
Avatar
madhurt
Hi @Taras duckdb can already be compiled to WASM, I am just trying to build it for pyodide. There's an open PR on the pyodide repository for this. I have tried it and was able to build 0.4.0 locally but wasn't able to build 0.6.0. The next step for me is basically contacting pyodide folks about this and hopefully collaborating on this and pushing it forward.
duckdb via pyodide would be great! I know it can do some of it via wasm, but not as much. Btw, I did put together this duckdb notebooks collection on Observable this summer if other devs here want to explore it more in JS with wasm: https://observablehq.com/@randomfractals/duckdb-data-tables?collection=@randomfractals/duckdb
DuckDB Client tables info notebook. DuckDB Init tip: use Observable File Attachments to add other .csv, .json, or .parquet data files to preview. See DuckDB Client notebook for more info. Database Tables Table Columns Select table: Table Summary Summary of table data using Summary Table Observable cell: Table Data Data Wrangler Query...
Avatar
well, this bit is out. I'll probably do a number of those plots with Altair for the PyScript app demo next week ... https://twitter.com/TarasNovak/status/1596876252581105668
So, I ported my old #ChicagoCrimes #pandas data wrestling with #matplotlib plots to new repo. See this #JupyterNotebook with many crime data summaries and plots from 2001 to present: ๐Ÿง https://t.co/8jIsXiIy25 #dataNotebooks ๐Ÿ“š ...
Avatar
so, I could use some feedback. I was planning to port the charts from the notebook above to Altair and add them to a web page with pyscript. Also, planning to add another web page with Vizzu later this week. Would we want to have such PyScript examples that are a bit more extensive than what I've seen so far.
17:32
then also a q. of how do we link it to your examples repo, or do we just duplicate it there since I load data from my data repo without other script/data dependencies.
17:33
anyhoo, I'll be adding those web pages here for now: https://github.com/RandomFractals/chicago-crimes/tree/main/apps/pyscript
Avatar
got a few altair charts. will add more tomorrow:
Avatar
I shared it on twitter for now if you guys want to RT it from your pyscript_dev handle ๐Ÿ˜‰ https://twitter.com/TarasNovak/status/1597379498756173824
Created a web page with #PyScript loading 2022 #ChicagoCrimes CSV data with #pandas and visualizing that data with #Altair charting lib: https://t.co/KtZltttYMi #dataApps ...
โค๏ธ 1
Avatar
so, you can now try that pyscript page via github pages I just puiblished. It does take a while to load the runtime and then the large CSV data file before the Altair charts show up. The last part will depend on your connection speed. Give it a whirl: https://randomfractals.github.io/chicago-crimes/apps/pyscript/
Avatar
Avatar
Taras
I shared it on twitter for now if you guys want to RT it from your pyscript_dev handle ๐Ÿ˜‰ https://twitter.com/TarasNovak/status/1597379498756173824
@tedpatrick has the twitter account I guess?
Avatar
Avatar
3l3ktr4
@tedpatrick has the twitter account I guess?
yup. I did not know he had one. @tedpatrick thx for that like! ๐Ÿ™‚
Avatar
no, sorry I meant Ted has the login for the pyscript twitter acc ๐Ÿ™‚ (edited)
Avatar
oh. yeah, don't worry about that part. I am not really happy with that app page and could not find a faster way to load all of that data. Maybe someone will add parquet soon. Then it's worth sharing it.
Avatar
tedpatrick 30/11/2022 13:38
Shared it ๐Ÿ™‚
Avatar
sweet. thank you!
Avatar
my trash Experiment Box ๐Ÿ˜‚๐Ÿ˜… (edited)
๐Ÿ”ฅ 2
Avatar
Avatar
tedpatrick
is it yours, or you found it online?
Avatar
tedpatrick 01/12/2022 22:43
I made it, will keep adding to it.
๐Ÿ‘ 1
Avatar
in case you guys are interested in checking out Malloy with fast parquet data loading, duckdb, nested queries, table summaries, graphs, etc.: https://twitter.com/TarasNovak/status/1598689216564760577
๐Ÿฅณ New 2022 #ChicagoCrimes #dataApp with #Malloy #Composer is out. See: gif -> https://t.co/gV2UQ8ht5Z code -> https://t.co/0jlJJ5Yqkc app -> https://t.co/o74FKCstGF Try it in your browser. Have fun! #dataTools/#dataApps ๐Ÿ”ฌ ...
LamarWho 2
Avatar
Jeff Glass 02/12/2022 22:04
Been working on adding visualizations to my Advent of Code, and tabbed code views for the primary code and vizualization code. This is with chart.js (edited)
๐Ÿ‘ 2
Avatar
Very nice website. It inspired me to take on the AoC challenge myself :)
๐Ÿค˜ 1
Avatar
Updated #ChicagoCrimes #PyScript #dataApp with gzipped CSV (~3.25MB). The app now loads 215,551 crime reports with @pyodide in a browser in about 8 seconds total for the Py runtime, data transformation with #pandas ๐Ÿผ & charting with #Altair ๐Ÿ“Š๐Ÿ“ˆ https://t.co/fLO74CI3d4
Avatar
Avatar
Jeff Glass
Shared this over in the Textualize discord as well, but one of my current side investigations is getting Textual (a Terminal User Interface library) running in PyScript. Lots of rough edges yet, but very satisfying so far. (edited)
I was just looking to see if anyone had attempted this! Are you able to share more information about your approach and progress?
Avatar
Avatar
niloch
I was just looking to see if anyone had attempted this! Are you able to share more information about your approach and progress?
Jeff Glass 13/12/2022 17:57
Sure! It's not particularly far, but if you look at the pyscript branch of my fork of Textual on GitHub, that has my progress so far: https://github.com/JeffersGlass/textual/tree/pyscript
Textual is a TUI (Text User Interface) framework for Python inspired by modern web development. - GitHub - JeffersGlass/textual at pyscript
๐Ÿ‘ 1
17:58
Basically apps inherit from PyScriptApp instead of App https://github.com/JeffersGlass/textual/blob/3c3cc0dc61166af8bc21c25de88d83adeed64210/src/textual/pyscript_app.py, which takes a DOM element as an argument to its constructor telling the app where to send output on the screen
Avatar
built an app using opencv, matplotlib and numpy to read the amount of columns and rows in quilt image formats ๐Ÿค“ https://detect-a-quilt.vercel.app example images to try out:
Avatar
Avatar
Bryan
built an app using opencv, matplotlib and numpy to read the amount of columns and rows in quilt image formats ๐Ÿค“ https://detect-a-quilt.vercel.app example images to try out:
Jeff Glass 22/12/2022 13:51
Very nice!
Avatar
Avatar
Jeff Glass
Very nice!
Thanks Jeff! BTW wanted to say thanks for the blog posts you've been putting out recently, it's been helpful when updating this to use the latest pyscript syntax ๐Ÿ˜„
โœจ 1
Avatar
Avatar
Bryan
Thanks Jeff! BTW wanted to say thanks for the blog posts you've been putting out recently, it's been helpful when updating this to use the latest pyscript syntax ๐Ÿ˜„
Jeff Glass 22/12/2022 17:14
Thanks @Bryan ! So glad they're helpful.
Avatar
mauj_mishra 08/01/2023 11:54
Hi guys, check out the simulation I made for my driver drowsiness detection project. Here's the link - https://driver-drowsiness.netlify.app/. Feedbacks are welcome.
๐Ÿ’ฏ 1
Avatar
Avatar
mauj_mishra
Hi guys, check out the simulation I made for my driver drowsiness detection project. Here's the link - https://driver-drowsiness.netlify.app/. Feedbacks are welcome.
this is cool! but i don't get it are you using pyscript to trigger jupyter nbs smw? or what are you using pyscript for?
22:35
don't mean to sound rude ๐Ÿค” just confused! ๐Ÿ˜…
Avatar
Avatar
3l3ktr4
this is cool! but i don't get it are you using pyscript to trigger jupyter nbs smw? or what are you using pyscript for?
mauj_mishra 10/01/2023 04:55
I am using pyscript for running the face detection and rendering the cropped eyes to the UI
โค๏ธ 1
Avatar
oh wow awesome!
๐Ÿ˜ 1
Avatar
Adopted py-script for a project I'm working on for the game Elden Ring, specifically a page where you can select in-game weapons, input your player attributes and it will calculate damage values for that weapon. There's a lot of going on for somebody who's not familiar with the game, but I figured I'd share it anyway ๐Ÿ™‚ It's a very early release but it's usable. Live: https://erdb.wiki/tools/ar-calculator Source: https://github.com/EldenRingDatabase/erdb/blob/master/src/erdb/data/wiki/templates/ar-calculator.html.jinja / https://github.com/EldenRingDatabase/erdb/blob/master/src/erdb/data/wiki/scripts/ar_calculator.py It's meant to be written in JavaScript at first with py-script as sort of "bindings" to scripts I already have in Python, but I decided to go all in on py-script and I'm glad I did. Thanks a bunch for this project, I'm not big on web dev but I do like my Python. โค๏ธ
Avatar
Avatar
Phil25
Adopted py-script for a project I'm working on for the game Elden Ring, specifically a page where you can select in-game weapons, input your player attributes and it will calculate damage values for that weapon. There's a lot of going on for somebody who's not familiar with the game, but I figured I'd share it anyway ๐Ÿ™‚ It's a very early release but it's usable. Live: https://erdb.wiki/tools/ar-calculator Source: https://github.com/EldenRingDatabase/erdb/blob/master/src/erdb/data/wiki/templates/ar-calculator.html.jinja / https://github.com/EldenRingDatabase/erdb/blob/master/src/erdb/data/wiki/scripts/ar_calculator.py It's meant to be written in JavaScript at first with py-script as sort of "bindings" to scripts I already have in Python, but I decided to go all in on py-script and I'm glad I did. Thanks a bunch for this project, I'm not big on web dev but I do like my Python. โค๏ธ
FabioRosado 18/01/2023 07:30
Just tested it looks awesome ๐Ÿ˜„
๐Ÿ™ 1
Avatar
Hi, may I share this single page self-contained password generator. The randomness is created by Python's "secrets" module, and PyScript is working like a charm. Please enjoy : https://github.com/khl4git/pyscript-password-generator (edited)
Self contained one page html password generator with Python's <pyscript> and <secrets> libraries - GitHub - khl4git/pyscript-password-generator: Self contained o...
๐Ÿ‘ 1
21:29
Self contained html one page password generator with Python's 'pyscript' and 'secrets' libraries
Avatar
wow that's great! thanks for sharing @khl ๐Ÿค—
Avatar
Jeff Glass 08/02/2023 20:09
A demo of using WebSerial in PyScript that I put together, prompted by a question in the GitHub discussions. https://jeff.glass/post/pyscript-webserial/
Connect to Physical Devices via Serial in PyScript
โœจ 2
โค๏ธ 1
Avatar
oooh so cool!! โ˜€๏ธ we can def. use it a similar approach for raspi and other controllers
Avatar
Avatar
Jeff Glass
A demo of using WebSerial in PyScript that I put together, prompted by a question in the GitHub discussions. https://jeff.glass/post/pyscript-webserial/
where did you get webserial support ? i only have webusb on various linux v8 i've tested
Avatar
Avatar
pmp-p
where did you get webserial support ? i only have webusb on various linux v8 i've tested
Jeff Glass 09/02/2023 13:44
Admitted the testing has been limited, but here's what I found: WebSerial Works:
  • Ubuntu 22.04.1 LTS / Chromium 109.0.5
  • Windows 10-21H2 / Chrome 109.0.54
  • Windows 10-21H2 / Edge 109.0.15
Doesn't Work:
  • Ubuntu 22.04.1 LTS / Firefox 109.2
  • Windows 10-21H2 / Firefox 91.0.2
(edited)
Avatar
thx i'll retry chromium on linux
๐Ÿ‘ 1
13:48
but all other v8 like brave don't seem to have it, and i did not test chrome
Avatar
Avatar
Jeff Glass
Admitted the testing has been limited, but here's what I found: WebSerial Works:
  • Ubuntu 22.04.1 LTS / Chromium 109.0.5
  • Windows 10-21H2 / Chrome 109.0.54
  • Windows 10-21H2 / Edge 109.0.15
Doesn't Work:
  • Ubuntu 22.04.1 LTS / Firefox 109.2
  • Windows 10-21H2 / Firefox 91.0.2
(edited)
if you want to add some serial emulation where it is missing this works fine with webusb https://github.com/pmp-p/webusb-ftdi but is limited to FTDI chips, could not get ch341 and prolific to run with it (edited)
13:52
also i tried with success websocket and telemetrix, if someone around keen on C++ would like to add websocket support just mention here https://github.com/MrYsLab/telemetrix-aio/issues/16
Avatar
Jeff Glass 09/02/2023 14:12
Interestingly, Mozilla seems to have a "Wont-Implement" position on WebSerial in Firefox: https://mozilla.github.io/standards-positions/#webserial
Avatar
Avatar
Jeff Glass
Interestingly, Mozilla seems to have a "Wont-Implement" position on WebSerial in Firefox: https://mozilla.github.io/standards-positions/#webserial
i agree with them because device behind serial cannot be identified, while webusb use specific vid:pid identification and need removing kernel module support prior web operation - each time device is plugged - that should prevent case where user has no clue what is happening (edited)
14:54
when using firmata it's quite easy to break things for real ( eg big motors or high voltage/currents )
Avatar
can a websocket be treated as a serial?
19:46
or maybe thats way out of scope
Avatar
i think it could and it's probably the way when neither webusb/webserial are available or allowed
Avatar
I wrote an app to allow non-technical users to upload tabular data in different formats, show it in a Panel Tabulator widget, and then download it or copy it to the clipboard. Basically a Pandas-Panel-based, data format translator for non-technical users (avoiding the install-and-config-Python barrier). https://8a5c2824-7e6f-4abe-964d-c4d7570d19b7.pyscriptapps.com/8b7c12a0-59cb-4f76-8746-ea9590c84653/latest/ (edited)
Avatar
Avatar
nascif
I wrote an app to allow non-technical users to upload tabular data in different formats, show it in a Panel Tabulator widget, and then download it or copy it to the clipboard. Basically a Pandas-Panel-based, data format translator for non-technical users (avoiding the install-and-config-Python barrier). https://8a5c2824-7e6f-4abe-964d-c4d7570d19b7.pyscriptapps.com/8b7c12a0-59cb-4f76-8746-ea9590c84653/latest/ (edited)
I had issues with Panel components that would provide progress feedback, like toasts and progress bars. Maybe related with everything running on the same thread in the browser. Need to isolate issues and try Panel latest versions.
Avatar
Avatar
nascif
I had issues with Panel components that would provide progress feedback, like toasts and progress bars. Maybe related with everything running on the same thread in the browser. Need to isolate issues and try Panel latest versions.
Also had issues downloading binary formats like parquet and arrow - they depend on binary libraries that are not yet available as part of the officially supported PyScript set.
Avatar
Fabiano.py 23/06/2023 01:30
๐Ÿ’ป Hobbies : Mix Pyscript.js, Tailwind.css Alpine.js and GoogleSites ๐ŸŒ` https://sites.google.com/view/pyscript/home ๐Ÿ˜ƒ (edited)
Crie aplicativos web dados inteligencia artificial jogos em todos dispositivos usando Python e ou Java Script. Grupo de estudos Facebook clique aqui.
๐Ÿคฉ 2
khl started a thread. 08/07/2023 11:04
Avatar
Contribute to nasrin1748/pyscript_dataframe development by creating an account on GitHub.
Avatar
Enhance your Python programming skills and learn how to create weather extensions for Chrome using pyscripts, in this detailed guide. Unlock the potential of Python today. https://youtu.be/lSuw1Y0grwM
Avatar
Avatar
Jeff Glass
A demo of using WebSerial in PyScript that I put together, prompted by a question in the GitHub discussions. https://jeff.glass/post/pyscript-webserial/
AhmadSohrabi 01/08/2023 17:22
this error showed up: (PY0404): Fetching from URL webserialdemo.py failed with error 404 ().
Avatar
Avatar
AhmadSohrabi
this error showed up: (PY0404): Fetching from URL webserialdemo.py failed with error 404 ().
Jeff Glass 01/08/2023 23:47
That indicates your page canโ€™t find the file webserialdemo.py. Do you have the contents of that script in a file on your server? (and/or are you opening the example locally?)
Avatar
Avatar
AhmadSohrabi
this error showed up: (PY0404): Fetching from URL webserialdemo.py failed with error 404 ().
Jeff Glass 02/08/2023 00:15
That indicates your page canโ€™t find the file webserialdemo.py. Do you have the contents of that script in a file on your server? (and/or are you opening the example locally?)
Avatar
Avatar
Jeff Glass
That indicates your page canโ€™t find the file webserialdemo.py. Do you have the contents of that script in a file on your server? (and/or are you opening the example locally?)
AhmadSohrabi 02/08/2023 03:29
Thanks but I don't have a server. What free server do you suggest? Is there a way to run it on free Github.io account?
Avatar
Avatar
AhmadSohrabi
Thanks but I don't have a server. What free server do you suggest? Is there a way to run it on free Github.io account?
Jeff Glass 02/08/2023 04:18
Itโ€™ll work the same if you copy/paste the code from that file inside the <py-script> tag and remove the src attribute ๐Ÿ˜€
Avatar
Avatar
Jeff Glass
Itโ€™ll work the same if you copy/paste the code from that file inside the <py-script> tag and remove the src attribute ๐Ÿ˜€
AhmadSohrabi 02/08/2023 14:52
Thanks Jeff, so it should be server side even with [Fetch] and Pyscribt/Pydide? I come from .net Webassembly tribe ๐Ÿ˜‰
Avatar
Avatar
AhmadSohrabi
Thanks Jeff, so it should be server side even with [Fetch] and Pyscribt/Pydide? I come from .net Webassembly tribe ๐Ÿ˜‰
Jeff Glass 02/08/2023 18:09
Not 100% sure I understand.... the src attribute fetches a remote (python) file and executes the contents as Python code, similar to a <script> tag's src attribute. If your browser can't find that resource on the network (could be a webserver, or a simple local testing server [1]), it will error with a 404 like you saw. One workaround is to just make all the code inline/on the page. [1] https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Tools_and_setup/set_up_a_local_testing_server
18:10
I actually wrote a whole blog post on this issue: https://jeff.glass/post/pyscript-need-a-server/
Solving the "Access to local files" error that plagues new PyScript developers
18:10
There are other things that could cause a 404 error, but this is my best guess for what's happening on your end
Avatar
Avatar
Jeff Glass
I actually wrote a whole blog post on this issue: https://jeff.glass/post/pyscript-need-a-server/
AhmadSohrabi 03/08/2023 03:16
Thanks again Jeff, it worked when I removed the [Fetch] and pasted the code๐Ÿ‘
Avatar
I made a lil conway's game of life using pyscript and d3.js : https://mbichoffe.github.io/game-of-life/ it's still very much WIP and kinda jenky especially on mobile
๐Ÿคฉ 3
๐Ÿ 1
Avatar
MoJoeLogic 15/08/2023 17:34
@ntoll was there to be a gathering this Thursday?
Avatar
Yes. There is a gathering. Topic: PyScript FUN: show and tell something funky Time: 4pm UTC This is a recurring meeting Join Zoom Meeting https://anaconda.zoom.us/j/92045078132?pwd=SU16TGNhaDhCNHV1UlFnWDJNMnFZdz09 Meeting ID: 920 4507 8132 Passcode: 042235
Zoom is the leader in modern enterprise video communications, with an easy, reliable cloud platform for video and audio conferencing, chat, and webinars across mobile, desktop, and room systems. Zoom Rooms is the original software-based conference room solution used around the world in board, conference, huddle, and training rooms, as well as ex...
ducky_party 1
17:44
@MoJoeLogic ^^^
17:45
Everyone is welcome to turn up and show us what they've been making.
Avatar
DrakoMagnus 16/08/2023 21:55
hello everyone im super hyper ultra new to all this python thing but im watching videos and learning... on this note can anyone provide any excelent link to a video on yt or site that teaches me how to pull data from a xlsx or numbers file into pyscript? i wanna try and build a dashboard that can read from an extensive excel file i have with multiple pages (5). appreciated in advance for any kind of help or tutoring...
21:56
also if anyone can tell me why i keep seeing PANDAS mentioned on a lot of pyscript yt videos i would appreciate the input...
Avatar
@here PyScript Fun about to start here... everyone welcome: https://anaconda.zoom.us/j/92045078132?pwd=SU16TGNhaDhCNHV1UlFnWDJNMnFZdz09
Zoom is the leader in modern enterprise video communications, with an easy, reliable cloud platform for video and audio conferencing, chat, and webinars across mobile, desktop, and room systems. Zoom Rooms is the original software-based conference room solution used around the world in board, conference, huddle, and training rooms, as well as ex...
Avatar
Since Microsoft announced Python coming to Excel today...here is my home rolled python in Google Sheets using Pyscript (edited)
๐Ÿคฉ 1
15:16
Avatar
Avatar
alexb
Since Microsoft announced Python coming to Excel today...here is my home rolled python in Google Sheets using Pyscript (edited)
Jeff Glass 22/08/2023 15:52
Very cool! Would love to hear more about this!
Avatar
Its definitely just a proof of concept for now. Pyscript has to call async google apps script apis on the back end to fetch data and since there is no top-level awaits (yet) I had to do this awkward dance of getting the result from the pyodide future object. Would be interested in knowing if there's a better way to do this
Avatar
Jeff Glass 22/08/2023 16:26
I think the next release will support <py-script async src="..."> which will automatically run with top-level await using runPythonAsync https://pyodide.org/en/stable/usage/api/js-api.html#pyodide.runPythonAsync (edited)
๐Ÿ™Œ 1
Avatar
Avatar
alexb
Its definitely just a proof of concept for now. Pyscript has to call async google apps script apis on the back end to fetch data and since there is no top-level awaits (yet) I had to do this awkward dance of getting the result from the pyodide future object. Would be interested in knowing if there's a better way to do this
Jeff Glass 22/08/2023 17:47
I should say, you can await thenables or python coroutines from either language, if that helps your current awkward dance any.
Avatar
Nikita Churikov 29/08/2023 15:08
Hi! I made this presentation. PyScript interacts with it and is being demonstrated in it. https://churnikov.github.io/demo/pyketch/presentation/#/ Showed it at EuroScipy https://www.youtube.com/watch?v=tiX0zlCFS-I
๐Ÿ‘ 2
Avatar
@Nikita Churikov very good..! ๐Ÿš€
๐Ÿ˜„ 1
Avatar
Hmm Nice Bike 06/09/2023 22:05
@Nikita Churikov Amazing! Thanks for sharing
๐Ÿ˜„ 1
Avatar
bugzpodder 19/09/2023 11:32
I jusst published a new library PySandbox built on top of polyscript. Its mainly intended to make it easy for developers to integrate polyscript XWorkers into a web application. docs are here: https://bugzpodder.github.io/pysandbox/ cc @Jeff Glass (edited)
Get started incorporating python code to your app.
๐ŸŽ‰ 1
bugzpodder started a thread. 19/09/2023 11:54
Avatar
Phelsong (Josh) 07/10/2023 01:10
not totally finished yet, but full spa art picker applet "site", using a composable element library i wrote. Solely served thru fast api, using turso for file caching both server and client side. Other than the initial load times, it performs exteremly well. Serving up almost 1500 images... all in all, this is a 100% python full stack app, the 50 lines of js i had to write got rolled into the language, so its offcially zero js. I was able to build this from scratch, by myself, with a full rewrite halfway thru in under a month. Mad props to the pyscript team making something like this a reality. (sorry, all the art is proprietary)
๐Ÿฅณ 3
๐Ÿ‘ 3
๐Ÿ‘ 1
Avatar
Jeff Glass 07/10/2023 03:33
This is so cool! Would absolutely love to hear your thoughts on the process, what pyscript made easy/hard/could be better etc. Awesome work.
Avatar
Phelsong (Josh) 07/10/2023 05:35
i have another weekish to get this deployed, I will definitely do a proper writeup then.
Avatar
Bravo @Phelsong (Josh)
Avatar
My team and I used PyScript during a hackathon organised by the Python discord server. Our app mimics a typical CAPTCHA, with a twist to fit the theme of the hackathon. We started with a JS prototype and ended up porting it to PyScript to have our codebase completely in Python. Our code is public on GitHub. https://github.com/thijsfranck/the-dynamic-typists The main issue we ran into was that the provided type stubs don't cover all the Web APIs we use. This means we could not achieve comprehensive static type checking, increasing the risk for potential bugs and making it generally a bit more painful to add new features to the app. We ended up extending the type stubs, to the extent we required. Maybe this could find its way back into the project so other people can also benefit? (edited)
Code Repository for &quot;The Dynamic Typists&quot; team taking part in the Python Discord Code Jam 2023 - GitHub - thijsfranck/the-dynamic-typists: Code Repository for &quot;The Dynami...
๐ŸŽ‰ 1
๐Ÿš€ 1
Jeff Glass started a thread. 11/10/2023 20:17
Avatar
one of my students(13 years old) made this as his first pyScript project! (of course with guidance) it was a great transition from the tutorial posted on documentaion(pirate speak) https://hockeydudeperson.pyscriptapps.com/pig-latin/latest/ I'm wondering if anyone has any proejct ideas in pyscript that can be fun for a 13 year old. he knows python fundumentals, and working with json data. Note: there is a "9" at the top left of the page. I have nooo clue why it's there, so if anyone knows please! (edited)
Avatar
This is really great and I'm glad you like the Pirate Speak app..! ๐Ÿ™‚ ๐Ÿท As a teacher, I often try to find ways to bring in the student's passions or other non-programmer-y interests into a software project. For example, I had one student write a very simple database about genres of heavy metal (!!). ๐Ÿ˜„ Another similar strategy is to write code to complement a real-world activity that they enjoy, e.g. automating character creation in a Dungeons and Dragons game is another one I've seen done.
Avatar
Avatar
Hey_H
one of my students(13 years old) made this as his first pyScript project! (of course with guidance) it was a great transition from the tutorial posted on documentaion(pirate speak) https://hockeydudeperson.pyscriptapps.com/pig-latin/latest/ I'm wondering if anyone has any proejct ideas in pyscript that can be fun for a 13 year old. he knows python fundumentals, and working with json data. Note: there is a "9" at the top left of the page. I have nooo clue why it's there, so if anyone knows please! (edited)
Jeff Glass 30/10/2023 00:49
Very nice! As far as the rogue โ€œ9โ€, itโ€™s after the <script> tag in the head of the document
๐Ÿ˜… 1
Avatar
Avatar
Jeff Glass
This is so cool! Would absolutely love to hear your thoughts on the process, what pyscript made easy/hard/could be better etc. Awesome work.
Phelsong (Josh) 08/11/2023 18:41
#### The App Its essentially a quick "clip art" gallery, used internally for screen printing. Its being used to supplement a more advanced customizer. Its relatively basic, serving up a page of images sorted by category (totaling around 2k). Built against a 3-stage development plan, the major goal for stage 1 was to be as clean and simple as possible for simple image picking, with later additions for some gallery wide edit capabilities.
  • FastApi/Uvicorn/Gunicorn with Turso for simple caching
  • Pyscript app is served directly off the web server for easy cors communication
  • Some basics from UiKit
  • This whole project was built solo
#### The Good
  • Easy to iterate on, especially after putting together a mini component library.
    • From a dev perspective being able go generate and manipulate components at a similar rate to React or Vue, was one of my primary concerns...I can confidently its actually faster. Without all the framework complexity.
    • The "runtime overhead" outside of the initial load is negligible. Its extremely fast doing page to page navigation.
    • Serving the entire app off a single api Isn't something I've personally seen in the JS spa world. This for me, helps immensely for pushing builds, as i can edit the web app without even stopping the server (if no api changes)
    • The JS backdoors
#### Growing Pains Yes "beta" packages, just sharing my raw thoughts.
  • The initial load time can be a touch brutal. Enabling some browser WASM features, caching, and some of the more recent work done helps.
    • The lack of an easy method to point the fetchs away from the cdn needs to be addressed, probably soon-ish. Simply changing those to the local cuts load times by 60-90%.
    • micropython might be the fix here, but am was too deep on this leg to pivot. Will consider for the next.
  • Sub point, that same issue makes it hard to pin a version and even cache it locally in the first place.
    • I wrote build scripts to do some of this, but it would be quite confusing for anyone trying to pick up my project on the future.
  • Some form of Stubs for development should also be a priority imo. Especially with the docs being such a wip. We're spoiled with lsps now. #### What I'd like to see
  • I think some "basic" cli manager for Pyscript/Pyodide could solve all of those issues.
  • Native cookie methods to "auto" return as a dict
  • (This probably more a library issue) Better method for managing virtual pages and browser history. As far as using the actual library, I have basically 0 complaints.
Avatar
@Phelsong (Josh) thank you for the feedback!
18:41
Contribute to jtakacs/astronavigation development by creating an account on GitHub.
22:19
Avatar
chris.laffra 21/11/2023 13:26
I wrote a profiler for Python and its UI is entirely done in PyScript. It loads crazy fast with MicroPython. See the GitHub project here: https://github.com/micrologai/microlog. A live demo is on Github Pages: https://micrologai.github.io/microlog/#examples-dataframes/2023_07_31_11_15_57/
Avatar
@MrLift and I had fun making a small capser utility page in PyScript at http://py.teamlift.uk/, which makes it a little easier to write in sแดแด€สŸสŸ แด„แด€แด˜s. We're aware of font oddities, but we're happy that it functions, and is pretty quick to load thanks to MicroPython ๐Ÿ™‚
๐Ÿ‘ 1
Avatar
Very cool.
11:49
Where in the UK are you based?
Avatar
Avatar
ntoll
Very cool.
Wow, thank you kindly ๐Ÿ™‚ We're in the Midlands.
Avatar
So am I
14:16
I'm near Northampton.
๐Ÿ‘ 1
14:16
Nice to see other Brits here. ๐Ÿ™‚
Avatar
What-ho, splendid marvellous! ๐Ÿ™‚
Avatar
@MattyTrentini i saw your thread about lvgl as a module for ยตpy, made me think it would be usefull to present that lvgl module (still sdl2 though) can load on cpython3 and also wasm see the lvgl forum thread here (edited)
I am sorry I have not had as much time as I have wanted to have to work on this project. I will be getting more time in month or 2 to be able to spend working on it. As far as the error you are getting it is telling you exactly what the problem is. No Compatible Visual C\C++ version found. Because of how pip and setuptools now work the trace...
Avatar
Avatar
pmp-p
@MattyTrentini i saw your thread about lvgl as a module for ยตpy, made me think it would be usefull to present that lvgl module (still sdl2 though) can load on cpython3 and also wasm see the lvgl forum thread here (edited)
MattyTrentini 03/12/2023 22:38
Oh, interesting, thanks! I guess that only renders to SDL2 though? One of the more complicated issues we're still working through is the architecture of the graphics drivers. While some drivers will be provided in C from LVGL, there is a desire to also support creating them in MicroPython. It's a little tricky to structure! If we can sort it out though, then it may also be possible to do so from CPython too, if the MicroPython bus driver (SPI/I2C) was also added...
Avatar
In fact it only render to a framebuffer, it is using SDL2 facilities to do that so it should be possible to make a direct canvas driver (or sixel for wasi ). i don't have much time to implement all those but there's also a firmata replacement called "telemetrix" which supports asyncio and that could bring physical i2c and gpio into wasm web page space for esp* boards ( i already did it with cpython-wasm and a cheap servomotor robot arm ). I did not test SPI. (edited)
๐Ÿ‘ 1
Avatar
Hi, my Pyscript password generator is online at skewee.com (directed to https://skewee.w3spaces.com/)
๐Ÿคฉ 1
๐ŸŽ‰ 2
00:12
My personal website done entirely in PyScript with the help of LTK: https://chrislaffra.com
๐ŸŽ‰ 2
Avatar
Allan Spadini 03/01/2024 18:33
A Dashboard to see the latest earthquakes. Dashboard: https://allanspadini.com/mapa_terremotos/ Code: https://github.com/allanspadini/mapa_terremotos
Terremotos de magnitude maior ou igual a 4.5 do รบltimo dia. Fonte de dados: USGS. - GitHub - allanspadini/mapa_terremotos: Terremotos de magnitude maior ou igual a 4.5 do รบltimo dia. Fonte de dado...
๐Ÿ‘ 2
Avatar
sethmlarson 31/01/2024 01:43
Sharing this here at it might be interesting for PyScript/Pyodide folks: urllib3 has experimental support for Pyodide and PyScript: https://urllib3.readthedocs.io/en/stable/reference/contrib/emscripten.html
From the Pyodide documentation, Pyodide is a Python distribution for the browser and Node.js based on WebAssembly and Emscripten. This technology also underpins the PyScript framework and Jupyterli...
๐Ÿ˜ข 1
Avatar
This is an explorer of the ISO 9374 parameter space for basic weave structures. Yes, I know no one is going to know what that means or why someone would even make it. I used it as an exercise to work out how difficult I could make the UI using @chris.laffra ltk. Turns out the ltk is very powerful. Tested in Chrome - might not work so well in other browsers. I did not test.
โค๏ธ 3
Avatar
Nice job @Neon22 - seems to work on Firefox. ๐Ÿ˜‰
Avatar
Avatar
ntoll
Nice job @Neon22 - seems to work on Firefox. ๐Ÿ˜‰
thanks - very happy about that
Avatar
chris.laffra 14/02/2024 15:20
I tested LTK on all the browsers I have installed (quite a few) and it worked on all, as far as I could tell...
Avatar
@chris.laffra what I meant was my css was not tested on other browsers. so the reslt might look funny. I have overloaded quite a few of the ltk supplied classes
Avatar
chris.laffra 17/02/2024 09:22
๐Ÿ‘
Avatar
chris.laffra 04/04/2024 16:41
I just created another example for PySheet. It tests a large dataset, custom Python package loading, and Seaborn visualizations. Getting closer and closer to a public beta. Sign up here: https://forms.gle/jDc7WMYeYoUbF4jZ6
PySheets has entered Alpha stage. This means we are almost ready to take on initial users. An excellent way to think about PySheets is "JupyterLite, written entirely in Python, with a spreadsheet UI." That means you can write Python scripts to load data from a document or microservices. You can analyze the data using Pandas, Numpy, and Matplotl...
16:42
The above example was done over wifi from my phone to test slow network conditions ๐Ÿค“
16:46
Here is another PySheets example using Pandas and Matplotlib. It also shows the dependency graph.
Avatar
brython clock works great with micropython (only a small problem in utf-8 output, and also datetime.datetime.now() which is broken) (edited)
๐Ÿฅณ 1
Avatar
Awesome stuff Chris - can't wait to see pysheets in full.
๐Ÿค“ 1
Avatar
Avatar
pmp-p
brython clock works great with micropython (only a small problem in utf-8 output, and also datetime.datetime.now() which is broken) (edited)
one question @pmp-p , why use brython with micropython? ๐Ÿ˜…
Avatar
Avatar
Sanskar
one question @pmp-p , why use brython with micropython? ๐Ÿ˜…
it is brython's clock code sample, i give credit to author not my code https://brython.info/gallery/clock.html
08:19
you should know that there are already lot of pythons in the browser with all something they can do better, and brython has better DOM access.
08:20
getting on par with brython ( full js), micropython lvgl sim (https://sim.lvgl.io/ ) or pygbag ( wasm game engines ) means progress. (edited)
Avatar
Ah, I see
Avatar
Hi everyone! I've been working on a tool that uses pyscript to provide a web interface for a scientific software package that is used at our company called laserfun. In case anyone is interested to see it, here is a link: https://www.octavephotonics.com/nlse. I'm not a software developer so it's far from being optimized, but it does what we need for now! It uses Panel, Matplotlib, and Scipy with the calculations running in a worker thread. I'd be interested to hear feedback from people that actually know what they're doing...
๐ŸŽ‰ 1
Avatar
Bravo!
11:54
@nickburns have you considered showing us this work in today's "PyScriptFUN" call. It's a supportive and helpful place to show and tell about stuff folks have built with PyScript. ๐Ÿ‘
11:56
Apologies, the PyScriptFUN meeting is NEXT WEEK. ๐Ÿ˜„
Avatar
wow ! very cool
Avatar
elliot0x01 18/04/2024 12:58
Created this terminal style portfolio, for a cybersecurity domain person like me doing front end was real pain in the a$$[tbh I suck at UI/UX stuff], thanks to pyscript I can finally have a good looking website ๐Ÿ˜† @Jeff Glass @Andrea Giammarchi Working on this, let me know what else can be added ๐Ÿ™‚ https://terminal.rohsec.com
๐Ÿฅณ 2
โค๏ธ 1
Avatar
Avatar
elliot0x01
Created this terminal style portfolio, for a cybersecurity domain person like me doing front end was real pain in the a$$[tbh I suck at UI/UX stuff], thanks to pyscript I can finally have a good looking website ๐Ÿ˜† @Jeff Glass @Andrea Giammarchi Working on this, let me know what else can be added ๐Ÿ™‚ https://terminal.rohsec.com
Jeff Glass 18/04/2024 16:32
This is very cool! I can see why you wanted clickable links ๐Ÿ˜
๐Ÿ˜… 1
16:34
For what it's worth, termcolor works out of the box in the PyScript terminal, and rich should if you set rich._console = RichConsole(color_system="truecolor"). You've done a great job rolling your own coloring, that's just another option
ANSI color formatting for output in terminal. Contribute to termcolor/termcolor development by creating an account on GitHub.
Rich is a Python library for rich text and beautiful formatting in the terminal. - Textualize/rich
Avatar
Avatar
Jeff Glass
For what it's worth, termcolor works out of the box in the PyScript terminal, and rich should if you set rich._console = RichConsole(color_system="truecolor"). You've done a great job rolling your own coloring, that's just another option
elliot0x01 19/04/2024 04:54
Wow, thanks will look into this
Avatar
Blimey... this is amazing work. Bravo both @elliot0x01 and @Jeff Glass
๐Ÿ˜… 1
Avatar
Avatar
ntoll
Blimey... this is amazing work. Bravo both @elliot0x01 and @Jeff Glass
elliot0x01 19/04/2024 14:55
Always struggled with front end and UI, I am now happy with my little terminal themed portfolio ๐Ÿ˜…
๐Ÿš€ 1
Avatar
Avatar
Jeff Glass
For what it's worth, termcolor works out of the box in the PyScript terminal, and rich should if you set rich._console = RichConsole(color_system="truecolor"). You've done a great job rolling your own coloring, that's just another option
elliot0x01 19/04/2024 14:56
Does micropython support rich ?
14:57
Damnn...just found your monkeypatch to use rich in pyscript ๐Ÿ™‚ @Jeff Glass
Avatar
elliot0x01 19/04/2024 15:18
Wondering if that will work with micropython, cause switching to python will significantly affect the initial loading time ๐Ÿค”
Avatar
Avatar
elliot0x01
Wondering if that will work with micropython, cause switching to python will significantly affect the initial loading time ๐Ÿค”
Jeff Glass 19/04/2024 20:52
I would be very surprised if rich worked on Micropython, given that itโ€™s built for CPython
Avatar
Avatar
Jeff Glass
I would be very surprised if rich worked on Micropython, given that itโ€™s built for CPython
Andrea Giammarchi 23/04/2024 14:12
it looks like a "pure Python thing" to me but then again it imports so many things that might not be exposed in MicroPython I agree with you it'd be super surprising if it actually works out of the box in there.
14:12
curious to know which module we're missing in there though, if anyone would like to try and fail there.
Avatar
Avatar
Andrea Giammarchi
it looks like a "pure Python thing" to me but then again it imports so many things that might not be exposed in MicroPython I agree with you it'd be super surprising if it actually works out of the box in there.
Jeff Glass 23/04/2024 15:48
An old github discussion mentioned Enum specifically, which relies on Metaclasses, which aren't implemented (implemented differently?) in MP (edited)
Avatar
Created this python code playground component where a user can edit code and run it on demand. My plan is to use this for code examples in my blog. https://www.ysai.me/writing/python-code-playground-in-blog It's a react component that can be used for code blocks in mdx files. MDX is an extended version of markdown files in which you can include react components. Using nextjs and hosted on vercel. (edited)
An MDX component that allows readers to edit and execute Python code examples in the browser using PyScript.
Avatar
chris.laffra 25/04/2024 11:03
The latest thing I added to PySheets is cut-and-past from Google Sheets. Any PyScript app can do the same (read/write the clipboard) and interact that way with other apps.
๐Ÿคฉ 1
11:05
The navigator clipboard API is asynchronous, so I wrote a small JS helper: (edited)
11:06
It reads the clipboard and calls back with text and html.
11:07
11:08
On the PyScript side, I am leveraging LTK to visit the HTML, extract the text from the table cells and copy the styling Google Sheets has set on the cells.
11:09
Cmd+V preserves styles, while Shift+Cmd+V simply inserts as text, without copying the style.
๐Ÿ˜€ 1
๐ŸŽ‰ 1
Avatar
Cemrehan ร‡avdar 26/04/2024 20:50
I've started to test pysheets! it seems great so far ๐Ÿ’ฏ
๐ŸŽ‰ 1
โค๏ธ 1
Avatar
chris.laffra 27/04/2024 13:48
PySheets is in public beta now. Check it out at https://pysheets.app
๐Ÿ‘ 4
Avatar
Simple easy to use pyscript....just import and use the basic beginner packages.Yet to add styling.... https://_12.pyscriptapps.com/noisy-math-copy-copy-copy/latest/ feedback is appreciated.
Avatar
Fabiano.py 23/05/2024 10:13
https://sites.google.com/view/pyscript/lista-de-tarefas FRIENDS OF THE WORLD, I UPDATED THE TASK LIST CODE TO THE LATEST VERSION, 2024.5.2, AND LEFT THE CODE COMMENTED IN THE FOOTER. PROMOTE THE GROUP, FRIENDSHIP DOESN'T HAVE TO BE ARTIFICIAL. I WAS INSPIRED BY THIS EXAMPLE. https://pyscript.com/@examples/todo-app/latest
Avatar
fixingbrokenrobots 27/05/2024 17:41
I made a one-pager that searches a news archive based on TF-IDF vector cosine similarity and displays messages from a Telegram group. http://rstory.io/vectorSearch.html
Avatar
Avatar
fixingbrokenrobots
I made a one-pager that searches a news archive based on TF-IDF vector cosine similarity and displays messages from a Telegram group. http://rstory.io/vectorSearch.html
wow that's a lot of conspiracy connections. I didn't get anything but conspiracy stories. Good 'ol Telegram...
Avatar
fixingbrokenrobots 28/05/2024 15:54
Yes the page searches an archive of conspiracy news: )
Avatar
I made a frontend framework for PyScript: https://puepy.dev Any feedback welcome. ๐Ÿ˜ป
๐Ÿ‘ 1
Avatar
Avatar
bouncing
I made a frontend framework for PyScript: https://puepy.dev Any feedback welcome. ๐Ÿ˜ป
chris.laffra 03/06/2024 22:17
I like the use of context managers for nesting. Cool idea. Have you seen LTK? https://pyscript.github.io/ltk/?tab=3
Avatar
Avatar
chris.laffra
I like the use of context managers for nesting. Cool idea. Have you seen LTK? https://pyscript.github.io/ltk/?tab=3
Thanks! @Neon22 just let me know about it after I mentioned what I was doing on #โ•ฐโ•ธpyscript-help . Unfortunately, I hadn't seen LTK before I started on PuePy. I haven't had time yet to dig into the codebase as much as I'd like (I only learned about it last week), but I did notice that widgets.py:Widget has some similarities to what I did. One thing I wasn't sure of with tlk is how you can mix and match widgets and regular DOM elements. Eg, can you create a DOM element inside a widget, then another widget inside that normal DOM element, or do all descendants of an ltk widget have to be widgets themselves?
Avatar
chris.laffra 03/06/2024 22:27
Yes, you can do arbitrary nesting
Avatar
ie, could you do this... ltk.VBox(ltk.Div(...))
Avatar
chris.laffra 03/06/2024 22:28
For instance, PySheets uses LTK and has multiple nested widgets, some LTK, some JS (such as CodeMirror).
Avatar
I probably need to tinker with it more. I'd like to try to figure out how to use LTK together with what I did.
22:31
PySheets looks impressive; did you make LTK with that in mind?
Avatar
Avatar
bouncing
I probably need to tinker with it more. I'd like to try to figure out how to use LTK together with what I did.
somehow joining the functionality would be a dream. To see some more complex ltk nesting also consider the link I sent you before - https://pyscript.com/@neon22/iso-weaves/latest code is inside. ltk is in main.py at end
Avatar
So with only a small modification, I was able to mount ltk widgets inside a PuePy component, though you have to manually add in reactivity. Eg: @app.page() class LtkPage(Page): def initial(self): return {"name": ""} def populate(self): with t.div(): self.input_element = ltk.Input(self.state["name"]) self.input_element.on("click", ltk.callback(self.on_data_input)) t(self.input_element.element.get(0)) t(ltk.Heading1(f"Hello, {self.state['name']}").element.get(0)) def on_data_input(self, event): self.state["name"] = event.target.value print("INPUT", event, event.target, event.target.value) Here's the problem though. You can't mix and match exactly, because ltk won't know how to render PuePy components if you try to add them as nested components inside ltk. Maybe I should have approached everything more as a web component, but web components lack reactivity (unless you add that yourself) and I don't find the way slots work as succinct in web componenets. But I could also point out, if you took all the ltk widgets and just made thin wrappers so they were themselves web components, you could use them to your heart's content in PuePy. That might be the best way to go, though I'm not sure how easy it is to mix jquery (which ltk uses) and web components. (edited)
12:34
the t(self.input_element.get(0)) part tells puepy to mount that html element onto its graph, though since it's just a regular DOM element, you can't do any further nesting inside PuePy... I'll try to get that added in a more formal way this weekend. PuePy isn't my day job. ๐Ÿ™‚
๐Ÿ‘ 1
Avatar
chris.laffra 07/06/2024 09:22
I wrote Microlog, a profiler entirely written in Python (both recorder and UI). https://micrologai.github.io/microlog/#examples-dataframes/2023_07_31_11_15_57/
09:23
09:28
For PySheets, I made an in-process version, where the app self-introspects-itself to show why it is slow. The flamegraph has links directly to VS Code to explore the code that made things slow.
๐Ÿ‘ 1
Avatar
blackbooks 07/06/2024 10:13
I incorporated PyScript in my Flask Application to handle sensitive medical data in a EGDP compliant way and extract aggregated data to a data collection server.
๐Ÿš€ 3
๐Ÿ‘ 1
Avatar
Avatar
blackbooks
I incorporated PyScript in my Flask Application to handle sensitive medical data in a EGDP compliant way and extract aggregated data to a data collection server.
Andrea Giammarchi 10/06/2024 15:16
wow, among the possibilities, sensitive medical data wasn't on top of my list of achievements (as a team): thank you for sharing that! (edited)
Avatar
oh that's an excellent usecase !
Avatar
thank you @Andrea Giammarchi and @Jeff Glass for helping me write this use case for the latest version of Pyscript and Bokeh. I welcome your comments. click on https://dev.to/rickdelpo1/python-in-the-browser-fetching-json-from-an-aws-s3-bucket-a-serverless-solution-55hg This is just an intro to a series of articles I am planning to write (edited)
I needed some quick Python to replace broken code over in AWS Lambda. While looking at IDEs I...
Avatar
chris.laffra 24/06/2024 16:23
See https://pyscript.github.io/ltk/?tab=8. The PyZombis team is moving from Brython to PyScript, and they need an editor to use inside an LTK UI where Python students can learn how to write code. I had such an editor already set up inside PySheets. Today, I extracted the code and added it to the LTK Kitchensink. The Editor example adds a new LTK widget that wraps CodeMirror (included in the index.html). The editor may not render correctly when you switch tabs, but this is a side-effect of CodeMirror requiring a "live" DOM element to render correctly. The solution for Kitchensink would be to listen to tab-events. Typical applications would have the editor in the main UI, so do not have this issue.
๐Ÿ‘ 1
16:24
16:25
In the example, you can edit code in the editor in the bottom left. While you are editing, the sample in the top left reloads in real-time. ๐Ÿคฏ (edited)
16:26
@aayush ^^^
โค๏ธ 1
16:27
This is a nice example of how to write your own LTK widget, see the right side of the page that contains all the code needed to do the part on the left.
Avatar
really exciting! can not wait to get this integrated into PyZombis and introduce ltk to new learners!
Avatar
Bravo @chris.laffra
07:46
Out of interest, why didn't they use the PyEditor built into PyScript (https://docs.pyscript.net/2024.6.2/user-guide/editor/) ..? (edited)
Avatar
@chris.laffra dude. brilliant... ๐Ÿ™‚
Avatar
Avatar
ntoll
Out of interest, why didn't they use the PyEditor built into PyScript (https://docs.pyscript.net/2024.6.2/user-guide/editor/) ..? (edited)
chris.laffra 25/06/2024 10:01
Someone reached out saying they could not get PyEditor working inside their LTK app. So, I spent just an hour converting the editor I wrote last year for PySheets into a widget and an example. It's only 21 lines. I am sure wrapping PyEditor is just as easy, maybe even easier. Just haven't tried that yet.
Avatar
Avatar
chris.laffra
Someone reached out saying they could not get PyEditor working inside their LTK app. So, I spent just an hour converting the editor I wrote last year for PySheets into a widget and an example. It's only 21 lines. I am sure wrapping PyEditor is just as easy, maybe even easier. Just haven't tried that yet.
Andrea Giammarchi 25/06/2024 10:16
I bet that's usual headers issue ... PyEditor uses workers by design to avoid blocking the whole page if bad copy/paste or infinite loops happen.
Avatar
Avatar
Andrea Giammarchi
I bet that's usual headers issue ... PyEditor uses workers by design to avoid blocking the whole page if bad copy/paste or infinite loops happen.
chris.laffra 26/06/2024 11:11
Ah, that makes sense.
Avatar
Avatar
chris.laffra
Ah, that makes sense.
Andrea Giammarchi 26/06/2024 11:30
I am hence supposing a while True: pass; in your code would make the whole thing unresponsive ... am I correct?
Avatar
Avatar
Andrea Giammarchi
I am hence supposing a while True: pass; in your code would make the whole thing unresponsive ... am I correct?
chris.laffra 26/06/2024 13:09
Yes. PySheets does not suffer from that issue as it uses a worker.
๐Ÿฅณ 1
Avatar
Embed Bokeh into HTML using Pyscript, with CSS resize handle, click here for my latest in a series of articles on Pyscript....https://dev.to/rickdelpo1/embedding-bokeh-into-html-with-pyscript-a-css-resize-handle-custom-js-callback-passing-results-back-to-a-div-on-our-html-page-4f3o (edited)
Here we explore a deeper dive into Pyscript where all my code below is circa 2024 (the newest version...
Avatar
I amde this fun little demo of PuePy+PyScript: https://expenselemur.com (it just keeps tally of who owes whom what when friends travel together) Something I'm not clear on is how to incorporate the PyScript shim files (if you want to call them that) in my PWA cache. When I include PyScript in my project, it goes and fetches a handful of other files as it runs, and I'd like a strategy to make sure I pre-cache those for a PWA. Has anyone explored that?
10:39
(see github.com/kkinder/expenselemur)
Avatar
Avatar
bouncing
I amde this fun little demo of PuePy+PyScript: https://expenselemur.com (it just keeps tally of who owes whom what when friends travel together) Something I'm not clear on is how to incorporate the PyScript shim files (if you want to call them that) in my PWA cache. When I include PyScript in my project, it goes and fetches a handful of other files as it runs, and I'd like a strategy to make sure I pre-cache those for a PWA. Has anyone explored that?
Check out the discussion about next revision (https://discord.com/channels/972017612454232116/1028271951082442832/1255516954224234606) on github. There is discussion there about PWAs...
๐Ÿ‘ 2
Avatar
@bouncing this is something we've been thinking about (PWAs) and some of us have thoughts (see link to @Andrea Giammarchi 's post over in #announcements ). As always, guidance from the community is important.
Avatar
Thanks @ntoll and @Neon22 , I'll head over there.
Avatar
์ž„์ง€ํ›ˆ_CODENAME 22/07/2024 10:19
Hello! My name is jihoon lim, who is creating an education service in Korea! This time, we will make and introduce a service to learn Python in a fun way! It's an educational engine and coding workspace made using a script It's a similar form to Scratch! Please give us a lot of feedback! We are also providing materials if you want to use them in your current class! Please feel free to register! Thank you! Description Page: https://codegamerphy.imweb.me/ Coding workspace: https://neon-brioche-d0a41e.netlify.app/compiler/1/1
Web site created using create-react-app
Avatar
Hi, any way to avoid the "Downloading pyodide-023-2..." message each time the html page is reloaded ?
Avatar
Avatar
khl
Hi, any way to avoid the "Downloading pyodide-023-2..." message each time the html page is reloaded ?
chris.laffra 23/07/2024 14:12
LTK does not like the message either and removes it in the kitchensink as follows: https://github.com/pyscript/ltk/blob/main/kitchensink.py#L27C1-L27C31
LTK is a little toolkit for writing UIs in PyScript - pyscript/ltk
Avatar
Hi, just thought I'd post a little project I've been working on here. It's a markov chain text generator I wrote in python and got working with pyscript (albeit a bit spaghettified). A fair warning, it needs to download about 140MiB of JSON files to work (so don't open it if you are on a tight data plan!) https://etpc.dev/proj/markov
Avatar
@etpc n-grams are fun! Input: "Once upon a..." Output: "Once upon a great, Would run away ran trembling into paradise to make catlings on. Give me in the squire overtook a man-monster hath detained in the Gascon. OTHELLO. O, a wrong to it, and Barney is the Vicar, amused himself cheered me in any hospitable shore. " ๐Ÿ˜„
09:38
Nice job!
Avatar
Avatar
ntoll
Nice job!
Thank you, glad you found it fun!
Avatar
Is the stock market overvalued in 2024? Thanks to a Python library called Bokeh we can chart the...
Avatar
Deployed! landing page with live examples is now ready!! Posted a couple of times in #โ•ฐโ•ธmaking-this as I was building, but now you can play around with it as well. Sign up flow will land in a month! https://www.pykernel.com All powered by pyscript!
Write, share and run Python code. Experience the power of Python right in your browser. No installation required. Powered by PyScript, Pyodide & Micropython.
๐ŸŽ‰ 3
๐Ÿ‘ 1
Avatar
I made a image format converter using pillow ๐Ÿ™‚ https://morpha.app/ Thanks to pyscript!
Easily convert images to formats like JPEG, PNG, WEBP, and more with Morpha.app's free online Image Format Converter. No downloads or ads required.
๐ŸŽ‰ 6
๐Ÿ‘ 1
Avatar
Avatar
Reff
I made a image format converter using pillow ๐Ÿ™‚ https://morpha.app/ Thanks to pyscript!
So is this running entirely in my browser. (I.e. no uploads to server). If it is - you might want to indicate that. I.e. "Your images are not being uploaded to any remote server." I have found this privacy information makes a huge difference to people using pages like this. Cheers...
๐Ÿ‘ 1
Avatar
Looks like you still have the py-editor included ๐Ÿ™‚ Also the use of the label "Upload" might also lead people to think you are uploading the images to a remote server. Consider "Convert". If you don;t mind me asking, what mechanism did you use to get the directory option working. I don't think the official Filesystem API has been supported yet by Pyscript (https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) I would love to know how to do it.
The File System API โ€” with extensions provided via the File System Access API to access files on the device file system โ€” allows read, write and file management capabilities.
๐Ÿ‘ 2
Avatar
Avatar
Neon22
So is this running entirely in my browser. (I.e. no uploads to server). If it is - you might want to indicate that. I.e. "Your images are not being uploaded to any remote server." I have found this privacy information makes a huge difference to people using pages like this. Cheers...
Thanks for the feedback! Yes, this entire process runs locally in the browser, with no images uploaded (the page is static) Iโ€™ll definitely add a note about that for clarity, thanks for the tip!
Avatar
Avatar
Neon22
Looks like you still have the py-editor included ๐Ÿ™‚ Also the use of the label "Upload" might also lead people to think you are uploading the images to a remote server. Consider "Convert". If you don;t mind me asking, what mechanism did you use to get the directory option working. I don't think the official Filesystem API has been supported yet by Pyscript (https://developer.mozilla.org/en-US/docs/Web/API/File_System_API) I would love to know how to do it.
As for the directory selection, I used the webkitdirectory attribute in the file input.
Avatar
I might open source the code but I like the idea of working alone on a small project
18:40
but if you are interested, viewing the page source shows all I did
18:40
the code is probably quite bloated btw so just a heads up haha
Avatar
Avatar
Reff
Thanks for the feedback! Yes, this entire process runs locally in the browser, with no images uploaded (the page is static) Iโ€™ll definitely add a note about that for clarity, thanks for the tip!
Here's how I presented it (as a Paragraph or in a Privacy Tab) Privacy note: " - This webpage and its program are entirely standalone. All processing occurs entirely within this webpage. No data is sent to a server and the files never leave your machine."
Avatar
David Vujic 12/11/2024 20:15
I have recently published a package called python-hiccup: a project that started out as a fun coding challenge for myself, and now evolving into something that could be useful. I am new to PyScript and wanted to see how the Hiccup syntax would work with it. So I cloned an existing example (The PyJokes example site) and made some changes. In main.py you will find the usage of the Hiccup syntax. Hiccup is about representing HTML in Python. Using list or tuple to represent HTML elements, and dict to represent the element attributes. https://pyscript.com/@davidvujic/pyscript-jokes-with-a-hiccup/ (edited)
๐Ÿ‘ 3
Avatar
Oooh. Nice..! ๐Ÿท ๐Ÿš€
Avatar
https://github.com/JustLachin/clapathon Clapathon EN: A motion control application that allows you to control your computer through hand gestures detected by camera. TR: Kameranฤฑn algฤฑladฤฑฤŸฤฑ el hareketleriyle bilgisayarฤฑnฤฑzฤฑ kontrol etmenizi saฤŸlayan bir hareket kontrol uygulamasฤฑ.
A motion control application that allows you to control your computer through hand gestures detected by camera. - JustLachin/clapathon
Avatar
Just created small example demonstrating usage of Sqlite Vec (vector database) in PyScript environment (for those interested in RAG might be interesting; see results in console.log).https://github.com/akbartus/PyScript-Examples/blob/main/8_sqllite_vec_example/index.html (edited)
Repository demonstrating examples of PyScript. Contribute to akbartus/PyScript-Examples development by creating an account on GitHub.
๐ŸŽ‰ 1
Avatar
Avatar
sai
Deployed! landing page with live examples is now ready!! Posted a couple of times in #โ•ฐโ•ธmaking-this as I was building, but now you can play around with it as well. Sign up flow will land in a month! https://www.pykernel.com All powered by pyscript!
Cemrehan ร‡avdar 25/01/2025 20:35
Great! I would like to read the source code. Is it, or will it be open source?
Avatar
Avatar
Cemrehan ร‡avdar
Great! I would like to read the source code. Is it, or will it be open source?
Thank you for the interest. It's not open source. But I can definitely answer any questions you have.
Avatar
Avatar
sai
Thank you for the interest. It's not open source. But I can definitely answer any questions you have.
Cemrehan ร‡avdar 30/01/2025 19:31
What i was wondering that beautiful debugger? Did you implement it or is it monaco?
๐Ÿ‘ 1
sai started a thread. 31/01/2025 15:26
Avatar
Found the Caeroc python library and tried to jam some pyscript in there. Worked perfectly with a cut and paste. Github owner has helped me with errors in the original and its working as advertised... However I am not a matplot guy and my matplotlib-fu is weak. If anyone can help with a clone fixing the two probs denoted at the end of the main.py file - please chime in. Maybe we can get some more users. ๐Ÿ™‚
Avatar
"Almost there..." ๐Ÿคฃ
Avatar
@danyeaw I just woke up to this. I've only watched the first five minutes and I already have an insane grin on my face, like the Cheshire Cat's. Perhaps share this in #โ•ฐโ•ธchat ..? It deserves to be more widely seen. Also, this is definitely going in the newsletter. Bravo! ๐Ÿš€๐Ÿค—๐Ÿป
Avatar
Ok. Finished it. Really great work. ๐Ÿ‘
Avatar
Thanks @ntoll! Unfortunately since I spent so much time going through the image stuff, my walkthrough of PyScriot became "and here it is", haha
๐Ÿ‘ 2
Avatar
What I liked was that the audience were interested in what you had built, rather than it was on PyScript. This shows PyScript is "normal" in their minds rather than something a bit out there. A very good sign.
๐Ÿ’ฏ 1
rcpffm started a thread. 26/02/2025 02:12
Avatar
Satin Playground for weavers. Uses ltk with a lot of SVG. https://neon22.pyscriptapps.com/satin-generator/latest/ (edited)
๐ŸŽ‰ 1
Avatar
my Pyweek 39 entry deployed on Pyscript ๐Ÿ˜ƒ https://pyweek.org/e/djorm/
๐Ÿ‘ 2
๐Ÿ”ฅ 4
Avatar
Avatar
Djo
my Pyweek 39 entry deployed on Pyscript ๐Ÿ˜ƒ https://pyweek.org/e/djorm/
Chris Laffra 31/03/2025 10:57
That is an impressive job!
๐Ÿ™Œ 1
Avatar
Avatar
Djo
my Pyweek 39 entry deployed on Pyscript ๐Ÿ˜ƒ https://pyweek.org/e/djorm/
Andrea Giammarchi 01/04/2025 14:50
amazing indeed ... out of curiosity, any particular reason you didn't use py-game as <script type=".."> ?
Avatar
Avatar
Andrea Giammarchi
amazing indeed ... out of curiosity, any particular reason you didn't use py-game as <script type=".."> ?
I was planning to try out running with pygame window/py-game script type, but I didn't have much time left & was already familiar/confident with webwindow The pygame_window code I have on there is written as a webwindow protocol and was just for running natively, for easier dev/testing to save having to reload things in the browser - the browser version that's running in pyscript runs fully with zengl/webwindow, and only uses pygame for a bit for rect/vector/image loading stuff. Wasn't sure if py-game script type supports running with OpenGL context? I will try it out for my next project if so!
Avatar
Avatar
Djo
I was planning to try out running with pygame window/py-game script type, but I didn't have much time left & was already familiar/confident with webwindow The pygame_window code I have on there is written as a webwindow protocol and was just for running natively, for easier dev/testing to save having to reload things in the browser - the browser version that's running in pyscript runs fully with zengl/webwindow, and only uses pygame for a bit for rect/vector/image loading stuff. Wasn't sure if py-game script type supports running with OpenGL context? I will try it out for my next project if so!
maybe have a look to pygame+ZenGL if there is a specific py-game script sample, also if you don't get it to work please tell me (edited)
Avatar
hey @Andrea Giammarchi cc @pmp-p , FYI I've just been doing a quick test of running with script type="py-game" using zengl WebGL context. It crashes with the attached errors. (it runs fine with script type="py" and using https://github.com/szabolcsdombi/webwindow) Looks like the error originates from this file within ZenGL https://github.com/szabolcsdombi/zengl/blob/main/zengl.js Let me know if you wanted any more info from the console error message drop down frames (edited)
Avatar
as a random related side note, I've also found when running with script type="py" , zengl.Image buffers with format="r32float" (used for shadow map texture) don't seem to work, and have to use a less efficient "rgba8unorm" format instead. seems that pygbag does work fine with the "r32float" format though (edited)
Avatar
Avatar
Djo
as a random related side note, I've also found when running with script type="py" , zengl.Image buffers with format="r32float" (used for shadow map texture) don't seem to work, and have to use a less efficient "rgba8unorm" format instead. seems that pygbag does work fine with the "r32float" format though (edited)
Andrea Giammarchi 14/04/2025 16:09
around this there's nothing we can do but I'd be curious to understand what is it that breaks so badly via py-game ... at the end of the day py-game is literally just py with py-game-ce currently implicitly used as dependency ... there's not much else going on in there, but I start thinking that's also not a good reason enough to have a dedicated type, if it also doesn't work as expected
Avatar
Avatar
Andrea Giammarchi
around this there's nothing we can do but I'd be curious to understand what is it that breaks so badly via py-game ... at the end of the day py-game is literally just py with py-game-ce currently implicitly used as dependency ... there's not much else going on in there, but I start thinking that's also not a good reason enough to have a dedicated type, if it also doesn't work as expected
i see. most users of pygame don't use the pygame.display.set_mode(..., flags=pygame.OPENGL) version, so its a fairly niche issue. would be cool if it worked though. I guess py-game would maybe need a similar implementation to what the JS string in the webwindow/webwindow.py library is doing, to hook onto the GL context. but that might be out of scope for it
Avatar
Avatar
Djo
i see. most users of pygame don't use the pygame.display.set_mode(..., flags=pygame.OPENGL) version, so its a fairly niche issue. would be cool if it worked though. I guess py-game would maybe need a similar implementation to what the JS string in the webwindow/webwindow.py library is doing, to hook onto the GL context. but that might be out of scope for it
Andrea Giammarchi 14/04/2025 16:23
not sure ... but also, I think this is not the best channel for this?
Avatar
yeah I was just thinking the same, drifted a bit sorry!
Avatar
I previously posted here about pykernel, I had implemented a basic step through debugger in January and have been wanting to implement the ability to execute python expressions at break points. Recently on the core.py podcast Lukasz was talking about his pyscript talk at pycon and debugging, this nudged me into finally implementing it. Will release it in a few days (still some rough edges). Here is a demo. Btw, it's all built on pyscript.
๐Ÿ”ฅ 3
๐ŸŽ‰ 1
Avatar
Gridcoin2Moon - Not4Profit 03/07/2025 09:30
Wow, that looks amazing! Good job๐Ÿ”ฅ
โค๏ธ 1
Avatar
Very cool
โค๏ธ 1
Avatar
one of my pet-peeves are hard to trace errors / exceptions in the console.log. So extending logging to logging_console ( name tbd) reults in a console log that has the same levels ( not just info ) and can be filtered on that same level by just about any browser. And Tracebacks with actual useful info on where the problem is ๐Ÿ™‚ OK , not the file and module name - work to be done ) import logging_console as logging logging.basicConfig(level=logging.INFO ) logging.getLogger().addHandler(logging.PyscriptHandler()) log = logging.getLogger() # keep default handler only for critical logs for handler in logging.getLogger().handlers: if not isinstance(handler, logging.PyscriptHandler): handler.setLevel(logging.CRITICAL) log.debug("test - debug") # ignored by default log.info("test - info") log.warning("test - warning") log.error("test - error") log.critical("test - critical") try: 1 / 0 except Exception as e: log.exception("OOPS", exc_info=e) (edited)
23:22
file and module name are available for modules that you import: (edited)
๐Ÿš€ 1
Avatar
@Jos ooooh very nice.
Avatar
Next question: how to ๐Ÿ“ฆ this, as it should work on both Python and MicroPython. I think you just created a channel for such convos
Avatar
This work would be a welcome aspect of the wider conversation about debugging and reporting in PyScript. E.g. Micropython will soon support settrace - the thing needed for us to implement a generic PyScript debugger and visibility into the performance of code. ๐Ÿ‘
Avatar
Avatar
ntoll
This work would be a welcome aspect of the wider conversation about debugging and reporting in PyScript. E.g. Micropython will soon support settrace - the thing needed for us to implement a generic PyScript debugger and visibility into the performance of code. ๐Ÿ‘
Theres a draft PR from Andrew and me, have not tried that on wasm yet though as we need some TCP port for the DAP server. Would definitely be interested in that. https://github.com/Josverl/mp_debugpy (edited)
A minimal implementation of debugpy for MicroPython, enabling remote debugging with VS Code. - Josverl/mp_debugpy
๐Ÿ‘ 1
Avatar
Original message was deleted or could not be loaded.
Does spam like this actually work? I doubt you'll find any success here.
Exported 354 message(s)
Timezone: UTC+0