diff --git a/README.md b/README.md index 4aa8f4901..8d3c9a537 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ We rely on different `django` and `mypy` versions: | django-stubs | mypy version | django version | python version | ------------ | ---- | ---- | ---- | -| 1.10.0 | 0.931 | 3.2.x | ^3.7 +| 1.10.0 | 0.931+ | 3.2.x | ^3.7 | 1.9.0 | 0.910 | 3.2.x | ^3.6 | 1.8.0 | 0.812 | 3.1.x | ^3.6 | 1.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6 diff --git a/requirements.txt b/requirements.txt index ac6960192..061e4478a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -wheel black==22.1.0 requests==2.27.1 coreapi==2.3.3 @@ -9,4 +8,6 @@ pytest-mypy-plugins==1.9.3 psycopg2-binary -e ./django_stubs_ext -e . -mypy==0.931 + +# Overrides: +mypy==0.942 diff --git a/setup.py b/setup.py index 75fd48357..49578aae0 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def find_stub_files(name: str) -> List[str]: readme = f.read() dependencies = [ - "mypy>=0.930,<0.940", + "mypy>=0.930,<0.950", "django", "django-stubs-ext>=0.3.0", "tomli", @@ -33,7 +33,7 @@ def find_stub_files(name: str) -> List[str]: setup( name="django-stubs", - version="1.9.0", + version="1.10.0", description="Mypy stubs for Django", long_description=readme, long_description_content_type="text/markdown", diff --git a/tests/typecheck/contrib/admin/test_options.yml b/tests/typecheck/contrib/admin/test_options.yml index 3d13652a6..1d5bcdfc3 100644 --- a/tests/typecheck/contrib/admin/test_options.yml +++ b/tests/typecheck/contrib/admin/test_options.yml @@ -110,10 +110,10 @@ from django.contrib import admin class A(admin.ModelAdmin): - radio_fields = {"some_field": 0} # E: Dict entry 0 has incompatible type "str": "Literal[0]"; expected "str": "Union[Literal[1], Literal[2]]" + radio_fields = {"some_field": 0} # E: Dict entry 0 has incompatible type "str": "Literal[0]"; expected "str": "Literal[1, 2]" class B(admin.ModelAdmin): - radio_fields = {1: admin.VERTICAL} # E: Dict entry 0 has incompatible type "int": "Literal[2]"; expected "str": "Union[Literal[1], Literal[2]]" + radio_fields = {1: admin.VERTICAL} # E: Dict entry 0 has incompatible type "int": "Literal[2]"; expected "str": "Literal[1, 2]" - case: errors_for_invalid_formfield_overrides main: | from django.contrib import admin diff --git a/tests/typecheck/managers/querysets/test_annotate.yml b/tests/typecheck/managers/querysets/test_annotate.yml index 5f73b2150..ccfecf63a 100644 --- a/tests/typecheck/managers/querysets/test_annotate.yml +++ b/tests/typecheck/managers/querysets/test_annotate.yml @@ -289,7 +289,7 @@ reveal_type(values_no_params) # N: Revealed type is "builtins.dict*[builtins.str, Any]" values_list_no_params = Blog.objects.annotate(foo=F('id')).values_list().get() - reveal_type(values_list_no_params) # N: Revealed type is "builtins.tuple*[Any]" + reveal_type(values_list_no_params) # N: Revealed type is "builtins.tuple*[Any, ...]" values_list_flat_no_params = Blog.objects.annotate(foo=F('id')).values_list(flat=True).get() reveal_type(values_list_flat_no_params) # N: Revealed type is "builtins.int*" @@ -310,7 +310,7 @@ qs1 = Blog.objects.values('text').annotate(foo=F('id')) reveal_type(qs1) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.dict[builtins.str, Any]]" qs2 = Blog.objects.values_list('text').annotate(foo=F('id')) - reveal_type(qs2) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.tuple[Any]]" + reveal_type(qs2) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.tuple[Any, ...]]" qs3 = Blog.objects.values_list('text', named=True).annotate(foo=F('id')) # TODO: Would be nice to infer a NamedTuple which contains the field 'text' (str) + any number of other fields. # The reason it would have to appear to have any other fields is that annotate could potentially be called with @@ -327,7 +327,7 @@ reveal_type(before_values_no_params) # N: Revealed type is "builtins.dict*[builtins.str, Any]" before_values_list_no_params = Blog.objects.values_list().annotate(foo=F('id')).get() - reveal_type(before_values_list_no_params) # N: Revealed type is "builtins.tuple*[Any]" + reveal_type(before_values_list_no_params) # N: Revealed type is "builtins.tuple*[Any, ...]" before_values_list_flat_no_params = Blog.objects.values_list(flat=True).annotate(foo=F('id')).get() reveal_type(before_values_list_flat_no_params) # N: Revealed type is "builtins.int*" diff --git a/tests/typecheck/managers/querysets/test_basic_methods.yml b/tests/typecheck/managers/querysets/test_basic_methods.yml index ba3bd34f6..301a07a05 100644 --- a/tests/typecheck/managers/querysets/test_basic_methods.yml +++ b/tests/typecheck/managers/querysets/test_basic_methods.yml @@ -6,7 +6,7 @@ qs = Blog.objects.all() reveal_type(qs) # N: Revealed type is "django.db.models.query._QuerySet[myapp.models.Blog*, myapp.models.Blog*]" reveal_type(qs.get(id=1)) # N: Revealed type is "myapp.models.Blog*" - reveal_type(iter(qs)) # N: Revealed type is "typing.Iterator[myapp.models.Blog*]" + reveal_type(iter(qs)) # N: Revealed type is "typing.Iterator*[myapp.models.Blog*]" reveal_type(qs.iterator()) # N: Revealed type is "typing.Iterator[myapp.models.Blog*]" reveal_type(qs.first()) # N: Revealed type is "Union[myapp.models.Blog*, None]" reveal_type(qs.earliest()) # N: Revealed type is "myapp.models.Blog*" diff --git a/tests/typecheck/managers/querysets/test_values_list.yml b/tests/typecheck/managers/querysets/test_values_list.yml index 18f16603b..e954ab964 100644 --- a/tests/typecheck/managers/querysets/test_values_list.yml +++ b/tests/typecheck/managers/querysets/test_values_list.yml @@ -37,7 +37,7 @@ reveal_type(query.all().get()) # N: Revealed type is "Tuple[builtins.str]" reveal_type(query.filter(age__gt=16).get()) # N: Revealed type is "Tuple[builtins.str]" reveal_type(query.exclude(age__lte=16).get()) # N: Revealed type is "Tuple[builtins.str]" - reveal_type(query.annotate(name_length=Length("name")).get()) # N: Revealed type is "builtins.tuple*[Any]" + reveal_type(query.annotate(name_length=Length("name")).get()) # N: Revealed type is "builtins.tuple*[Any, ...]" installed_apps: - myapp files: