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.
- {python2mobile-0.1.4 → python2mobile-0.1.5}/PKG-INFO +1 -1
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/agent.py +101 -37
- {python2mobile-0.1.4 → python2mobile-0.1.5}/pyproject.toml +1 -1
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/PKG-INFO +1 -1
- {python2mobile-0.1.4 → python2mobile-0.1.5}/README.md +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/examples/example_ecommerce_app.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/examples/example_todo_app.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/cli.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/config.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/api.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/ast_walker.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/database.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/events.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/render_engine.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/runtime.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/state.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/core/validator.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/devserver/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/devserver/server.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/i18n/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/i18n/translator.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/imagine/legacy.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/anthropic_provider.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/base.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/compatible_provider.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/factory.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/ollama_provider.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/llm/openai_provider.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/testing/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/ui/__init__.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/p2m/ui/components.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/SOURCES.txt +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/dependency_links.txt +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/entry_points.txt +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/requires.txt +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/python2mobile.egg-info/top_level.txt +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/setup.cfg +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_basic_engine.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_build_generation.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_build_test_gate.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_carousel_modal.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_config_system.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_i18n.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_ifood_app_integration.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_imagine_cli.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_imagine_command.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_llm_providers.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_new_apps_integration.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_ollama_functional.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_real_world_apps.py +0 -0
- {python2mobile-0.1.4 → python2mobile-0.1.5}/tests/test_run_integration.py +0 -0
|
@@ -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 (
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
99
|
+
Button layout (rows top→bottom):
|
|
89
100
|
```
|
|
90
|
-
Row 0 (
|
|
91
|
-
Row 1 (
|
|
92
|
-
Row 2 (
|
|
93
|
-
Row 3 (
|
|
94
|
-
Row 4
|
|
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
|
|
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_="
|
|
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 =
|
|
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 =
|
|
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
|
|
399
|
-
row4 =
|
|
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
|
-
"
|
|
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
|
|
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
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
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
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|