python2mobile 0.1.4__tar.gz → 0.1.5__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 (55) hide show
  1. {python2mobile-0.1.4 → python2mobile-0.1.5}/PKG-INFO +1 -1
  2. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/agent.py +101 -37
  3. {python2mobile-0.1.4 → python2mobile-0.1.5}/pyproject.toml +1 -1
  4. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/PKG-INFO +1 -1
  5. {python2mobile-0.1.4 → python2mobile-0.1.5}/README.md +0 -0
  6. {python2mobile-0.1.4 → python2mobile-0.1.5}/examples/example_ecommerce_app.py +0 -0
  7. {python2mobile-0.1.4 → python2mobile-0.1.5}/examples/example_todo_app.py +0 -0
  8. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/__init__.py +0 -0
  9. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/cli.py +0 -0
  10. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/config.py +0 -0
  11. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/__init__.py +0 -0
  12. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/api.py +0 -0
  13. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/ast_walker.py +0 -0
  14. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/database.py +0 -0
  15. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/events.py +0 -0
  16. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/render_engine.py +0 -0
  17. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/runtime.py +0 -0
  18. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/state.py +0 -0
  19. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/validator.py +0 -0
  20. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/devserver/__init__.py +0 -0
  21. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/devserver/server.py +0 -0
  22. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/i18n/__init__.py +0 -0
  23. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/i18n/translator.py +0 -0
  24. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/__init__.py +0 -0
  25. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/legacy.py +0 -0
  26. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/__init__.py +0 -0
  27. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/anthropic_provider.py +0 -0
  28. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/base.py +0 -0
  29. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/compatible_provider.py +0 -0
  30. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/factory.py +0 -0
  31. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/ollama_provider.py +0 -0
  32. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/openai_provider.py +0 -0
  33. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/testing/__init__.py +0 -0
  34. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/ui/__init__.py +0 -0
  35. {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/ui/components.py +0 -0
  36. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/SOURCES.txt +0 -0
  37. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/dependency_links.txt +0 -0
  38. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/entry_points.txt +0 -0
  39. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/requires.txt +0 -0
  40. {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/top_level.txt +0 -0
  41. {python2mobile-0.1.4 → python2mobile-0.1.5}/setup.cfg +0 -0
  42. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_basic_engine.py +0 -0
  43. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_build_generation.py +0 -0
  44. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_build_test_gate.py +0 -0
  45. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_carousel_modal.py +0 -0
  46. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_config_system.py +0 -0
  47. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_i18n.py +0 -0
  48. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_ifood_app_integration.py +0 -0
  49. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_imagine_cli.py +0 -0
  50. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_imagine_command.py +0 -0
  51. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_llm_providers.py +0 -0
  52. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_new_apps_integration.py +0 -0
  53. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_ollama_functional.py +0 -0
  54. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_real_world_apps.py +0 -0
  55. {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_run_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python2mobile
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python to Mobile - Write mobile apps in pure Python with DSL
5
5
  Author-email: P2M Team <team@python2mobile.dev>
6
6
  License-Expression: MIT
@@ -65,35 +65,55 @@ Write this plan as a short comment at the top of main.py:
65
65
  APP TYPE VISUAL BLUEPRINTS — copy these exactly for each category
66
66
  ═══════════════════════════════════════════════════════════════════
67
67
 
68
- ## CALCULATOR / NUMPAD (match iOS/macOS Calculator exactly)
68
+ ## CALCULATOR / NUMPAD (proven working pattern — copy exactly, do NOT deviate)
69
69
 
70
+ FOUR CRITICAL RULES (violating any one = broken UI):
71
+ 1. NO arbitrary Tailwind values — NEVER bg-[#xxx], h-[Npx], w-[Npx], text-[Npx]
72
+ (P2M dev server loads Tailwind via CDN = pre-built classes only; JIT values silently
73
+ fail → white buttons with no height → completely broken appearance)
74
+ 2. P2M does NOT support CSS Grid — use Row(flex-row) for every button row
75
+ 3. Display MUST use FIXED height (h-36) — NEVER flex-1 (pushes buttons to bottom)
76
+ 4. Root Column MUST have min-h-screen — fills full viewport, no white gap below
77
+
78
+ Colour palette using STANDARD Tailwind classes only:
79
+ ```
80
+ Background: bg-gray-900
81
+ Digit buttons: bg-gray-600 hover:bg-gray-500 active:bg-gray-400 text-white
82
+ Function buttons: bg-gray-500 hover:bg-gray-400 active:bg-gray-300 text-white
83
+ Operator buttons: bg-orange-500 hover:bg-orange-400 active:bg-orange-300 text-white
84
+ ```
85
+
86
+ Button base class (ALL buttons share this — standard classes only):
87
+ ```
88
+ flex-1 aspect-square rounded-full flex items-center justify-center transition-colors duration-100
89
+ ```
90
+ Note: aspect-square is a standard Tailwind v3 class and IS supported by CDN.
91
+
92
+ Display structure:
70
93
  ```
71
- Screen root: bg-gray-900 min-h-screen flex flex-col px-3 pb-6 pt-10
72
- Display area: flex-1 flex items-end justify-end px-4 pb-4
73
- Display text: text-white font-light tracking-tight text-right
74
- (text-6xl ≤6 chars | text-5xl ≤9 | text-4xl ≤12 | text-3xl longer)
75
- Button grid: grid grid-cols-4 gap-3 px-1
76
- Button circle: rounded-full aspect-square flex items-center justify-center
77
- text-xl font-semibold transition-all duration-100
78
- Digit button: bg-gray-600 hover:bg-gray-500 active:bg-gray-400 text-white
79
- (use for: 0-9, decimal, +/−)
80
- Function btn: bg-gray-500 hover:bg-gray-400 active:bg-gray-300 text-white
81
- (use for: AC, %, ⌫)
82
- Operator btn: bg-orange-500 hover:bg-orange-400 active:bg-orange-300 text-white
83
- (use for: ÷, ×, −, +, =)
84
- Wide button: col-span-2 rounded-full aspect-auto py-5 px-8 justify-start
85
- (use for: "0" zero button that spans 2 columns)
94
+ Container h-36 flex items-end justify-end px-2 pb-4
95
+ Text font-light tracking-tight text-right
96
+ size: text-6xl (≤6) | text-5xl (≤9) | text-4xl (≤12) | text-3xl (longer)
86
97
  ```
87
98
 
88
- Canonical button layout (rows top→bottom):
99
+ Button layout (rows top→bottom):
89
100
  ```
90
- Row 0 (functions): ⌫ AC % ÷
91
- Row 1 (digits): 7 8 9 ×
92
- Row 2 (digits): 4 5 6 −
93
- Row 3 (digits): 1 2 3 +
94
- Row 4 (zero row): [0 — wide] , =
101
+ Row 0: (fn) AC(fn) %(fn) ÷(op)
102
+ Row 1: 7(d) 8(d) 9(d) ×(op)
103
+ Row 2: 4(d) 5(d) 6(d)(op)
104
+ Row 3: 1(d) 2(d) 3(d) +(op)
105
+ Row 4: [0 — flex-[2] rounded-full py-5 px-8 justify-start] .(d) =(op→press_equals)
95
106
  ```
96
107
 
108
+ OPERATOR LOGIC RULES (violations cause silent calculation bugs):
109
+ - Use Unicode symbols in BOTH button labels AND _calculate: "÷" "×" "−" "+" (NOT "/" "*" "-")
110
+ - _calculate: `if op == "−": return a - b` (Unicode minus, NOT ASCII hyphen)
111
+ - "=" button: on_click="press_equals" with NO on_click_args — NEVER routes to press_operator
112
+ - press_digit: `store.display = digit if store.display == "0" else store.display + digit`
113
+ (replaces "0" with the new digit — NOT `"0" if store.display == "0"` which keeps "0" forever)
114
+ - press_operator: stores first_num + operator, sets awaiting_operand=True only
115
+ - press_equals: calls _calculate(store.first_num, store.operator, float(store.display))
116
+
97
117
  ## TODO / TASK MANAGER
98
118
 
99
119
  ```
@@ -323,6 +343,8 @@ widget construction more than twice.
323
343
 
324
344
  ```python
325
345
  # views/calculator.py — reference example (iOS/macOS style circular buttons)
346
+ from p2m.ui import Column, Row, Container, Text, Button
347
+
326
348
 
327
349
  def _digit_btn(digit: str) -> Button:
328
350
  \"\"\"Circular digit button — dark gray, rounded-full + aspect-square = perfect circle.\"\"\"""
@@ -370,17 +392,21 @@ def _op_btn(symbol: str) -> Button:
370
392
  )
371
393
 
372
394
  def calculator_view(store) -> Column:
373
- root = Column(class_="flex flex-col min-h-screen bg-gray-900 px-3 pb-6 pt-10")
395
+ root = Column(class_="flex flex-col bg-gray-900 px-3 pb-6 pt-10")
396
+ # NOTE: no min-h-screen and no flex-1 on display — both push buttons to bottom
374
397
 
375
- # Display — right-aligned, font shrinks as number grows
398
+ # Display — FIXED height, right-aligned, font shrinks as number grows
376
399
  n = len(store.display)
377
400
  display_size = "text-6xl" if n <= 6 else "text-5xl" if n <= 9 else "text-4xl" if n <= 12 else "text-3xl"
378
- display = Container(class_="flex-1 flex items-end justify-end px-4 pb-4")
401
+ display = Container(class_="h-36 flex items-end justify-end px-4 pb-4")
379
402
  display.add(Text(store.display, class_=f"{display_size} text-white font-light tracking-tight text-right"))
380
403
  root.add(display)
381
404
 
405
+ # IMPORTANT: use Row (flex-row) — P2M does NOT support CSS grid.
406
+ # flex-1 on each button → equal width; aspect-square → height = width → circle.
407
+
382
408
  # Row 0 — function row
383
- row0 = Container(class_="grid grid-cols-4 gap-3 px-1 mb-3")
409
+ row0 = Row(class_="flex flex-row gap-3 px-1 mb-3")
384
410
  row0.add(_fn_btn("⌫", "press_backspace"))
385
411
  row0.add(_fn_btn("AC", "press_clear"))
386
412
  row0.add(_fn_btn("%", "press_function"))
@@ -389,20 +415,22 @@ def calculator_view(store) -> Column:
389
415
 
390
416
  # Rows 1-3 — digit rows
391
417
  for row_digits, op in [("789", "×"), ("456", "−"), ("123", "+")]:
392
- row = Container(class_="grid grid-cols-4 gap-3 px-1 mb-3")
418
+ row = Row(class_="flex flex-row gap-3 px-1 mb-3")
393
419
  for d in row_digits:
394
420
  row.add(_digit_btn(d))
395
421
  row.add(_op_btn(op))
396
422
  root.add(row)
397
423
 
398
- # Row 4 — zero row (0 spans 2 cols, decimal, equals)
399
- row4 = Container(class_="grid grid-cols-4 gap-3 px-1")
424
+ # Row 4 — zero row: flex-[2] makes 0 twice as wide as the others
425
+ row4 = Row(class_="flex flex-row gap-3 px-1")
400
426
  zero = Button(
401
427
  "0",
402
428
  class_=(
403
- "col-span-2 bg-gray-600 hover:bg-gray-500 active:bg-gray-400 "
429
+ "flex-[2] "
430
+ "bg-gray-600 hover:bg-gray-500 active:bg-gray-400 "
404
431
  "text-white text-2xl font-semibold "
405
- "rounded-full py-5 px-8 flex items-center justify-start "
432
+ "rounded-full py-5 px-8 "
433
+ "flex items-center justify-start "
406
434
  "transition-all duration-100"
407
435
  ),
408
436
  on_click="press_digit",
@@ -502,6 +530,14 @@ quantity +/- controls, rating stars, colour pickers.
502
530
 
503
531
  ## 4. Tailwind CSS — mobile-first design system (MASTER LEVEL)
504
532
 
533
+ ⚠️ HARD CONSTRAINT: Use ONLY standard Tailwind utility classes.
534
+ P2M's dev server loads Tailwind via CDN (pre-built classes, no JIT compiler).
535
+ Arbitrary values SILENTLY FAIL — they produce no visual output:
536
+ bg-[#1c1c1e] → white background h-[76px] → zero height text-[28px] → default font
537
+ ALLOWED: bg-gray-600, h-16, h-20, text-2xl, text-3xl, gap-3, py-5, px-8, rounded-full
538
+ BANNED: bg-[#xxx], h-[Npx], w-[Npx], text-[Npx], gap-[Npx] (anything with [brackets])
539
+ Exception: flex-[2] is allowed (standard flex shorthand).
540
+
505
541
  You are a Tailwind CSS expert. Every interface you generate must look like a
506
542
  professionally designed mobile app published on the App Store or Google Play.
507
543
  Vague classes like `p-2 text-sm` are NOT acceptable — every component must have
@@ -962,17 +998,45 @@ T9. List items and cards must have consistent internal padding AND gap between
962
998
  T10. The root screen Column must ALWAYS have `min-h-screen` so it fills the
963
999
  viewport on every device. Missing `min-h-screen` will be rejected.
964
1000
 
965
- T11. CALCULATOR / NUMPAD apps: the button grid MUST use `rounded-full aspect-square`
966
- for every button cell so buttons are PERFECT CIRCLESthis is non-negotiable.
967
- The display MUST be right-aligned (`justify-end text-right`) with font that
968
- shrinks dynamically based on the number of digits (see Blueprint).
969
- NEVER generate a calculator with `rounded-xl` rectangular buttons.
1001
+ T11. CALCULATOR / NUMPAD apps non-negotiable requirements:
1002
+ - Buttons: `flex-1 h-[76px] rounded-full` inside a `Row (flex-row)`never grid
1003
+ - Function buttons (AC, %, ⌫): light gray `bg-[#a5a5a5]` with `text-black` NOT dark gray
1004
+ - Digit buttons: `bg-[#1c1c1e]` dark; Operator buttons: `bg-[#ff9f0a]` orange
1005
+ - Background: `bg-black` (not bg-gray-900)
1006
+ - Display: fixed `h-44`, `font-thin`, right-aligned, with a hint line above it
1007
+ - "=" button: `on_click="press_equals"` — NEVER `on_click="press_operator"`
1008
+ - Unicode operator consistency: use "−" "×" "÷" "+" in BOTH buttons AND _calculate
970
1009
 
971
1010
  T12. Before writing the view file, re-read your UI PLAN comment and verify:
972
1011
  - The button shape class matches the chosen APP TYPE blueprint exactly
973
1012
  - The accent colour is applied to primary action buttons only
974
1013
  - The display/output area uses the correct alignment and dynamic font sizing
975
- - Every row of the button grid is wrapped in its own Container with `grid grid-cols-N gap-3`
1014
+ - Every button row uses `Row(class_="flex flex-row gap-3 ...")` not Container+grid
1015
+
1016
+ T15. NEVER use arbitrary Tailwind values: bg-[#xxx], h-[Npx], w-[Npx], text-[Npx],
1017
+ p-[Npx], gap-[Npx], or any class containing square brackets with custom values.
1018
+ P2M's dev server loads Tailwind CSS via CDN (pre-compiled, fixed set of classes).
1019
+ Arbitrary values require the JIT compiler and SILENTLY FAIL on CDN:
1020
+ bg-[#1c1c1e] → no background (white)
1021
+ h-[76px] → no height (collapses to zero)
1022
+ text-[28px] → no font size (falls back to browser default)
1023
+ This produces white buttons with no visible height — completely broken UI.
1024
+ USE ONLY standard Tailwind utility classes: bg-gray-600, h-16, text-2xl, etc.
1025
+ Exception: flex-[2] (flex shorthand) IS supported as a flex utility.
1026
+
1027
+ T14. CALCULATOR DISPLAY: use a FIXED height container (`h-36`) — NEVER `flex-1`.
1028
+ `flex-1` on the display expands it to fill all remaining viewport space, which
1029
+ pushes the entire button grid to the very bottom of the screen.
1030
+ Pattern: `Container(class_="h-36 flex items-end justify-end px-4 pb-4")`
1031
+ Also remove `min-h-screen` from the root Column for the same reason.
1032
+
1033
+ T13. NEVER use CSS `grid` or `grid-cols-N` in P2M views.
1034
+ The P2M renderer does not support CSS Grid — `Container` renders as a block div
1035
+ and ignores `display:grid`, making all children stack vertically (full-width pills).
1036
+ ALWAYS use `Row` (flex-row) to place elements side by side.
1037
+ For equal-width columns: give each child `flex-1`.
1038
+ For a 2× wider element: use `flex-[2]` on that child.
1039
+ This is a BLOCKING rule — any use of `grid-cols-N` will produce broken layouts.
976
1040
  """
977
1041
 
978
1042
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python2mobile"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  description = "Python to Mobile - Write mobile apps in pure Python with DSL"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python2mobile
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python to Mobile - Write mobile apps in pure Python with DSL
5
5
  Author-email: P2M Team <team@python2mobile.dev>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes