Skip to content

PythonTA Demo Website#1357

Closed
a1-su wants to merge 3 commits into
pyta-uoft:masterfrom
a1-su:pyiodide-web-demo
Closed

PythonTA Demo Website#1357
a1-su wants to merge 3 commits into
pyta-uoft:masterfrom
a1-su:pyiodide-web-demo

Conversation

@a1-su

@a1-su a1-su commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

This PR introduces a demo website involving a single web page where the user can enter code and have it checked by PythonTA. The output then gets displayed on the web page after PythonTA is run with Pyiodide.

Screenshots of your changes (if applicable) image

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality) X
🐛 Bug fix (non-breaking change that fixes an issue)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📚 Documentation update (change that only updates documentation)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • I have updated the project Changelog (this is required for all changes).
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

@a1-su a1-su requested a review from david-yz-liu June 14, 2026 00:42
@coveralls

coveralls commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 27661606537

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 90.929%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4057
Covered Lines: 3689
Line Coverage: 90.93%
Coverage Strength: 17.67 hits per line

💛 - Coveralls

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a1-su nice work! I left a few inline comments, and in response to your two questions:

  1. If you'd like to add to this to spawn a webworker for the checkAll call that's good with me
  2. I noticed this issue a while ago with watchdog, so I've actually pulled it out, but this change hasn't been released yet. For now you can leave a comment saying that the watchdog mocking is necessary until python-ta 2.13 is released.

Comment thread packages/python-ta/demo/index.html Outdated
<html>
<head>
<meta charset="utf-8" />
<style>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create a separate css file for this

Comment thread packages/python-ta/demo/index.html Outdated
</div>

<div id="output-container">
<div style="color: #666">Report will appear here.</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this style into the CSS as well

Comment thread packages/python-ta/demo/app.js Outdated
`)

const generateReport = pyodide.runPython(`
import python_ta

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose there's some tradeoff here with loading time. I believe if you move the import statement to inside generate_report the initial loading of the page will be a bit faster, but the generation of the report will be a bit slower.

Can you experiment with some profiling to see if this is the case? My intuition is we should move the import to generate_report (or, perhaps get rid of this function and just call pyodide.runPython directly in checkAll)

Comment thread packages/python-ta/demo/app.js Outdated
checkAll = (codeInput) => {
pyodide.FS.writeFile("code_input.py", codeInput)
generateReport()
const htmlOutput = pyodide.FS.readFile("report.html", { encoding: "utf8" })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than create a separate file, can we instead redirect stdout?

Comment thread packages/python-ta/demo/app.js Outdated
pyodide.FS.writeFile("code_input.py", codeInput)
generateReport()
const htmlOutput = pyodide.FS.readFile("report.html", { encoding: "utf8" })
const safeHtmlOutput = htmlOutput.replace(/"/g, "&quot;")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure what the purpose of this line is. We do sanitization at the user-input level in the HTMLReporter already; but also if this is just about escaping HTML characters there are more that we would want to escape than just ".

@a1-su a1-su requested a review from david-yz-liu June 17, 2026 02:35

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @a1-su, thanks for making these changes! Can you please close this PR and instead make a new PR to add the files to the top-level of this new repo: https://github.com/pyta-uoft/pyta-sandbox.

We'll work on iterating on this new repo in the future!

@a1-su a1-su closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants