-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: pydantic #236
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
feat: pydantic #236
Conversation
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
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 introduces Pydantic for runtime validation, upgrades test coverage, adds comprehensive mypy type checking, and refactors the calculate function to return a structured result object instead of a tuple.
- Added Pydantic models (CalculationRequest and CalculationResult) for input validation and structured output
- Expanded test coverage with new test files for error handling, edge cases, model validation, and calculator function coverage
- Enabled mypy type checking in CI/CD pipeline and added type hints throughout the codebase
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_error_handling.py | New comprehensive error handling tests for Lambda handler and CLI |
| tests/test_edge_cases.py | New edge case tests covering boundary conditions, unit combinations, and extreme values |
| src/cli.py | Fixed typo in request unit and updated to use CalculationResult object |
| src/aws_lambda.py | Updated to use CalculationResult object instead of tuple unpacking |
| pyproject.toml | Added pydantic dependency and types-requests for type checking |
| mypy.ini | New mypy configuration file with Python 3.13 settings |
| justfiles/poetry.just | Enabled mypy type checking command |
| aws-lambda-calculator/tests/test_pytest_generate_tests_sample_code.py | Updated to use CalculationResult object |
| aws-lambda-calculator/tests/test_models.py | New comprehensive tests for Pydantic models validation |
| aws-lambda-calculator/tests/test_calculator_coverage.py | New tests covering calculator utility functions |
| aws-lambda-calculator/tests/test_calculator.py | Updated to use CalculationResult object |
| aws-lambda-calculator/src/aws_lambda_calculator/pricing_scraper.py | Added type hint for region_dict |
| aws-lambda-calculator/src/aws_lambda_calculator/models.py | New Pydantic models for request validation and result structure |
| aws-lambda-calculator/src/aws_lambda_calculator/calculator.py | Added type hints, Pydantic validation, and changed return type to CalculationResult |
| aws-lambda-calculator/pyproject.toml | Added pydantic and types-requests dependencies, reordered mypy |
| aws-lambda-calculator/mypy.ini | New mypy configuration file |
| .github/workflows/code-checks.yaml | Enabled mypy type checking step in CI/CD pipeline |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
|
||
|
|
||
| def unit_conversion_memory(memory: int, memory_unit: str) -> float: | ||
| def unit_conversion_memory(memory: float, memory_unit: str) -> float: |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Copilot Autofix
AI 24 days ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
|


User description
PR Type
Enhancement, Tests
Description
Integrated Pydantic for runtime input validation with CalculationRequest and CalculationResult models
Updated calculate() function to return CalculationResult object instead of tuple
Added comprehensive test coverage for edge cases, error handling, and model validation
Enabled mypy type checking in CI/CD pipeline with proper configuration
Fixed type hints throughout codebase for better static analysis
Diagram Walkthrough
File Walkthrough
5 files
New Pydantic models for validation and typingIntegrate Pydantic validation and update return typesAdd type hints to dictionary declarationUpdate Lambda handler to use CalculationResultUpdate CLI to use CalculationResult and fix request unit6 files
Update tests to use CalculationResult objectNew comprehensive coverage tests for calculator functionsNew tests for Pydantic model validationUpdate dynamic tests to use CalculationResultNew edge case and boundary condition testsNew error handling tests for Lambda and CLI4 files
New mypy configuration for type checkingEnable mypy type checking in CI/CD pipelineUncomment and enable mypy type checking commandRoot-level mypy configuration file2 files
Add Pydantic dependency and update mypy versionAdd Pydantic and update mypy dependencies