userscript.zone: search for userscripts by URL, domain or search term
userscript.zone
userscript.zone
userscripts + pyscript => script any web page using python
this is a bit of a convoluted example but e.g. imagine you want to be able to grep web pages visually, boom just write a userscript that uses CLIP to find the DOM element you are looking for, whether that's visually or with just text.or if you want semantic text search, or even something simpler like find all the text matching
x.isnumeric() and 10000 > int(x) > 5000
or imagine reading a blog post and you want to annotate interactively/play a bit with the ideas presented. imagine you could insert some jupyter cells inlined between the article paragraphs, with full matplotlib plots and everything, then save and export the annotated article to be shared with others- vastly multiplying the number of available libraries at one's disposal to tweak the browsing experience
- less wheel reinvention and writing less code
It sounds to me like the body of what you’re wanting is the ability to execute code outside the browser. That would, of course, be rather hazardous for security, and there’s a reason why user script managers don’t expose such a thing. But it’s not actually all that hard to do, especially if you’re willing to take the form of running an HTTP server on localhost and treat that as an FFI boundary.
In case you thought otherwise: PyScript will not run anything like CLIP, which makes liberal use of non-Python code. You could conceivably compile something like CLIP to WebAssembly, but it would certainly be slower, probably vastly slower; or perhaps JavaScript + WebGPU would be a better target.
I understand there are challenges that may make this idea infeasible or just not worth the maintenance effort. But if it existed, I would definitely try it. I like python. I don't like JavaScript as much. I have hundreds of small python projects from which I can draw experience and code samples. If I could use those directly in a browser, I could do some neat stuff. Or, I could re-implement them in the JavaScript ecosystem. But I have never done that. Because it's not fun for me.
If you like CLIP, just writing CLIP.js would be much much easier (and have more applications).
> x.isnumeric() and 10000 > int(x) > 5000
isFinite(x) && 10000 > x && x > 5000
Learning another C-like scripting language when you already know one is really not very difficult (certainly hella easier than learning a new set of platform APIs).Bidirectional python<->javascript communication, + the entirety of the python ecosystem
However I suppose it could be done with Ghost.py or similar library?
I didn't say it wasn't possible. It's just going to be inefficient, high-maintenance and have a steep learning curve.
> + the entirety of the python ecosystem
Worth noting: you would only be able to use "self-contained" or "pure" libraries from the python ecosystem; any Python-only APIs in use for IO won't translate to a browser environment (or will need explicit re-implementation to map them to something different).
It's essentially about learning the difference between IO API surface (DOM/W3C web APIs -vs- Python File IO/networking/etc.) and language syntax (PEP vs ECMA). Syntax translation is the (relatively) easy part - API mapping is a massive moving target, as well as an added learning curve for programmers using your system.