h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 323 forks source link

App crashes when `type` is passed as a parameter to textbox component #2260

Closed buhaytza2005 closed 4 months ago

buhaytza2005 commented 4 months ago

Wave SDK Version, OS

1.0.1 & 1.0.2 (e.g. 4.2.0, Windows) wsl2 - Ubuntu

Actual behavior

The type parameter is not part of the textbox component

(A clear and concise description of what happened.)

I came back to a project I was working on - it was running with h2o_wave-1.1.0.dev0-py3-none-manylinux1_x86_64.whl from one of the older nightly builds and decided to update to 1.0.1.

Of the back of #2170 and successive PRs being merged I expected this to be in the release?

Steps To Reproduce

  1. start new project
  2. install h2o_wave
  3. copy textbox example
  4. run
  5. error Full steps below:
(.venv) ➜  test pip install h2o_wave
Collecting h2o_wave
  Downloading h2o_wave-1.0.2-py3-none-manylinux1_x86_64.whl (12.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.1/12.1 MB 6.3 MB/s eta 0:00:00
Requirement already satisfied: httpx>=0.16.1 in ./.venv/lib/python3.11/site-packages (from h2o_wave) (0.26.0)
Requirement already satisfied: inquirer in ./.venv/lib/python3.11/site-packages (from h2o_wave) (3.2.3)
Requirement already satisfied: click in ./.venv/lib/python3.11/site-packages (from h2o_wave) (8.1.7)
Requirement already satisfied: uvicorn>=0.17.6 in ./.venv/lib/python3.11/site-packages (from h2o_wave) (0.27.0.post1)
Requirement already satisfied: starlette>=0.13.8 in ./.venv/lib/python3.11/site-packages (from h2o_wave) (0.37.0)
Requirement already satisfied: certifi in ./.venv/lib/python3.11/site-packages (from httpx>=0.16.1->h2o_wave) (2024.2.2)
Requirement already satisfied: sniffio in ./.venv/lib/python3.11/site-packages (from httpx>=0.16.1->h2o_wave) (1.3.0)
Requirement already satisfied: idna in ./.venv/lib/python3.11/site-packages (from httpx>=0.16.1->h2o_wave) (3.6)
Requirement already satisfied: httpcore==1.* in ./.venv/lib/python3.11/site-packages (from httpx>=0.16.1->h2o_wave) (1.0.2)
Requirement already satisfied: anyio in ./.venv/lib/python3.11/site-packages (from httpx>=0.16.1->h2o_wave) (4.2.0)
Requirement already satisfied: h11<0.15,>=0.13 in ./.venv/lib/python3.11/site-packages (from httpcore==1.*->httpx>=0.16.1->h2o_wave) (0.14.0)
Requirement already satisfied: editor>=1.6.0 in ./.venv/lib/python3.11/site-packages (from inquirer->h2o_wave) (1.6.6)
Requirement already satisfied: readchar>=3.0.6 in ./.venv/lib/python3.11/site-packages (from inquirer->h2o_wave) (4.0.5)
Requirement already satisfied: blessed>=1.19.0 in ./.venv/lib/python3.11/site-packages (from inquirer->h2o_wave) (1.20.0)
Requirement already satisfied: six>=1.9.0 in ./.venv/lib/python3.11/site-packages (from blessed>=1.19.0->inquirer->h2o_wave) (1.16.0)
Requirement already satisfied: wcwidth>=0.1.4 in ./.venv/lib/python3.11/site-packages (from blessed>=1.19.0->inquirer->h2o_wave) (0.2.13)
Requirement already satisfied: xmod in ./.venv/lib/python3.11/site-packages (from editor>=1.6.0->inquirer->h2o_wave) (1.8.1)
Requirement already satisfied: runs in ./.venv/lib/python3.11/site-packages (from editor>=1.6.0->inquirer->h2o_wave) (1.2.2)
Requirement already satisfied: setuptools>=41.0 in ./.venv/lib/python3.11/site-packages (from readchar>=3.0.6->inquirer->h2o_wave) (59.6.0)
Installing collected packages: h2o_wave
Successfully installed h2o_wave-1.0.2
(.venv) ➜  test wave run app.py
2024/02/07 17:53:42 #
2024/02/07 17:53:42 # ┌────────────────┐ H2O Wave
2024/02/07 17:53:42 # │  ┐┌┐┐┌─┐┌ ┌┌─┐ │ 1.0.2 20240207170007
2024/02/07 17:53:42 # │  └┘└┘└─└└─┘└── │ © 2021 H2O.ai, Inc.
2024/02/07 17:53:42 # └────────────────┘
2024/02/07 17:53:42 # ┌──────────────────────────────────────┐
2024/02/07 17:53:42 # │  Running at http://localhost:10101/  │
2024/02/07 17:53:42 # └──────────────────────────────────────┘
2024/02/07 17:53:42 # {"address":":10101","base-url":"/","t":"listen","web-dir":"/tmp/test/.venv/www"}
INFO:     Will watch for changes in these directories: ['/tmp/test']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [38421] using StatReload
INFO:     Started server process [38429]
INFO:     Waiting for application startup.
2024/02/07 17:53:44 # {"host":"http://127.0.0.1:8000","route":"/","t":"app_add"}
INFO:     Application startup complete.
2024/02/07 17:53:53 # {"addr":"[::1]:51546","route":"/","t":"ui_add"}
2024/02/07 17:53:53 # {"addr":"[::1]:51546","route":"/528570a1-17f8-4194-bc71-d302194c751e","t":"ui_add"}
INFO:     127.0.0.1:57420 - "POST / HTTP/1.1" 200 OK
Unhandled exception
Traceback (most recent call last):
  File "/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py", line 360, in _process
    await self._handle(q)
  File "/tmp/test/app.py", line 42, in serve
    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: textbox() got an unexpected keyword argument 'type'
2024/02/07 17:53:53 * /528570a1-17f8-4194-bc71-d302194c751e {"d":[{},{"k":"__unhandled_error__","d":{"view":"markdown","box":"1 1 -1 -1","title":"Error","content":"```\nTraceback (most recent call last):\n  File \"/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py\", line 360, in _process\n    await self._handle(q)\n  File \"/tmp/test/app.py\", line 42, in serve\n    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: textbox() got an unexpected keyword argument 'type'\n\n```"}}]}
2024/02/07 17:54:04 # {"addr":"[::1]:37826","route":"/","t":"ui_add"}
2024/02/07 17:54:04 # {"addr":"[::1]:37826","route":"/cb774cfb-2975-49c7-8408-91c95c6b6e9f","t":"ui_add"}
INFO:     127.0.0.1:47940 - "POST / HTTP/1.1" 200 OK
Unhandled exception
Traceback (most recent call last):
  File "/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py", line 360, in _process
    await self._handle(q)
  File "/tmp/test/app.py", line 42, in serve
    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: textbox() got an unexpected keyword argument 'type'
2024/02/07 17:54:04 * /cb774cfb-2975-49c7-8408-91c95c6b6e9f {"d":[{},{"k":"__unhandled_error__","d":{"view":"markdown","box":"1 1 -1 -1","title":"Error","content":"```\nTraceback (most recent call last):\n  File \"/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py\", line 360, in _process\n    await self._handle(q)\n  File \"/tmp/test/app.py\", line 42, in serve\n    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: textbox() got an unexpected keyword argument 'type'\n\n```"}}]}
INFO:     127.0.0.1:47940 - "POST / HTTP/1.1" 200 OK
Unhandled exception
Traceback (most recent call last):
  File "/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py", line 360, in _process
    await self._handle(q)
  File "/tmp/test/app.py", line 42, in serve
    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: textbox() got an unexpected keyword argument 'type'
INFO:     127.0.0.1:47940 - "POST /disconnect HTTP/1.1" 200 OK
2024/02/07 17:54:06 # {"addr":"[::1]:51546","t":"ui_drop"}
2024/02/07 17:54:06 * /528570a1-17f8-4194-bc71-d302194c751e {"d":[{},{"k":"__unhandled_error__","d":{"view":"markdown","box":"1 1 -1 -1","title":"Error","content":"```\nTraceback (most recent call last):\n  File \"/tmp/test/.venv/lib/python3.11/site-packages/h2o_wave/server.py\", line 360, in _process\n    await self._handle(q)\n  File \"/tmp/test/app.py\", line 42, in serve\n    ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: textbox() got an unexpected keyword argument 'type'\n\n```"}}]}

If I install the wheel I previously had it works fine. Has this been somehow removed during a merge or am I just being simple?

LE: code in app.py - this is just the textbox example from main repo

from h2o_wave import ui
from h2o_wave.server import Q, main, app

@app('/')
async def serve(q: Q):
    if q.args.show_inputs:
        q.page['example'].items = [
            ui.text(f'textbox={q.args.textbox}'),
            ui.text(f'textbox_disabled={q.args.textbox_disabled}'),
            ui.text(f'textbox_readonly={q.args.textbox_readonly}'),
            ui.text(f'textbox_required={q.args.textbox_required}'),
            ui.text(f'textbox_error={q.args.textbox_error}'),
            ui.text(f'textbox_mask={q.args.textbox_mask}'),
            ui.text(f'textbox_icon={q.args.textbox_icon}'),
            ui.text(f'textbox_prefix={q.args.textbox_prefix}'),
            ui.text(f'textbox_suffix={q.args.textbox_suffix}'),
            ui.text(f'textbox_placeholder={q.args.textbox_placeholder}'),
            ui.text(f'textbox_disabled_placeholder={q.args.textbox_disabled_placeholder}'),
            ui.text(f'textbox_multiline={q.args.textbox_multiline}'),
            ui.text(f'textbox_spellcheck_disabled={q.args.textbox_spellcheck_disabled}'),
            ui.text(f'textbox_numeric={q.args.textbox_numeric}'),
            ui.text(f'textbox_tel={q.args.textbox_tel}'),
            ui.text(f'textbox_password={q.args.textbox_password}'),
            ui.button(name='show_form', label='Back', primary=True),
        ]
    else:
        q.page['example'] = ui.form_card(box='1 1 -1 -1', items=[
            ui.textbox(name='textbox', label='Standard'),
            ui.textbox(name='textbox_disabled', label='Disabled', value='I am disabled', disabled=True),
            ui.textbox(name='textbox_readonly', label='Read-only', value='I am read-only', readonly=True),
            ui.textbox(name='textbox_required', label='Required', required=True),
            ui.textbox(name='textbox_error', label='With error message', error='I have an error'),
            ui.textbox(name='textbox_mask', label='With input mask', mask='(999) 999 - 9999'),
            ui.textbox(name='textbox_icon', label='With icon', icon='Calendar'),
            ui.textbox(name='textbox_prefix', label='With prefix', prefix='http://'),
            ui.textbox(name='textbox_suffix', label='With suffix', suffix='@h2o.ai'),
            ui.textbox(name='textbox_placeholder', label='With placeholder', placeholder='I need some input'),
            ui.textbox(name='textbox_disabled_placeholder', label='Disabled with placeholder', disabled=True,
                       placeholder='I am disabled'),
            ui.textbox(name='textbox_multiline', label='Multiline textarea', multiline=True),
            ui.textbox(name='textbox_spellcheck_disabled', label='Spellcheck disabled', spellcheck=False),
            ui.textbox(name='textbox_numeric', label='With numeric keyboard (iOS, Android)', type='number'),
            ui.textbox(name='textbox_tel', label='With telephone keyboard (iOS, Android)', type='tel'),
            ui.textbox(name='textbox_password', label='Password', password=True),
            ui.button(name='show_inputs', label='Submit', primary=True),
        ])
    await q.page.save()
mturoci commented 4 months ago

Not released yet. I just cut a few hotfixes lately. You need to wait a bit :)

buhaytza2005 commented 4 months ago

Ah, cool. My apologies. I'll keep using the nightly version I have then.

Thanks for your prompt response, as always!