alexmojaki / alexmojaki/futurecoder

Ideas for the question wizard

未关闭
#183 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
1.5k
派生
183
PR 合并指标
30 天内没有已合并 PR

描述

The [question wizard](https://futurecoder.io/course/#question) was added in #181. These are some ideas for improvement:

- Add more linting as in #101
- Deal with files. Pyodide has a virtual filesystem in the browser's memory, but has no access to the host machine's files. Files also add complication to a question. Handling this requires careful patching of `builtins.open`.
- When the user reads a file that doesn't exist, show the user the file path and prompt them to upload it through a standard file picker. Save the file and the path, but don't write the file to that exact path. This way if the file is modified by subsequent code, the user doesn't have to upload it again.
- Next time the user reads from that path, load it from the uploaded files.
- When the user writes a file, remember the path.
- When generating the question, include the contents of text files (both written and read) below a certain size, along with the paths.
- Maybe give users a way to download files they've written?
- Remove irrelevant code to make the question minimal.
- Try removing statements (or chunks of statements), rerunning the code, and seeing if it produces the same output.
- Try replacing code like `foo = complicated + expression(here)` with the resulting value if it's a literal, e.g. `foo = [1, 2]`.
- Show the user changes that seem to work. Let them decide if the change should be made, and probably let them make it themselves.
- Ideally, the user should be able to reject a suggestion in such a way that it won't be shown again but the system can still make other suggestions.
- Look into automated debugging resources, e.g. https://www.debuggingbook.org/
- Handle different kinds of question better. Right now there's a lot of text in the first step and it doesn't even cover everything. We could potentially ask a tree of questions like:
- Do you have some code to ask about? If no, point them to https://stackoverflow.com/help/dont-ask like now.
- Does the code work?
- No: usual flow, continue to next question.
- "Yes, but I don't understand how it works" - can check the AST for things like list comprehensions, `*args`, or list slicing to point them in the right direction.
- "Yes, but I want to make it better" - cautiously suggest https://codereview.stackexchange.com/
- Does your code involve servers, web requests, databases, etc?
- If yes, is the question really about those things, or is that just the context? Can you isolate the core problem from those things?
- If no, point to https://stackoverflow.com/help/minimal-reproducible-example like now.
- Can you put all your code in one 'file', or is the nature of imports part of your question?
- If no, maybe suggest some resources on imports, sys.path, etc.
- Handle infinite loops somehow?
- Show the values of variables and expressions like in the traceback but when there was no error.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。