django-ninja
django-ninja copied to clipboard
[ `BUGFIX` ] : Fix failing `flit` build
Sorry that i didn't follow the proper contribution guidelines ( I will do better in future ),
This Pull Request fixes the failing tests...
Test Logs :
PS C:\Users\Asus\Desktop\test\django-ninja> pipenv run pytest .
================================================================== test session starts ==================================================================
platform win32 -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: C:\Users\Asus\Desktop\test\django-ninja
plugins: asyncio-0.19.0, cov-3.0.0, django-4.5.2
asyncio: mode=strict
collected 427 items
tests\test_django_models.py . [ 0%]
tests\test_orm_schemas.py . [ 0%]
tests\test_docs\test_auth.py . [ 0%]
tests\test_alias.py . [ 0%]
tests\test_api_instance.py .. [ 1%]
tests\test_app.py ............ [ 4%]
tests\test_async.py . [ 4%]
tests\test_auth.py ......................... [ 10%]
tests\test_auth_global.py .. [ 10%]
tests\test_auth_routers.py ........ [ 12%]
tests\test_body.py .. [ 13%]
tests\test_conf.py . [ 13%]
tests\test_csrf.py ... [ 14%]
tests\test_django_models.py .. [ 14%]
tests\test_enum.py .. [ 14%]
tests\test_exceptions.py ..... [ 16%]
tests\test_export_openapi_schema.py .... [ 17%]
tests\test_files.py ... [ 17%]
tests\test_forms.py ... [ 18%]
tests\test_forms_and_files.py . [ 18%]
tests\test_inheritance_routers.py ........ [ 20%]
tests\test_lists.py .......... [ 22%]
tests\test_misc.py ..... [ 24%]
tests\test_models.py .......... [ 26%]
tests\test_openapi_params.py .. [ 26%]
tests\test_openapi_schema.py ................... [ 31%]
tests\test_orm_metaclass.py ..... [ 32%]
tests\test_orm_relations.py . [ 32%]
tests\test_orm_schemas.py ............ [ 35%]
tests\test_pagination.py .......... [ 37%]
tests\test_pagination_router.py .. [ 38%]
tests\test_parser.py . [ 38%]
tests\test_path.py ...................................................................................................... [ 62%]
tests\test_query.py ......................... [ 68%]
tests\test_query_schema.py .... [ 69%]
tests\test_renderer.py ... [ 70%]
tests\test_request.py ....... [ 71%]
tests\test_response.py ........... [ 74%]
tests\test_response_cookies.py . [ 74%]
tests\test_response_multiple.py .................. [ 78%]
tests\test_response_params.py . [ 78%]
tests\test_router_path_params.py ................. [ 82%]
tests\test_schema.py ...... [ 84%]
tests\test_signature_details.py ............ [ 87%]
tests\test_test_client.py ........ [ 88%]
tests\test_union.py . [ 89%]
tests\test_utils.py ...... [ 90%]
tests\test_wraps.py ........ [ 92%]
tests\test_docs\test_auth.py .. [ 92%]
tests\test_docs\test_body.py . [ 93%]
tests\test_docs\test_form.py . [ 93%]
tests\test_docs\test_index.py . [ 93%]
tests\test_docs\test_path.py . [ 93%]
tests\test_docs\test_query.py . [ 94%]
tests\test_with_django\test_multi_param_parsing.py ......................... [100%]
================================================================== 427 passed in 4.48s ==================================================================
Also i am trying to fix all failing tests
Edit :
Initial observations conclude that typing doesn't have ForwardRef in python 3.6
So do we keep the import from pydantic.typing? ( mypy is not happy with this )
Or do we continue with a import from python typing? ( see : https://github.com/python/mypy/issues/8301 )
Edit 2 :
Changing python version to 3.7 fixes the mypy issue
MyPy ( logs ) :
(django-ninja) PS C:\Users\Asus\Desktop\test\django-ninja> mypy ninja
Success: no issues found in 45 source files
FastApi Creator Tiangolo's comment confirmed it

Changing the MyPy version to target python 3.7 fixes the codestyle issue.
But we have to drop python 3.6 support entirely
( note that pydantic is 3.7+ )
Is this acceptable to you ?