Fix ot the template used to build Python3 replit

I would like to propose a fix for the templates on with are build the Python3 replit project’s.

In the .replit file:

  • make the “run” line be above the “entrypoint” one, instead beeing in the “development” branch as currently

  • make anything except the “run” and “entrypoint” optional

  • if the “modules”, the value should point to the “:latest” instead of a statically assigned version

What would it fix?

Foremost, the error that the “run” is not configured and other missleading behaviours done either thru missconfiguration or bad interpretation by the editor/application

That could theoretically cause unforeseen breakages, as python changes.

What do you mean by that? Most python Repls don’t have, and usually don’t need a run command at all.

The .replit file is a lot smaller than it used to be, it’s basically down to only necessities now.

1 Like

What do you mean by that? Most python Repls don’t have, and usually don’t need a run command at all. (Either way, run is ignored if the entrypoint and modules are specified, AFAIK)

I’m referencing myself to an issue I had experienced in my mobile app.

For some reason the app started to complain that the “run” is not configured and that I should put it into the “.replit” file, even that the file was generated while the creation.

In this orginal file, the run line was in the “development” branch.

After moving the “run” line above the “entrypoint” one, the problem has vanished.

If your .replit configuration is invalid, it will say: Run isn't configured. Try adding a .replit and configuring it

Requirements:

  • There is a .replit file, it is usually hidden by default.
  • If the .replit file has a run variable (composed of either a string or list of strings) then that is used as the Run command. It does not matter if there is entrypoint or modules variable. (@Firepup650, run is not overriden by modules or entrypoint, did you confuse it with legacy [interpreter]?)
  • Otherwise, the following must be true:
    • There is an entrypoint variable which is a string of the path of the entry file. (If the file path does not exist, a different error happens.)
    • There is a valid modules variable. It is a list of strings, each of which must be one of these. If the list is empty, the variable is not present, or all of the strings are invalid modules, then it will say run is not configured.

The run, entrypoint, and modules variables are all top-level, meaning they must be near the top of .replit file (not underneath any sections such as [nix]).

TLDR:
In .replit near the top, either have a run variable, or entrypoint and modules, or all of them (run takes priority).

4 Likes

Oh probably, seeing as interpreter used the entrypoint to know what file to run.

2 Likes

As I wrote before, I use the default .replit file, with got automatilally generated while creation of a replit project.

I’m not sure why the “run” line is not on the top level but it’s in a branch of the file. This is probably the reason on the app’s confusion and working incorrectly.

2 Likes

Could you show the “development” section you’re referring to? I’ve never seen that section.

2 Likes

Hello. In the “development” branch are defaultly only:

run = [“python3”, “main.py”]
deploymentTarget = “cloudrun”

That would be under deployment not development, no?

sorry, you are correct… I wanted to write deployment and don’t know why I did started to write development in the forum :sweat_smile:

1 Like