V3 fastapi#173
Conversation
|
|
fb89404 to
4a4d4a7
Compare
|
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
16e1ad0 to
6965b58
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR migrates DEEPaaS from aiohttp to FastAPI as the web framework backend, marking a major version bump to 3.0.0. The migration removes training functionality and modernizes the API architecture.
- Replaces aiohttp/aiohttp-apispec with FastAPI for HTTP handling and OpenAPI generation
- Removes training endpoint support entirely across the codebase
- Updates Python version requirements and dependency management
Reviewed Changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updates version to 3.0.0, replaces aiohttp with fastapi dependencies |
| deepaas/api/ | Complete rewrite of API modules to use FastAPI routing and responses |
| deepaas/model/v2/ | Removes training methods and simplifies model wrapper architecture |
| deepaas/cmd/run.py | Switches from aiohttp web server to uvicorn for FastAPI |
| deepaas/tests/ | Updates test suite to work with new FastAPI-based architecture |
| doc/ | Updates documentation to reflect removal of training endpoints |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| assume its a custom field""" | ||
| ftype = type(field) | ||
| if issubclass(ftype, marshmallow.fields.Field) and ftype not in FIELD_CONVERTERS: | ||
| print(" Custom field") |
There was a problem hiding this comment.
Debug print statements should be removed from production code. Use logging instead or remove these statements entirely.
| def is_file_field(field): | ||
| """If this is a file field, we need to handle it differently.""" | ||
| if field is not None and field.metadata.get("type") == "file": | ||
| print(" File field") |
There was a problem hiding this comment.
Debug print statements should be removed from production code. Use logging instead or remove these statements entirely.
| """Compare endpoints in both OpenAPI specs. | ||
|
|
||
| This method ignoring methods that have been removed. | ||
| """ |
There was a problem hiding this comment.
The function accesses dictionary keys without checking if 'paths' key exists, which could raise a KeyError if the OpenAPI spec is malformed. Add validation to ensure required keys exist in the spec.
| """ | |
| """ | |
| # Validate that 'paths' key exists in both specs | |
| if 'paths' not in old_spec: | |
| raise ValueError("The old OpenAPI spec is missing the 'paths' key.") | |
| if 'paths' not in new_spec: | |
| raise ValueError("The new OpenAPI spec is missing the 'paths' key.") |
| # FIXME(aloga): Validation does not work, as we are converting from | ||
| # Marshmallow to Pydantic, check this as son as possible. | ||
| # self.model_obj.validate_response(ret) |
There was a problem hiding this comment.
Response validation is disabled which could allow invalid responses to be returned to clients. This should be fixed before production use as it bypasses important data validation.
| f"Old: {old_response.status_code}, New: {new_response.status_code}" | ||
| ) |
There was a problem hiding this comment.
There's a typo in the comment on line 75 - 'son' should be 'soon' in the FIXME comment above.
| We use this function to be able to include the router in the main | ||
| application and do things before it gets included. | ||
|
|
||
| In this case we explicitly include the model precit endpoint. |
There was a problem hiding this comment.
Typo in docstring: 'precit' should be 'predict'.
| In this case we explicitly include the model precit endpoint. | |
| In this case we explicitly include the model predict endpoint. |
7eaf30a to
219bdc6
Compare
This requires that we change all model args/responses from Marshmallow to Pydantic. Most of the code is in this change, we can split it later on two different changes (marshmallow + pydantic and FastAPI for predict).
After checking with people using the package for a while, the training methods were not used at all, therefore we are now removing the training endpoints. This also allows us to have a much more simple codebase.
Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
f0df6de to
471eb1a
Compare
Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
1f582dc to
cb0398d
Compare
|



V3 development PR.
Fixes #99