- Notifications
You must be signed in to change notification settings - Fork0
A platform for beginners to learn programming in Python
License
deeplearning2012/futurecoder
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a platform/course for complete beginners to teach themselves programming, specifically in Python. Currently it's very much a work in progress - please considercontributing!
You can try a demo here:https://futurecoder.herokuapp.com/
The course is a fully interactive 'book' which requires the user to run code in the provided editor or shell to advance:
The code at each step is checked automatically. Common mistakes can be caught and pointed out to the student. If needed, the student can get small hints to gradually guide them to the solution:
If they're still really stuck, they can reveal the solution bit by bit:
Tracebacks are more helpful than usual, highlighting the exact operation which failed and ensuring that the right amount of context is visible for multiline statements:
Several debuggers are provided, includingsnoop:
andPython Tutor:
While most of the groundwork is in place, there is a lot to do to make this a complete course ready for users. All kinds of help are needed and greatly appreciated.
For starters, try using the platform to see what it's like. You can go straight to thedemo site and quickly sign up for an account. See theControls section below if you're not sure how to use it. Please give feedback about anything that's confusing, could be done better, or doesn't work.
In the event that the demo site gets more attention than it can handle, tryrunning the code locally with the instructions below.
The easiest way to contribute concretely is to write learning material for the course. This doesn't require any expertise beyond knowing how Python works. Seethis issue for some guidance and join the conversation!
Beyond that, there's plenty of coding work to do on the platform, including frontend, backend, and devops work. See thelist of issues for some ideas.
- Fork the repository, and clone your fork.
- If you want to run the system using Docker, which may be easier and will more closely resemble the production environment:
- Ensure you have docker and docker-compose installed.
- Create an empty file called
.envin the repo root. - Run
docker-compose up. - Skip the following two steps, everything should be running now.
- In the
backendfolder:- Ensure the
pythoncommand points to Python 3.8. - Run
./setup.sh. This will:- Install
poetryif needed. - Create a virtualenv and install Python dependencies.
- Create a sqlite database, run migrations, and create a user.
- Install
- Activate the virtualenv with
poetry shell. - Run the backend development server with
./manage.py runserver.
- Ensure the
- In the
frontendfolder:- Ensure you have recent versions of
nodeandnpm. - Run
npm installto download dependencies. - Run
npm startto start the frontend development server.
- Ensure you have recent versions of
- Go tohttp://localhost:3000/accounts/login/ and login with the email "admin@example.com" and the password "admin".
- You should be redirected tohttp://localhost:3000/course/ and see the start of the course: "Introducing The Shell".
The course consists ofpages and each page consists ofsteps. Each step requires that the user runs some code that satisfies the requirements of that step. Once they succeed, they are shown the next step. Once they complete all the steps in a page, they are shown the "Next page" button to move forward. They can click "Previous" if they want to review completed pages, but it doesn't affect their progress - any code they submit is still evaluated against the current step, and refreshing the page returns to the last page. Hopefully these basics (without the formal details) should become intuitively clear to the user as they try to use the site.
To explore the course more freely:
- Click the hamburger menu icon in the top left.
- Click Settings.
- Turn Developer mode on.
- This should give you two red buttons floating at the bottom of the screen. They change the currently active step, so you can move forward without having to complete exercises or backwards to test a step again.
At the beginning of the course only the shell is available to encourage quick exploration. After a few pages an editor is introduced to allow running full programs.
The course provides three debuggers to specially run code: snoop, PythonTutor, and birdseye. Each should only become available starting from a specific page which introduces that tool. No such page has been written yet for birdseye, so for now it's immediately available when the editor is introduced.
The UI is written in React. It communicates with the web server using therpc function, e.g.rpc("run_code", {code, source}, onSuccess). This eventually reaches a method in theAPI class, e.g.def run_code(self, code, source):.
Running code specifically sends a request from the web server to the workers master server. This forwards the request to a process associated with that user's ID, starting a new process if necessary. Every user has their own process, which holds the state of the shell or the currently running program (which may be awaitinginput()). The processes are isolated from each other and everything else, they can easily be terminated, and they have limitations on CPU time usage and file access.
After the code finishes running, it checks thePage andStep that the user is currently on, and calls theStep.check method. In most cases this is aVerbatimStep - the user is supposed to enter exactly the code in the text, using the AST to check for equality. Next most common is anExerciseStep where a function has to pass tests and produce the same output as a given solution. The result ofStep.check determines if the user succeeded and advances to the next step. It may also return a message to show the user, e.g. if they made a common mistake.
About
A platform for beginners to learn programming in Python
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Python67.3%
- JavaScript17.8%
- CSS7.8%
- HTML6.2%
- Other0.9%






