Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update pydantic and fastapi requirements Signed-off-by: Mattt Zmuda <[email protected]> * Define PYDANTIC_V2 Signed-off-by: Mattt Zmuda <[email protected]> * Replace use of ErrorWrapper removed in pydantic v2 Signed-off-by: Mattt Zmuda <[email protected]> * Update predictor model config and output types Signed-off-by: Mattt Zmuda <[email protected]> * Pass string literal for extra value * Set explicit None values for optional fields Signed-off-by: Mattt Zmuda <[email protected]> * Give output field an explicit default of None Signed-off-by: Mattt Zmuda <[email protected]> * Import types from typing instead of accessing through namespace Signed-off-by: Mattt Zmuda <[email protected]> * Set extra in model config Set default description for enumerations Signed-off-by: Mattt Zmuda <[email protected]> * Actually, don't allow additional properties Signed-off-by: Mattt Zmuda <[email protected]> * Fix generated schema for webhook event filter Signed-off-by: Mattt Zmuda <[email protected]> * Fixup generated OpenAPI schema Signed-off-by: Mattt Zmuda <[email protected]> * Update expectations for test_gt_lt response JSON Signed-off-by: Mattt Zmuda <[email protected]> * Flatten allOf for component schemas Signed-off-by: Mattt Zmuda <[email protected]> * Fix validation of weights_url Signed-off-by: Mattt Zmuda <[email protected]> * Use __get_pydantic_json_schema__ instead of __modify_schema__ * Fix test_make_encodeable_ignores_files Signed-off-by: Mattt Zmuda <[email protected]> * Fix expectations for test_bad_int_input Signed-off-by: Mattt Zmuda <[email protected]> * Skip numpy tests for pydantic v2 Signed-off-by: Mattt Zmuda <[email protected]> * Fix test_make_encodeable_encodes_pydantic_models for pydantic v2 Signed-off-by: Mattt Zmuda <[email protected]> * Fix use of __get_pydantic_core_schema__ * Fix warnings for pydantic.Field construction * Fix use of deprecated dict instead of model_dump * Limit application of OpenAPI processing for default enum description * Passing test_openapi_specification_with_int_choices * Fix declarations of __get_pydantic_json_schema__ and __get_pydantic_core_schema__ * Update validate_input_type to handle annotated cog.Types * Update __get_pydantic_core_schema__ to start with is_instance_schema * Conditionalize use of deprecated dict method * Avoid re-encoding of PredictionResponse in _predict * Remove no-op if TYPE_CHECKING * Unwrap SerializationIterators after model_dump * Also unwrap SerializationIterator in make_encodeable * Replace use of choices=[] with typing.Literal * Make output schema optional so validation doesn't fail on errors * Restore choices tests and fix validation of choices in v2 * Refactor, move, and rename unwrap_pydantic_serialization_iterators to helpers module * Update AST OpenAPI generator to support Literal * Fix ast.Str and ast.Num deprecation warnings * Disable Literal support for Python 3.8 * Apply suggestions from code review Co-authored-by: Nick Stenning <[email protected]> Signed-off-by: Mattt <[email protected]> * Document unwrap_pydantic_serialization_iterators * Test on Pydantic v1 and v2 Adds a Pydantic axis to the test matrix * Fix import of Literal for Python 3.7 * Reenable and fix test_numpy * Customize openapi_schema for Pydantic v1 and v2 to get consistent spec version of 3.1.0 Extract openapi manipulation functions to helpers * Conditionalize call to unwrap_pydantic_serialization_iterators * Correctly unset title for webhook_events_filter * Skip literal tests for Python<3.9 and Pydantic<2 * Remove pyupgrade checks for ruff * Fix pyright warning in useragent * Manually remove webhook_events_filter title from OpenAPI schema * Add support for Literal to Python <=3.9 * Run typecheck with Pydantic v1 and Pydantic v2 * Replace use of deprecated dict method with model_dump * Attempt to resolve test failures related to OpenAPI generation * Fix pydantic{1,2} typecheck Copy the code to {envtmpdir} for pydantic1, since there's no way to override pyright configuration temporarily. * Fix type errors on pydantic1 * Install pydantic<2 in the cog wheel installation step. Installing pydantic>2 won't easily downgrade when the user packages require it, but upgrading works fine. --------- Signed-off-by: Mattt Zmuda <[email protected]> Signed-off-by: Mattt <[email protected]> Signed-off-by: Morgan Fainberg <[email protected]> Co-authored-by: Yorick van Pelt <[email protected]> Co-authored-by: Nick Stenning <[email protected]> Co-authored-by: Morgan Fainberg <[email protected]>
- Loading branch information