question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Use `script` tag instead of custom `py-script`

See original GitHub issue

HTML <script> tag already supports to be used to host other languages than Javascript, with the type or language attributes, so there’s no need to use a custom <py-script> tag. Replace <py-script> tag with standard <script> one, or at least add support to use both of them.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
pzwangcommented, May 13, 2022

No disrespect but I think this position is insulting to the intelligence of the average person. Editing a html tag is well within the grasp of an average person.

I don’t question that the average person can edit HTML tags - that’s why PyScript leverages HTML. 😃

However, coming from a background of teaching Python and computers to many, many non-programmer types, it is my experience that every single additional character, symbol, etc. is a rock in their shoe. Especially if this is something that has to get typed repeatedly in various sections of the HTML.

If the <script> tag were only to appear once, in the <head>, then that’d be one thing. But it has to appear every single time that a user wants to insert some Python. This could be in the event handler of a button. This could be within some snippet of d3. Every. Single. Place. has to now expand to a much more verbose, more error-prone pile of text. And if the user mistypes it? <script type="python"> or <script type="text/python"> instead of <script type="text/x-python">? Then our JS preprocessor will silently ignore it, and the user won’t understand why their thing didn’t work.

And none of this removes the fact that there will be <py-repl>, <py-ui>, and may other kinds of tags within the PyScript framework.

I really don’t understand what the hang-up is. WebComponents are a standard part of HTML. Angular and many other frameworks define their own tag. Why can’t PyScript?

0reactions
pzwangcommented, May 16, 2022

This is a design issue. As maintainers, we have given our rationale, rooted in the overall philosophy of the project, which is to make things easy to use for non-experts and novices.

I am locking the issue to avoid further sniping and bikeshedding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Intro to PyScript: Run Python in the browser - LogRocket Blog
Learn how to deploy Python code in the browser using PyScript, a new library that builds of Pyodide and ports CPython to Wasm....
Read more >
A First Look at PyScript: Python in the Web Browser
So far, you've seen the <py-script> and <py-config> custom tags provided by the framework. Another element that you'll often want to use is ......
Read more >
PyScript Beta Lets You Run Python in the Browser - MakeUseOf
Write Python Directly Inside HTML. Your Python code sits inside a custom py-script tag within a document's body. The PyScript JavaScript file ...
Read more >
Now, You Can Build Client-Side Apps With Python.
An excellent alternative is to link our python file to the py-script tag instead of writing it inside the HTML block. We'll use...
Read more >
PyScript Tutorial | Run Python Script in the Web Browser
In the above code, we use the <py-env> inside the body tag, which takes a YAML list that has paths as its key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found