Skip to content

Commit

Permalink
Update pyodide, pyodide-worker-runner, python, selenium, snoop, and o…
Browse files Browse the repository at this point in the history
…ther dependencies (#481)
  • Loading branch information
alexmojaki authored Oct 6, 2024
1 parent 9198eb2 commit 45962e9
Show file tree
Hide file tree
Showing 12 changed files with 1,336 additions and 237 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11.2'
python-version: '3.12.1'
- name: Set up Node
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Several debuggers are provided, including [snoop](https://github.com/alexmojaki/
## Running locally

1. Fork this repo, `git clone` it, and enter the top-level `futurecoder` folder.
2. Install Python 3.11.2 and [poetry](https://python-poetry.org/docs/#installation).
2. Install Python 3.12.1 and [poetry](https://python-poetry.org/docs/#installation).
3. Run `poetry install` to install Python dependencies.
4. Run `./scripts/generate.sh`. This will generate various static files from Python used by the frontend and run some tests. Repeat this step whenever you change Python files.
5. In the `frontend` folder:
Expand Down
2 changes: 0 additions & 2 deletions core/core_imports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ executing
friendly_traceback
littleutils
markdown
packaging
pkg_resources
pure_eval
pyflakes
pygments
Expand Down
8 changes: 5 additions & 3 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from itertools import combinations
from random import shuffle
from textwrap import dedent
from tokenize import generate_tokens
from tokenize import generate_tokens, TokenError
from types import ModuleType
from typing import Union

Expand All @@ -32,9 +32,10 @@ def qa_error(message, cls=AssertionError):


def stub_module(name):
assert name not in sys.modules
sys.modules[name] = ModuleType(name)


assert "selenium" in sys.modules or not ("urllib3" in sys.modules or "certifi" in sys.modules)
stub_module("urllib3")
stub_module("certifi")

Expand Down Expand Up @@ -309,6 +310,7 @@ def wrapper(*args, **kwargs):
if TESTING:
raise
return internal_error_result(e)

return wrapper


Expand All @@ -324,7 +326,7 @@ def split_into_tokens_gen(s):
linenos = asttokens.LineNumbers(s)
try:
tokens = list(generate_tokens(StringIO(s).readline))
except SyntaxError:
except (SyntaxError, TokenError):
yield from s
return
for t1, t2 in zip(tokens, tokens[1:]):
Expand Down
8 changes: 7 additions & 1 deletion frontend/craco.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
const path = require('path');
const {PyodidePlugin} = require("@pyodide/webpack-plugin");

module.exports = {
// Output to ./course (instead of ./build)
webpack: {
plugins: {
add: [
new PyodidePlugin(),
]
},
// Output to ./course (instead of ./build)
configure: (webpackConfig, {env, paths}) => {
paths.appBuild = webpackConfig.output.path = path.resolve('course');
return webpackConfig;
Expand Down
Loading

0 comments on commit 45962e9

Please sign in to comment.