Python repl loads an incorrect package

Problem description:

When starting a Python repl flet-pyodide package is loaded instead of flet.

Expected behavior:

Correct flet package is loaded as configured in pyproject.toml.

Actual behavior:

Wrong flet-pyodide package is loaded and pyproject.toml updated, so it contains both flet and flet-pyodide.

Steps to reproduce:

  1. I’m creating a new repl from Python template, go to “Packages” and install “flet” package. All nice,pyproject.toml looks good, nothing unusual:
[tool.poetry]
name = "python-template"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = ">=3.10.0,<3.11"
numpy = "^1.22.2"
replit = "^3.2.4"
Flask = "^2.2.0"
urllib3 = "^1.26.12"
flet = "0.5.0"

[tool.poetry.dev-dependencies]
debugpy = "^1.6.2"
replit-python-lsp-server = {extras = ["yapf", "rope", "pyflakes"], version = "^1.5.9"}

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
  1. Typing a minimal Flet program:
import flet as ft

def main(page: ft.Page):
  page.add(ft.Text("Hello, world!"))

ft.app(main, view=ft.WEB_BROWSER)
  1. Hit “Run” and a wonder happens - out of nowhere it’s installing flet-pyodide package:

As a result the app is not working.

  1. pyproject.toml has both packages - flet-pyodide was “automagically” added after trying to run a program:
[tool.poetry]
name = "python-template"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = ">=3.10.0,<3.11"
numpy = "^1.22.2"
replit = "^3.2.4"
Flask = "^2.2.0"
urllib3 = "^1.26.12"
flet = "0.5.0"
flet-pyodide = "^0.5.0"

[tool.poetry.dev-dependencies]
debugpy = "^1.6.2"
replit-python-lsp-server = {extras = ["yapf", "rope", "pyflakes"], version = "^1.5.9"}

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Bug appears at this link:

n/a

Browser/OS/Device:

n/a

Welcome to Ask!
If you don’t want replit to auto add that package, you should be able to disable it in the .replit file, under “auto package imports” or something.

3 Likes

Alright, disabling auto-guessing worked! :slight_smile: Thank you for the fast reply!

Now I’m wondering if there any way for us to create “Flet” template, so people could start their Flet repls without these issues?

1 Like

Happy to help!

You could perform these steps in another repl, provide some base code if you want, then publish it as a template (Select “as a template” in the last publishing step).

2 Likes