yuval9313 / FastApi-RESTful

Quicker way to develop FastApi
MIT License
180 stars 25 forks source link

[BUG] pydantic 2.5 not support? #267

Closed ciaoyizhen closed 8 months ago

ciaoyizhen commented 8 months ago

Describe the bug import fastapi_restfule failed

If you can generate a relevant traceback, please include it. (.test_env) caoyizhendeMacBook-Air➜ test ᐅ cd /Users/caoyizhen/Documents/python代码/test ; /usr/bin/env /Users/caoyizhen/Documents/python代码/te st/.test_env/bin/python /Users/caoyizhen/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 50436 -- /Users/caoyizhen/Documents/python代码/test/test.py Traceback (most recent call last): File "/Users/caoyizhen/Documents/python代码/test/test.py", line 109, in from fastapi_restful import Api, Resource File "/Users/caoyizhen/Documents/python代码/test/.test_env/lib/python3.9/site-packages/fastapi_restful/init.py", line 1, in from .cbv_base import Api, Resource, set_responses, take_init_parameters File "/Users/caoyizhen/Documents/python代码/test/.test_env/lib/python3.9/site-packages/fastapi_restful/cbv_base.py", line 5, in from .cbv import INCLUDE_INIT_PARAMS_KEY, RETURN_TYPES_FUNC_KEY, _cbv File "/Users/caoyizhen/Documents/python代码/test/.test_env/lib/python3.9/site-packages/fastapi_restful/cbv.py", line 11, in from typing_inspect import is_classvar ModuleNotFoundError: No module named 'typing_inspect'

To Reproduce Steps to reproduce the behavior:

  1. create dir code : mkdir test
  2. code: cd test -> python -m venv .env
  3. source .env/bin/activate
  4. pip install fastapi pydantic fastapi-restful
  5. create a python file
  6. import fastapi_restful

Expected behavior A clear and concise description of what you expected to happen.

code can be run

Screenshots If applicable, add screenshots to help explain your problem.

image image

Environment:

from fastapi import FastAPI
from fastapi.requests import Request
from fastapi_restful import Api, Resource
from pydantic import BaseModel
import uvicorn

app = FastAPI()
api = Api(app)
class Model(BaseModel):
    name : str
    age : int

class Index(Resource):
    async def post(self, request:Request):
        data = await request.json()
        data = Model(**data)
        return data

api.add_resource(Index, "/index")

if __name__ == "__main__":
    uvicorn.run(app)
Python 3.9.6

Additional context Add any other context about the problem here.

ciaoyizhen commented 8 months ago

when I pip install typing-inspect then error message TypeError: can't set attributes of built-in/extension type 'type'

image
ciaoyizhen commented 8 months ago

Sorry I forgot to instantiate my Resource