flet-cli 0.84.0.dev0__py3-none-any.whl → 0.85.0.dev0__py3-none-any.whl

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.
@@ -2,8 +2,86 @@
2
2
 
3
3
  # Based on: https://pypi.org/project/toml-to-requirements/
4
4
 
5
+ import re
5
6
  from typing import Any, Optional
6
7
 
8
+ from packaging.requirements import Requirement
9
+
10
+
11
+ def _windows_safe(req_str: str) -> str:
12
+ """Insert a space before bare `<` or `>` so Windows cmd.exe does not
13
+ interpret them as shell redirection when the string is passed via `-r`
14
+ to a `.BAT` subprocess."""
15
+ return re.sub(r"(?<=[^ ])([<>])", r" \1", req_str)
16
+
17
+
18
+ def _poetry_version_to_pep440(version: str) -> str:
19
+ """Convert a Poetry version constraint to PEP 440 syntax.
20
+
21
+ - `^1.2.3` → `>=1.2.3`
22
+ - `~1.2.3` → `~=1.2.3` (`~=` passes through unchanged)
23
+ - `*` → `""` (no constraint)
24
+ - `1.2.3` (bare version) → `==1.2.3`
25
+ - Anything else is returned as-is (already PEP 440).
26
+ """
27
+ version = version.replace(" ", "")
28
+ if not version or version == "*":
29
+ return ""
30
+ if version.startswith("^"):
31
+ return f">={version[1:]}"
32
+ if version.startswith("~") and not version.startswith("~="):
33
+ return f"~={version[1:]}"
34
+ # Bare version number → pin with ==
35
+ if version[0].isdigit():
36
+ return f"=={version}"
37
+ return version
38
+
39
+
40
+ def _poetry_dep_to_pep508(name: str, value: Any) -> str:
41
+ """Convert a single Poetry dependency entry to a PEP 508 requirement string."""
42
+ suffix = ""
43
+
44
+ if isinstance(value, dict):
45
+ version = value.get("version")
46
+ if version:
47
+ specifier = _poetry_version_to_pep440(version)
48
+ markers = value.get("markers")
49
+ if markers is not None:
50
+ suffix = f"; {markers}"
51
+ if specifier:
52
+ return f"{name}{specifier}{suffix}"
53
+ return f"{name}{suffix}"
54
+
55
+ git_url = value.get("git")
56
+ if git_url:
57
+ url = f"git+{git_url}" if not git_url.startswith("git@") else git_url
58
+ rev = value.get("branch") or value.get("rev") or value.get("tag")
59
+ if rev:
60
+ url = f"{url}@{rev}"
61
+ subdirectory = value.get("subdirectory")
62
+ if subdirectory:
63
+ url = f"{url}#subdirectory={subdirectory}"
64
+ markers = value.get("markers")
65
+ if markers is not None:
66
+ suffix = f"; {markers}"
67
+ return f"{name} @ {url}{suffix}"
68
+
69
+ path = value.get("path")
70
+ if path:
71
+ return path
72
+
73
+ url = value.get("url")
74
+ if url:
75
+ return url
76
+
77
+ raise ValueError(f"Unsupported dependency specification: {name} = {value}")
78
+
79
+ # String value
80
+ specifier = _poetry_version_to_pep440(value)
81
+ if specifier:
82
+ return f"{name}{specifier}"
83
+ return name
84
+
7
85
 
8
86
  def get_poetry_dependencies(
9
87
  poetry_dependencies: Optional[dict[str, Any]] = None,
@@ -17,103 +95,20 @@ def get_poetry_dependencies(
17
95
  Returns:
18
96
  Sorted requirement strings or `None` when `poetry_dependencies` is `None`.
19
97
  """
20
-
21
98
  if poetry_dependencies is None:
22
99
  return None
23
100
 
24
- def format_dependency_version(dependency_name: str, dependency_value: Any):
25
- """
26
- Format a single Poetry dependency entry as a requirement specifier.
27
-
28
- Supports version constraints, git dependencies (including branch/rev/tag
29
- and subdirectory), path/url dependencies, and optional environment markers.
30
-
31
- Args:
32
- dependency_name: Dependency key in Poetry configuration.
33
- dependency_value: String or mapping that describes the dependency.
34
-
35
- Returns:
36
- A requirement string consumable by pip-style tooling.
37
-
38
- Raises:
39
- ValueError: If the dependency mapping uses an unsupported shape.
40
- """
41
-
42
- sep = "@"
43
- value = ""
44
- suffix = ""
45
-
46
- if isinstance(dependency_value, dict):
47
- version = dependency_value.get("version")
48
- if version:
49
- sep = "=="
50
- value = version
51
- else:
52
- git_url = dependency_value.get("git")
53
- if git_url:
54
- value = (
55
- f"git+{git_url}" if not git_url.startswith("git@") else git_url
56
- )
57
- rev = (
58
- dependency_value.get("branch")
59
- or dependency_value.get("rev")
60
- or dependency_value.get("tag")
61
- )
62
- if rev:
63
- value = f"{value}@{rev}"
64
- subdirectory = dependency_value.get("subdirectory")
65
- if subdirectory:
66
- value = f"{value}#subdirectory={subdirectory}"
67
- else:
68
- path = dependency_value.get("path")
69
- if path:
70
- value = path
71
- dependency_name = ""
72
- sep = ""
73
- else:
74
- url = dependency_value.get("url")
75
- if url:
76
- value = url
77
- dependency_name = ""
78
- sep = ""
79
- else:
80
- raise ValueError(
81
- "Unsupported dependency specification: "
82
- f"{dependency_name} = {dependency_value}"
83
- )
84
-
85
- # markers - common for all
86
- markers = dependency_value.get("markers")
87
- if markers is not None:
88
- suffix = f";{markers}"
89
- else:
90
- value = dependency_value
91
- sep = "=="
92
-
93
- if value.startswith("^"):
94
- sep = ">="
95
- value = value[1:]
96
- elif value.startswith("~"):
97
- sep = "~="
98
- value = value[1:]
99
- return f"{dependency_name}~={value[1:]}"
100
- elif "<" in value or ">" in value:
101
- sep = ""
102
- value = value.replace(" ", "")
103
-
104
- return f"{dependency_name}{sep}{value}{suffix}"
105
-
106
101
  dependencies: set[str] = {
107
- format_dependency_version(dependency, version)
108
- for dependency, version in poetry_dependencies.items()
109
- if dependency != "python"
102
+ _windows_safe(_poetry_dep_to_pep508(dep, ver))
103
+ for dep, ver in poetry_dependencies.items()
104
+ if dep != "python"
110
105
  }
111
106
 
112
107
  return sorted(dependencies)
113
108
 
114
109
 
115
110
  def get_project_dependencies(
116
- project_dependencies: Optional[dict[str, Any]] = None,
111
+ project_dependencies: Optional[list[str]] = None,
117
112
  ) -> Optional[list[str]]:
118
113
  """
119
114
  Normalize PEP 621 `project.dependencies` into a sorted unique list.
@@ -124,10 +119,15 @@ def get_project_dependencies(
124
119
  Returns:
125
120
  Sorted dependency strings, or `None` when input is `None`.
126
121
  """
127
-
128
122
  if project_dependencies is None:
129
123
  return None
130
124
 
131
- dependencies = set(project_dependencies)
125
+ dependencies: set[str] = set()
126
+ for dep in project_dependencies:
127
+ try:
128
+ req = Requirement(dep)
129
+ dependencies.add(_windows_safe(str(req)))
130
+ except Exception:
131
+ dependencies.add(_windows_safe(dep))
132
132
 
133
133
  return sorted(dependencies)
flet_cli/version.py CHANGED
@@ -1 +1 @@
1
- version = "0.84.0.dev0"
1
+ version = "0.85.0.dev0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-cli
3
- Version: 0.84.0.dev0
3
+ Version: 0.85.0.dev0
4
4
  Summary: Flet CLI
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==0.84.0.dev0
12
+ Requires-Dist: flet==0.85.0.dev0
13
13
  Requires-Dist: watchdog>=4.0.0
14
14
  Requires-Dist: packaging>=25.0
15
15
  Requires-Dist: qrcode>=7.4.2
@@ -1,5 +1,5 @@
1
1
  flet_cli/cli.py,sha256=iDtpgVnrdrHapnE42bkTe7Sf_bNK724bqXISozNWTRQ,3586
2
- flet_cli/version.py,sha256=ExdO2qcq00sSsu6VsdowwUDFlrFM3fUIlO-2rsoFXlY,24
2
+ flet_cli/version.py,sha256=yv8v_VNdN9AgK1BkEv8lS5QA_dmD7JF9wGR9GE6kNQg,24
3
3
  flet_cli/__pyinstaller/__init__.py,sha256=KJsKpQ6uSVslADmFaOKaxCu-GOZZtcVKnti-ripD-ug,164
4
4
  flet_cli/__pyinstaller/config.py,sha256=MN2IPu53K1RDyh_KE4wIcQH8El_n4Z3fD6NO2iq8y74,20
5
5
  flet_cli/__pyinstaller/hook-flet.py,sha256=RbiFE8-7VBsY4Dwt7a9-9gW0gUFQGjOLY1-OBsZm_mI,506
@@ -30,10 +30,10 @@ flet_cli/utils/jdk.py,sha256=8hxuptENZa8zCgumaRmx0F8ApX_ldXVQYPlx4_xiYDs,5280
30
30
  flet_cli/utils/merge.py,sha256=cZcUL1z2iaGjjFifL1KCrEj2ywLR9x6eNtOj1F2Dr6U,780
31
31
  flet_cli/utils/plist.py,sha256=oqBCkeUjUqPIf5y7XaE2seSx64FEs7yc2cukvbjFoSU,1135
32
32
  flet_cli/utils/processes.py,sha256=S0ErmI5x9S6RNMe89cf5M4ROIofMtjNZRQ29foUllJ4,2885
33
- flet_cli/utils/project_dependencies.py,sha256=_IhAevoZeICBxFWn3FJrlDCtI4zu-piGRI22fclDaGE,4320
33
+ flet_cli/utils/project_dependencies.py,sha256=kC8gZZyaGk-coNXrh6cyPM6i9RhUaXcBIvZmQ50PufY,4064
34
34
  flet_cli/utils/pyproject_toml.py,sha256=o4fAWKXMyK8vdnAO41BLI7Lt3ohMlVdlwrpaifq30Cs,1408
35
- flet_cli-0.84.0.dev0.dist-info/METADATA,sha256=cVgzGxPQ2hIqoM3E4kVV0ZfmVHxoRAU0OBepsD1x5M0,1214
36
- flet_cli-0.84.0.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
37
- flet_cli-0.84.0.dev0.dist-info/entry_points.txt,sha256=UZFR426y3mfr0wgikEFPbZ6wtGwfgykif9Obw6R7Wnc,65
38
- flet_cli-0.84.0.dev0.dist-info/top_level.txt,sha256=4_BPVAJpcNofDe3XMxajlZLBNWzWqKhRynNSBCYTKVQ,9
39
- flet_cli-0.84.0.dev0.dist-info/RECORD,,
35
+ flet_cli-0.85.0.dev0.dist-info/METADATA,sha256=8OSOoViAKIw7staMSX3jcpIn6yEyR9eBXL33lQFvLeY,1214
36
+ flet_cli-0.85.0.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
37
+ flet_cli-0.85.0.dev0.dist-info/entry_points.txt,sha256=UZFR426y3mfr0wgikEFPbZ6wtGwfgykif9Obw6R7Wnc,65
38
+ flet_cli-0.85.0.dev0.dist-info/top_level.txt,sha256=4_BPVAJpcNofDe3XMxajlZLBNWzWqKhRynNSBCYTKVQ,9
39
+ flet_cli-0.85.0.dev0.dist-info/RECORD,,