{"id":8150,"library":"fastapi-restful","title":"FastAPI RESTful","description":"FastAPI-RESTful provides helper utilities to streamline FastAPI development, particularly for building RESTful APIs using class-based views (CBV) and resource inferring routers. It aims to reduce boilerplate when defining API endpoints and integrates well with common patterns like SQLAlchemy sessions. The current version is 0.6.0, and it has a moderate release cadence, with minor versions released every few months, often incorporating dependency updates and bug fixes.","status":"active","version":"0.6.0","language":"en","source_language":"en","source_url":"https://github.com/yuval9313/FastApi-RESTful","tags":["fastapi","rest","api","cbv","resource","pydantic","sqlalchemy"],"install":[{"cmd":"pip install fastapi-restful","lang":"bash","label":"Base installation"},{"cmd":"pip install fastapi-restful[session]","lang":"bash","label":"Installation with SQLAlchemy session support"}],"dependencies":[{"reason":"Core dependency for building web APIs.","package":"fastapi","optional":false},{"reason":"Used by FastAPI for data validation and serialization.","package":"pydantic","optional":false},{"reason":"Required for the `[session]` extra to enable database session management.","package":"sqlalchemy","optional":true}],"imports":[{"symbol":"Resource","correct":"from fastapi_restful.resource import Resource"},{"symbol":"cbv","correct":"from fastapi_restful.cbv import cbv"},{"symbol":"InferringRouter","correct":"from fastapi_restful.inferring_router import InferringRouter"},{"note":"The `Api` class is in `fastapi_restful.api`, not `fastapi_restful.app`.","wrong":"from fastapi_restful.app import Api","symbol":"Api","correct":"from fastapi_restful.api import Api"}],"quickstart":{"code":"from fastapi import FastAPI\nfrom fastapi_restful.resource import Resource\nfrom fastapi_restful.cbv import cbv\nfrom fastapi_restful.inferring_router import InferringRouter\n\napp = FastAPI()\nrouter = InferringRouter()\n\n@cbv(router)\nclass HelloWorldResource(Resource):\n    def get_hello(self):\n        return {\"message\": \"Hello World from CBV!\"}\n\napp.include_router(router)\n\n# To run this:\n# 1. Save as main.py\n# 2. uvicorn main:app --reload\n# 3. Access http://127.0.0.1:8000/hello\n","lang":"python","description":"This quickstart demonstrates how to define a class-based view (CBV) using `fastapi-restful`'s `Resource` and `InferringRouter`. The `cbv` decorator automatically registers methods as API endpoints based on their names (e.g., `get_hello` becomes a GET endpoint at `/hello`)."},"warnings":[{"fix":"Review and update your Pydantic models and SQLAlchemy query/session patterns to align with Pydantic V2 and SQLAlchemy 2.0 APIs. Consult their respective migration guides.","message":"Version 0.5.0 introduced compatibility with Pydantic V2 and SQLAlchemy 2.0. If you are upgrading from an older version and use Pydantic or SQLAlchemy, you will likely encounter breaking changes.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Ensure your project environment uses Python 3.7 or a newer compatible version. Older Python versions will result in installation failures or runtime errors.","message":"Support for older Python versions was dropped. Versions 0.4.2 and later require Python 3.6.2+, and the project currently officially supports Python 3.7+.","severity":"breaking","affected_versions":">=0.4.2"},{"fix":"Upgrade to `fastapi-restful` version 0.4.5 or newer, which removed the strict FastAPI version locking. This allows for greater flexibility in managing your FastAPI version.","message":"Prior to version 0.4.5, `fastapi-restful` used to pin the `FastAPI` dependency more strictly. This could lead to dependency conflicts if your project relied on a different `FastAPI` version.","severity":"gotcha","affected_versions":"<=0.4.4"},{"fix":"If you intend to use SQLAlchemy integration, install the package with `pip install fastapi-restful[session]`.","message":"SQLAlchemy support (e.g., session management) requires installing the `[session]` extra. Without it, you'll encounter `ModuleNotFoundError` if you try to use related features.","severity":"gotcha","affected_versions":">=0.3.1"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install `fastapi-restful` with the session extra: `pip install fastapi-restful[session]`.","cause":"Attempting to use SQLAlchemy-related features (e.g., database session management) without installing the `[session]` extra.","error":"ModuleNotFoundError: No module named 'sqlalchemy'"},{"fix":"Migrate your Pydantic models and validation logic to be compatible with Pydantic V2. This often involves changes to how fields are defined, default values, and custom validators.","cause":"This error or similar Pydantic V2 validation errors can occur if you've upgraded `fastapi-restful` to version `0.5.0` or later, but your Pydantic models are still written for Pydantic V1.","error":"pydantic.v1.error_wrappers.ValidationError"},{"fix":"Update your SQLAlchemy code to use the SQLAlchemy 2.0 API, primarily using `select()` constructs with `session.execute()` instead of `session.query()`.","cause":"This typically indicates that you are attempting to use SQLAlchemy 1.x API methods (like `session.query()`) with SQLAlchemy 2.0, which is mandated by `fastapi-restful` versions `>=0.5.0` when the `[session]` extra is installed.","error":"AttributeError: 'Session' object has no attribute 'query'"},{"fix":"Upgrade your Python environment to version 3.7 or newer to satisfy the package's requirements.","cause":"Your current Python version does not meet the minimum requirements of the `fastapi-restful` package (e.g., Python < 3.7).","error":"ERROR: Package 'fastapi-restful' requires a different Python: ..."}]}