flet-web 1.0.0__tar.gz → 1.0.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/PKG-INFO +2 -2
  2. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/pyproject.toml +2 -2
  3. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_static_files.py +1 -4
  4. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/patch_index.py +6 -21
  5. flet_web-1.0.0.dev0/src/flet_web/version.py +1 -0
  6. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web.egg-info/PKG-INFO +2 -2
  7. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web.egg-info/SOURCES.txt +1 -2
  8. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web.egg-info/requires.txt +1 -1
  9. flet_web-1.0.0/src/flet_web/version.py +0 -1
  10. flet_web-1.0.0/tests/test_patch_index.py +0 -34
  11. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/README.md +0 -0
  12. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/setup.cfg +0 -0
  13. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/__init__.py +0 -0
  14. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/__init__.py +0 -0
  15. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/app.py +0 -0
  16. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_app.py +0 -0
  17. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_app_manager.py +0 -0
  18. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_fastapi.py +0 -0
  19. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_oauth.py +0 -0
  20. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/flet_upload.py +0 -0
  21. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/oauth_state.py +0 -0
  22. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/fastapi/serve_fastapi_web_app.py +0 -0
  23. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web/uploads.py +0 -0
  24. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web.egg-info/dependency_links.txt +0 -0
  25. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/src/flet_web.egg-info/top_level.txt +0 -0
  26. {flet_web-1.0.0 → flet_web-1.0.0.dev0}/tests/test_loading_logo.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-web
3
- Version: 1.0.0
3
+ Version: 1.0.0.dev0
4
4
  Summary: Flet web client in Flutter.
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==1.0.0
12
+ Requires-Dist: flet==1.0.0.dev0
13
13
  Requires-Dist: fastapi>=0.115.12
14
14
  Requires-Dist: uvicorn[standard]>=0.35.0
15
15
 
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flet-web"
3
- version = "1.0.0"
3
+ version = "1.0.0.dev0"
4
4
  description = "Flet web client in Flutter."
5
5
  authors = [{ name = "Appveyor Systems Inc.", email = "hello@flet.dev" }]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet==1.0.0",
10
+ "flet==1.0.0.dev0",
11
11
  "fastapi >=0.115.12",
12
12
  "uvicorn[standard] >=0.35.0"
13
13
  ]
@@ -177,10 +177,7 @@ class FletStaticFiles(StaticFiles):
177
177
 
178
178
  # "standard" web files
179
179
  web_dir = get_package_web_dir()
180
- if os.getenv("FLET_WEB_PATH"):
181
- logger.info(f"Web root set via FLET_WEB_PATH: {web_dir}")
182
- else:
183
- logger.info(f"Web root: {web_dir}")
180
+ logger.info(f"Web root: {web_dir}")
184
181
 
185
182
  if not os.path.exists(web_dir):
186
183
  raise RuntimeError(f"Web root path not found: {web_dir}")
@@ -16,7 +16,6 @@ def patch_index_html(
16
16
  pyodide_pre: bool = False,
17
17
  pyodide_script_path: str = "",
18
18
  pyodide_version: Optional[str] = None,
19
- app_package_url: Optional[str] = None,
20
19
  web_renderer: WebRenderer = WebRenderer.AUTO,
21
20
  route_url_strategy: RouteUrlStrategy = RouteUrlStrategy.PATH,
22
21
  no_cdn: bool = False,
@@ -34,16 +33,9 @@ def patch_index_html(
34
33
  websocket_endpoint_path: Optional websocket endpoint path.
35
34
  app_name: Optional app name used for page title and iOS web-app title meta.
36
35
  app_description: Optional app description meta content.
37
- pyodide: Whether the page should run Python in the browser. Written to
38
- the injected config either way, because a page carries whichever
39
- mode it was generated for — `flet build web` bakes Pyodide in — and
40
- serving that client from a Flet server has to turn it back off.
36
+ pyodide: Whether to enable Pyodide mode in injected runtime config.
41
37
  pyodide_pre: Whether pre-release micropip packages are allowed.
42
38
  pyodide_script_path: Path to Python entry script for Pyodide apps.
43
- app_package_url: URL of the archive holding the app's Python code,
44
- relative to the page. Written to the injected config, because a
45
- page names whichever archive it was generated for while a
46
- publisher writes its own.
47
39
  web_renderer: Web renderer mode for the frontend runtime.
48
40
  route_url_strategy: URL strategy used by frontend routing.
49
41
  no_cdn: Whether CDN asset loading should be disabled.
@@ -57,25 +49,18 @@ def patch_index_html(
57
49
  base_url = base_href.strip("/").strip()
58
50
  base_url = "/" if base_url == "" else f"/{base_url}/"
59
51
 
60
- index = re.sub(
61
- r"(<base\b[^>]*\bhref\s*=\s*)([\"'])[^\"']*\2",
62
- lambda match: f"{match[1]}{match[2]}{base_url}{match[2]}",
63
- index,
64
- count=1,
65
- flags=re.IGNORECASE,
52
+ index = index.replace(
53
+ '<base href="/">',
54
+ f'<base href="{base_url}">',
66
55
  )
67
56
 
68
57
  app_config = []
69
58
 
70
- run_in_browser = bool(pyodide and pyodide_script_path)
71
- app_config.append(f"flet.pyodide = {str(run_in_browser).lower()};")
72
-
73
- if run_in_browser:
59
+ if pyodide and pyodide_script_path:
74
60
  module_name = Path(pyodide_script_path).stem
61
+ app_config.append("flet.pyodide = true;")
75
62
  app_config.append(f"flet.micropipIncludePre = {str(pyodide_pre).lower()};")
76
63
  app_config.append(f'flet.pythonModuleName = "{module_name}";')
77
- if app_package_url:
78
- app_config.append(f'flet.appPackageUrl = "{app_package_url}";')
79
64
 
80
65
  # Pin the Pyodide runtime URL for this build. The web client used to fall
81
66
  # back to a hardcoded CDN URL when not in no-cdn mode; with multi-version
@@ -0,0 +1 @@
1
+ version = "1.0.0.dev0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-web
3
- Version: 1.0.0
3
+ Version: 1.0.0.dev0
4
4
  Summary: Flet web client in Flutter.
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==1.0.0
12
+ Requires-Dist: flet==1.0.0.dev0
13
13
  Requires-Dist: fastapi>=0.115.12
14
14
  Requires-Dist: uvicorn[standard]>=0.35.0
15
15
 
@@ -19,5 +19,4 @@ src/flet_web/fastapi/flet_static_files.py
19
19
  src/flet_web/fastapi/flet_upload.py
20
20
  src/flet_web/fastapi/oauth_state.py
21
21
  src/flet_web/fastapi/serve_fastapi_web_app.py
22
- tests/test_loading_logo.py
23
- tests/test_patch_index.py
22
+ tests/test_loading_logo.py
@@ -1,3 +1,3 @@
1
- flet==1.0.0
1
+ flet==1.0.0.dev0
2
2
  fastapi>=0.115.12
3
3
  uvicorn[standard]>=0.35.0
@@ -1 +0,0 @@
1
- version = "1.0.0"
@@ -1,34 +0,0 @@
1
- from html.parser import HTMLParser
2
- from urllib.parse import urljoin
3
-
4
- import pytest
5
-
6
- from flet_web.patch_index import patch_index_html
7
-
8
-
9
- class BaseParser(HTMLParser):
10
- def handle_starttag(self, tag, attrs):
11
- if tag == "base":
12
- self.href = dict(attrs)["href"]
13
-
14
-
15
- @pytest.mark.parametrize(
16
- "base_tag",
17
- ['<base href="/">', '<base href="/deployed/">', "<base href='/deployed/'>"],
18
- )
19
- @pytest.mark.parametrize("mount_path", ["/", "/apps/demo/"])
20
- def test_client_scripts_resolve_under_server_mount(tmp_path, base_tag, mount_path):
21
- index = tmp_path / "index.html"
22
- index.write_text(
23
- f"<html><head>{base_tag}<!-- fletAppConfig --></head>"
24
- '<body><script src="flutter_bootstrap.js"></script></body></html>',
25
- encoding="utf-8",
26
- )
27
-
28
- patch_index_html(str(index), base_href=mount_path)
29
-
30
- parser = BaseParser()
31
- parser.feed(index.read_text(encoding="utf-8"))
32
- assert urljoin(parser.href, "flutter_bootstrap.js") == (
33
- mount_path + "flutter_bootstrap.js"
34
- )
File without changes
File without changes