Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
shard: [0, 1, 2, 3]
fail-fast: false
steps:
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
python-version: ['3.12', '3.13', '3.14']
fail-fast: false
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
django-version: ['5.0', '5.1', '5.2']
steps:
- uses: actions/checkout@v5
Expand Down
22 changes: 14 additions & 8 deletions django-stubs/db/models/enums.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ from _typeshed import ConvertibleToInt
from django.utils.functional import _StrOrPromise
from typing_extensions import deprecated

from django_stubs_ext.compat import MYPY

if sys.version_info >= (3, 11):
from enum import EnumType, IntEnum, StrEnum
from enum import property as enum_property
Expand Down Expand Up @@ -59,10 +61,12 @@ class _IntegerChoicesType(ChoicesType):
# all the arguments of `int.__new__`/`str.__new__` (e.g. `base`, `encoding`).
# They are omitted on purpose to avoid having convoluted stubs for these enums:
class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesType): # type: ignore[misc]
@overload
def __init__(self, x: ConvertibleToInt) -> None: ...
@overload
def __init__(self, x: ConvertibleToInt, label: _StrOrPromise) -> None: ...
if not MYPY: # noqa: PYI002
@overload
def __init__(self, x: ConvertibleToInt) -> None: ...
@overload
def __init__(self, x: ConvertibleToInt, label: _StrOrPromise) -> None: ...

@enum_property
def value(self) -> int: ...

Expand All @@ -75,10 +79,12 @@ class _TextChoicesType(ChoicesType):
def values(self) -> list[str]: ...

class TextChoices(Choices, StrEnum, metaclass=_TextChoicesType): # type: ignore[misc]
@overload
def __init__(self, object: str) -> None: ...
@overload
def __init__(self, object: str, label: _StrOrPromise) -> None: ...
if not MYPY: # noqa: PYI002
@overload
def __init__(self, object: str) -> None: ...
@overload
def __init__(self, object: str, label: _StrOrPromise) -> None: ...

@enum_property
def value(self) -> str: ...

Expand Down
2 changes: 2 additions & 0 deletions ext/django_stubs_ext/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Magic constant that mypy overrides to True during type checking
MYPY: bool = False
Loading