-
Notifications
You must be signed in to change notification settings - Fork 15
V3 fastapi #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Use logging instead or remove these statements entirely.
Copilot uses AI. Check for mistakes.
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") |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Use logging instead or remove these statements entirely.
Copilot uses AI. Check for mistakes.
"""Compare endpoints in both OpenAPI specs. | ||
This method ignoring methods that have been removed. | ||
""" |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.") |
Copilot uses AI. Check for mistakes.
# 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) |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot uses AI. Check for mistakes.
f"Old: {old_response.status_code}, New: {new_response.status_code}" | ||
) |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the comment on line 75 - 'son' should be 'soon' in the FIXME comment above.
Copilot uses AI. Check for mistakes.
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. |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Copilot uses AI. Check for mistakes.
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 <[email protected]>
Co-authored-by: alvarolopez <[email protected]>
Co-authored-by: alvarolopez <[email protected]>
f0df6de
to
471eb1a
Compare
Co-authored-by: alvarolopez <[email protected]>
1f582dc
to
cb0398d
Compare
|
V3 development PR.
Fixes #99