Building in Replit

Building in Replit#


The best way to run a specific file in Replit is to use the Shell tab. Inside Shell, type: python shell window

This allows one to easily run the tests. For example: python

The shell keeps track of your history. To access previously typed commands, hit the up-arrow. You can even move forward and backwards through the history with the up and down arrow keys. This reduces your typing immensely.

Setting Entrypoint#

Another way to change which file you run is to modify the .replit file. This file is hidden in the Config files section that you can’t see until you click Show hidden files.

To run a different file, change .replit in two ways:

  1. The run value references the file that you want to run. For example, the snippet of code below is set up to run

  2. The entrypoint value references the file you want to run.

# The command that runs the program. If the interpreter field is set, it will have priority and this run command will do nothing
run = "python"

entrypoint = ""
# A list of globs that specify which files and directories should
# be hidden in the workspace.
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"]


When you run a specific python file, that file should have the main-pattern. Here is an example file that follows the main-pattern.

<Students Name Here>
<Homework Info Here>

def problem_0(arg)
    problem_0 will take an integer argument and print it.

def main():

if __name__ == '__main__':