-
Notifications
You must be signed in to change notification settings - Fork 20
Update app to use FastAPI instead of Flask and Flasgger #53
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
Conversation
- Replaced Flask and Flasgger with FastAPI for improved performance and features. - Updated dependencies in `pyproject.toml` and `requirements.txt` to include FastAPI and Uvicorn. - Refactored API endpoints to use FastAPI's async capabilities and response models. - Removed unused imports and cleaned up the code structure.
…ting - Changed the endpoint for authentication requests from `/authenticate` to `/`. - Adjusted formatting for better readability in the Docker image build instructions and request parameters section.
…sertion formatting - Updated the test client initialization to use FastAPI's TestClient instead of Flask's test client. - Enhanced assertion formatting for better readability and consistency in error messages. - Changed variable handling for campus code to ensure proper type conversion.
|
One major change that I made is the auth endpoint. Instead of Let me know if I have to keep it or revert it. |
- Introduced a new POST endpoint `/authenticate` to maintain support for legacy authentication using PESU credentials. - Implemented input validation and error handling for the new endpoint. - Enhanced logging for better traceability during the authentication process.
|
One more thing, |
|
No. Render will be our officially recognised deployment. You are free to deploy the API on your personal websites, but the Render endpoint is the only one being maintained and monitored actively by the devs. And point to note: Render does not have any downtimes anymore, we have mitigated that issue. We can remove the latency warning from the README but I would suggest still keeping it there. |
|
I have reverted the authentication endpoint to |
achyu-dev
left a comment
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.
This Field is giving me a depreceation warning when I am running the tests.
======================================================================== warnings summary =========================================================================
..\..\..\.conda\envs\test2\Lib\site-packages\pydantic\fields.py:1093: 19 warnings
C:\Users\Achyuth S S\.conda\envs\test2\Lib\site-packages\pydantic\fields.py:1093: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================ 31 passed, 19 warnings in 20.11s =================================================================
although all tests are passing, this is just a warning.
One way to overcome, if we want to, is add a json_schema parameter wherever this Field is used
|
I still get this warning. Can we safely ignore this? As @ndigvijay had pointed before its just a VS Code extension issue 👍 fields: list[Literal[*PESUAcademyConstants.DEFAULT_FIELDS]] | None = Field(on this line Thus, when i run I get below error - > Is there a workaround to fix this? @aditeyabaral |
For this, I did a temp fix, if u dont want this, please revert @aditeyabaral |
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 the authentication API from Flask/Flasgger to FastAPI, updating the application to use modern async patterns and automatic API documentation generation. The migration includes comprehensive updates to the API structure, error handling, and testing infrastructure.
- Updated from Flask/Flasgger to FastAPI with automatic OpenAPI documentation
- Migrated synchronous route handlers to async functions with proper error handling
- Updated all test files to use FastAPI's TestClient instead of Flask's test client
- Enhanced Pydantic models with detailed field descriptions and validation
Reviewed Changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
app/app.py |
Complete rewrite to use FastAPI with async handlers, structured error handling, and automatic OpenAPI docs |
app/models/*.py |
Enhanced Pydantic models with detailed field descriptions and modern type annotations |
app/util.py |
Removed Flask-specific validation function as FastAPI handles this automatically |
app/pesu.py |
Updated type hints to use modern union syntax and improved docstrings |
tests/integration/test_*.py |
Updated all integration tests to use FastAPI TestClient |
tests/unit/test_*.py |
Modified unit tests for async compatibility and updated assertions |
pyproject.toml |
Updated dependencies and added FastAPI, uvicorn, and testing packages |
aditeyabaral
left a comment
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.
LGTM. Please pull the changes at your end and test.
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.
Updated README. Good to merge now.
achyu-dev
left a comment
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.
Looks Good to me. Please go ahead and merge

Changelog
/healthflake8torufflinter