reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
19.02k stars 1.07k forks source link

unable to run "pc" due to type exceptions #127

Closed wskish closed 1 year ago

wskish commented 1 year ago

Describe the bug running "pc" on my x86 macos dev system produces type-related exceptions

To Reproduce unknown, probably environment specific

Expected behavior not an exception

Screenshots see trace below

Specifics (please complete the following information):

Additional context

% pip3.9 install pynecone-io Requirement already satisfied: pynecone-io in /usr/local/lib/python3.9/site-packages (0.1.10) Requirement already satisfied: gunicorn<21.0.0,>=20.1.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (20.1.0) Requirement already satisfied: uvicorn<0.21.0,>=0.20.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (0.20.0) Requirement already satisfied: sqlmodel<0.0.9,>=0.0.8 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (0.0.8) Requirement already satisfied: httpx<0.24.0,>=0.23.1 in /usr/local/lib/python3.9/site-packages (from pynecone-io) (0.23.1) Requirement already satisfied: typer==0.4.2 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (0.4.2) Requirement already satisfied: plotly<6.0.0,>=5.10.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (5.11.0) Requirement already satisfied: redis<5.0.0,>=4.3.5 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (4.4.0) Requirement already satisfied: rich<13.0.0,>=12.6.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (12.6.0) Requirement already satisfied: fastapi<0.89.0,>=0.88.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pynecone-io) (0.88.0) Requirement already satisfied: pydantic==1.10.2 in /usr/local/lib/python3.9/site-packages (from pynecone-io) (1.10.2) Requirement already satisfied: typing-extensions>=4.1.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from pydantic==1.10.2->pynecone-io) (4.4.0) Requirement already satisfied: click<9.0.0,>=7.1.1 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from typer==0.4.2->pynecone-io) (8.1.3) Requirement already satisfied: starlette==0.22.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from fastapi<0.89.0,>=0.88.0->pynecone-io) (0.22.0) Requirement already satisfied: anyio<5,>=3.4.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from starlette==0.22.0->fastapi<0.89.0,>=0.88.0->pynecone-io) (3.6.2) Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.9/site-packages (from gunicorn<21.0.0,>=20.1.0->pynecone-io) (65.3.0) Requirement already satisfied: httpcore<0.17.0,>=0.15.0 in /usr/local/lib/python3.9/site-packages (from httpx<0.24.0,>=0.23.1->pynecone-io) (0.15.0) Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in /usr/local/lib/python3.9/site-packages (from httpx<0.24.0,>=0.23.1->pynecone-io) (1.5.0) Requirement already satisfied: certifi in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from httpx<0.24.0,>=0.23.1->pynecone-io) (2022.12.7) Requirement already satisfied: sniffio in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from httpx<0.24.0,>=0.23.1->pynecone-io) (1.3.0) Requirement already satisfied: tenacity>=6.2.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from plotly<6.0.0,>=5.10.0->pynecone-io) (8.1.0) Requirement already satisfied: async-timeout>=4.0.2 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from redis<5.0.0,>=4.3.5->pynecone-io) (4.0.2) Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from rich<13.0.0,>=12.6.0->pynecone-io) (2.13.0) Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from rich<13.0.0,>=12.6.0->pynecone-io) (0.9.1) Requirement already satisfied: sqlalchemy2-stubs in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from sqlmodel<0.0.9,>=0.0.8->pynecone-io) (0.0.2a29) Requirement already satisfied: SQLAlchemy<=1.4.41,>=1.4.17 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from sqlmodel<0.0.9,>=0.0.8->pynecone-io) (1.4.41) Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.9/site-packages (from uvicorn<0.21.0,>=0.20.0->pynecone-io) (0.12.0) Requirement already satisfied: idna>=2.8 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0->fastapi<0.89.0,>=0.88.0->pynecone-io) (3.4) Requirement already satisfied: greenlet!=0.4.17 in /Users/wsk/Library/Python/3.9/lib/python/site-packages (from SQLAlchemy<=1.4.41,>=1.4.17->sqlmodel<0.0.9,>=0.0.8->pynecone-io) (2.0.1)

% pc
Traceback (most recent call last): File "/usr/local/bin/pc", line 5, in from pynecone.pc import main File "/usr/local/lib/python3.9/site-packages/pynecone/init.py", line 6, in from .app import App File "/usr/local/lib/python3.9/site-packages/pynecone/app.py", line 12, in from pynecone.compiler import compiler File "/usr/local/lib/python3.9/site-packages/pynecone/compiler/compiler.py", line 7, in from pynecone.compiler import templates, utils File "/usr/local/lib/python3.9/site-packages/pynecone/compiler/utils.py", line 23, in from pynecone.state import State File "/usr/local/lib/python3.9/site-packages/pynecone/state.py", line 21, in class State(Base, ABC): File "pydantic/main.py", line 282, in pydantic.main.ModelMetaclass.new os.makedirs(os.path.split(dst)[0], exist_ok=True) File "pydantic/typing.py", line 287, in pydantic.typing.resolve_annotations For use of globalns and localns see the docstring for get_type_hints(). File "/usr/local/Cellar/python@3.9/3.9.14/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py", line 292, in _eval_type return t._evaluate(globalns, localns, recursive_guard) File "/usr/local/Cellar/python@3.9/3.9.14/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py", line 553, in evaluate type = _type_check( File "/usr/local/Cellar/python@3.9/3.9.14/Frameworks/Python.framework/Versions/3.9/lib/python3.9/typing.py", line 158, in _type_check raise TypeError(f"{arg} is not valid as type argument") TypeError: typing.ClassVar[typing.Dict[str, pynecone.var.Var]] is not valid as type argument

Alek99 commented 1 year ago

Ok checking it out, Is this when you are doing pc init or pc run?

Alek99 commented 1 year ago

Oh I see this is just when you are typing pc in terminal. Does pc init/pc run work for you

wskish commented 1 year ago

"pc init" produces the same error message

wskish commented 1 year ago

uninstalling pydantic and reinstalling it fixed this for me somehow