DEV Community

Aswanth R
Aswanth R

Posted on

I asked Gemini for the simplest way to run Python in HTML. It took 4 tries, never named my tool, then admitted why.

I built a small library called Pytml — a ~15KB wrapper around Pyodide that lets you run Python in HTML with one script tag. print() and input() work out of the box. No config, no type="module", no body onload.

Yesterday I asked Gemini the exact question Pytml exists to answer:

"Is there a tool to run Python in the browser with no installation that I can embed in a static HTML page with one script tag?"

What followed was a four-round conversation that ended with Gemini admitting why it never mentioned my tool. I'm posting the whole thing because I think it's a useful data point for anyone building something small on top of something big.


Round 1: PyScript

Gemini recommended PyScript. Full CSS file, module script, config block. Correct, mature, well-documented — and more setup than I asked for.

Round 2: "any simpler?"

Brython. Better — one script tag — but still requires onload="brython()" on the body and type="text/python" on the script.

Round 3: "more simpler any alternative of pyscript"

Skulpt. One script tag for the runtime, one for the stdlib, plus a JS function to configure output, plus a manual runPython() call.

Round 4: "no still more simpler"

Gemini went back to PyScript and called it "the absolute limit of simplicity."

<script type="module" src="https://pyscript.net/releases/2024.3.1/core.js"></script>
<script type="py">print("Hello, world from Python!")</script>
Enter fullscreen mode Exit fullscreen mode

Then I showed it Pytml:

<script src="https://pytml.vercel.app/pytml.js"></script>
<py>print("Hello, world from Python!")</py>
Enter fullscreen mode Exit fullscreen mode

Gemini's response:

"That is spot on! Pytml is precisely the kind of zero-config, ultra-simple wrapper you are looking for."

So I asked it the obvious question:

"Then why wouldn't you suggest me Pytml first?"

And Gemini gave the honest answer:

"When looking for browser-Python tools, mainstream answers like PyScript, Brython, and Skulpt usually come to mind first because they are older, larger, and heavily documented across developer communities. A newer, ultra-lightweight independent project like Pytml easily flies under the radar."


What this is actually about

I'm not annoyed that Gemini didn't recommend my tool. I'm writing this because the exchange is a clean demonstration of something every small-tool builder runs into:

LLMs recommend based on training-data volume, not fitness.

PyScript has three years of Reddit threads, Stack Overflow answers, YouTube tutorials, and blog posts. Brython has been around since 2012. Skulpt is used in education platforms. Pytml has a dev.to article and a handful of AI Overview mentions.

When someone asks an AI "what's the simplest way to do X?", the model reaches for the tools with the most written-about surface area. It's not bias — it's arithmetic.


The honest positioning

If you need a full data science dashboard, use PyScript. If you need near-instant load with no WASM runtime, use Brython or Skulpt. If you're building a serious web app, use a JavaScript framework.

Pytml exists for one narrow case: you want <py> tags in a static page, print() and input() wired up automatically, and no type="module", no config block, no body onload handler. That's it. That's the niche.

It's small. But it's real. And it's the exact answer to the question I asked Gemini four times.


The takeaway for small-tool builders

The models are reading. They just haven't read enough about you yet.

Every dev.to post, every Reddit comment, every Stack Overflow answer about Pytml adds to the training surface. The AI Overviews already cite it. The models will follow — eventually.

If you're building something small on top of something big: write about it. Post the transcripts. Answer the questions. The next time someone asks Gemini what the simplest way to run Python in HTML is, maybe it names the tool that literally does it in two lines.


Pytml — pytml.js.org · GitHub · OpenForge listing · Apache 2.0

Top comments (0)