fletdev
September 1, 2023, 2:22pm
1
Hello,
I’ve noticed the format of .replit
file changed to TOML since the last time I used it (Python repl loads an incorrect package - Support / Bug Reports - Replit Ask ).
Now it doesn’t seem I can disable guessing imports.
I have the following in .replit
file:
entrypoint = "main.py"
modules = ["python-3.10:v18-20230807-322e88b"]
hidden = [".pythonlibs"]
[nix]
channel = "stable-23_05"
[deployment]
run = ["sh", "-c", "python3 main.py"]
[packager]
language = "python3"
ignoredPackages = ["flet-pyodide"]
[packager.features]
packageSearch = false
guessImports = false
and yet replit keeps installing flet-pyodide
package when running repl.
What am I doing wrong?
2 Likes
Olivbon
September 1, 2023, 2:24pm
2
you are not doing anything wrong what has happened is replit made it different maybe research whats goin g on
1 Like
One way to prevent Replit from auto-installing packages is to run this in Shell :
I’m not certain, but this may break the packager. Even if it does, you can always just use poetry
directly from the Shell .
4 Likes
Problem -
Sometimes when I run my python repl, the packager starts importing/guessing packages even though it is configured not to in .replit file.
The packager should not be guessing and installing packages in my repl, so the configuration is not working.
How to reproduce -
Create a python (or pygame) repl.
In the .replit file, add some packager configuration, then reload shell:
# disables auto-import according to docs
[packager]
language = "python3"
ignoredPackages = ["pygame", "fold"]
…
The configuration doesn’t work so you’ll have to either:
1 - If possible, tell upm explicitly which package to import with a comment
import pygame #upm package(pygame-ce)
2 - Break upm so it can’t guess anything (also disables packager tab)
Either use the shell command or delete the contents of .upm/store.json
to break upm.
Replit will just restore it because it thinks you are doing “destructive actions” and it is trying to “help you” but it is not helpful at all.
2 Likes
It doesn’t look like UPM restores the cache. It’ll only do that if you delete the entire file.
fletdev
September 11, 2023, 5:47pm
7
Import comment worked like a charm, thank you!
import flet as ft #upm package(flet)