[Django] #29299: Inline/Out of the box Type hints(PEP 484) and Variable annotations(PEP 526)

16 views
Skip to first unread message

Django

unread,
Apr 7, 2018, 10:45:45 AM4/7/18
to django-...@googlegroups.com
#29299: Inline/Out of the box Type hints(PEP 484) and Variable annotations(PEP 526)
------------------------------------------------+------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Adhering to [https://www.python.org/dev/peps/pep-0484/ Type hints(PEP
484)] / [https://www.python.org/dev/peps/pep-0526/ type annotations] could
contribute to being more explicit / performing code analysis and checks on
Django projects. Intellisense based on type annotations can also
contribute to faster and less error-prone coding experience.

Typesheds will be a pain to maintain across versions. Based on my
experience with typescript typings, the most immaculate situation is
shipping typings within the project, even though shipping external typings
is mature in that case. Nevertheless, inline typings can help Django
project development as well.

Adding to the docs any future plans regarding this, would be helpful for
prospective developers.

--
Ticket URL: <https://code.djangoproject.com/ticket/29299>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 7, 2018, 10:46:19 AM4/7/18
to django-...@googlegroups.com
#29299: Inline/Out of the box Type hints(PEP 484) and Variable annotations(PEP 526)
-------------------------------------+-------------------------------------

Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Andreas Galazis:

Old description:

> Adhering to [https://www.python.org/dev/peps/pep-0484/ Type hints(PEP
> 484)] / [https://www.python.org/dev/peps/pep-0526/ type annotations]
> could contribute to being more explicit / performing code analysis and
> checks on Django projects. Intellisense based on type annotations can
> also contribute to faster and less error-prone coding experience.
>
> Typesheds will be a pain to maintain across versions. Based on my
> experience with typescript typings, the most immaculate situation is
> shipping typings within the project, even though shipping external
> typings is mature in that case. Nevertheless, inline typings can help
> Django project development as well.
>
> Adding to the docs any future plans regarding this, would be helpful for
> prospective developers.

New description:

Adhering to [https://www.python.org/dev/peps/pep-0484/ Type hints(PEP
484)] / [https://www.python.org/dev/peps/pep-0526/ type annotations] could
contribute to being more explicit / performing code analysis and checks on
Django projects. Intellisense based on type annotations can also
contribute to faster and less error-prone coding experience.

Typesheds will be a pain to maintain across versions. Based on my
experience with typescript typings, the most immaculate situation is
shipping typings within the project, even though shipping external typings
is mature in that case. Nevertheless, inline typings can help Django
project development as well.

Adding to the docs any future plans regarding this would be helpful to
prospective developers.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:1>

Django

unread,
Apr 7, 2018, 1:31:18 PM4/7/18
to django-...@googlegroups.com
#29299: Add typing hinting (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------

Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0

Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* component: Uncategorized => Core (Other)
* stage: Unreviewed => Someday/Maybe


Comment:

This is [https://groups.google.com/d/topic/django-
developers/trTEbURFhEY/discussion discussed on django-developers] but a
consensus on how to proceed hasn't emerged.

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:2>

Django

unread,
Apr 7, 2018, 6:59:31 PM4/7/18
to django-...@googlegroups.com
#29299: Add typing hinting (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* cc: Adam (Chainz) Johnson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:3>

Django

unread,
Apr 7, 2018, 11:56:58 PM4/7/18
to django-...@googlegroups.com
#29299: Add typing hinting (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Zach Borboa):

* cc: Zach Borboa (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:4>

Django

unread,
Apr 8, 2018, 2:21:00 AM4/8/18
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------

Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:5>

Django

unread,
May 14, 2018, 7:19:52 AM5/14/18
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vlastimil Zíma):

* cc: Vlastimil Zíma (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:6>

Django

unread,
May 20, 2018, 1:00:48 PM5/20/18
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Brylie Christopher Oxley):

I am available to help with this issue. Is there a checklist of files or
areas, so that I can take a few to start?

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:7>

Django

unread,
May 21, 2018, 12:57:54 PM5/21/18
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

See comment 2 and post on the mailing list if you want to try to get a
consensus on a way forward.

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:8>

Django

unread,
Feb 11, 2019, 1:37:41 AM2/11/19
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Sergey Kolomenkin):

Are there any updates on this ticket?

Does Django has some roadmap for adding type hints support to Django?

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:9>

Django

unread,
Feb 11, 2019, 8:05:57 AM2/11/19
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

No updates. The discussion is on the mailing list linked in comment 2.

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:10>

Django

unread,
Oct 30, 2019, 9:20:43 AM10/30/19
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Yngve Høiseth):

Note the existence of [https://github.com/typeddjango/django-stubs django-
stubs].

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:11>

Django

unread,
Aug 7, 2021, 1:58:06 PM8/7/21
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Andreas Galazis):

Adding them in the framework would make changes to the framework more
smooth since typings would be updated within the codebase and there will
be no need for a new stub release (or waiting for the stub release).
I understand that it might involve a bit of donkey work to merge the stubs
in the framework.
If we find a tool to merge it automatically, would it be acceptable?
As a side note I stumbled on this:
https://pythonrepo.com/repo/ambv-retype-python-code-refactoring

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:12>

Django

unread,
Nov 4, 2021, 12:06:52 AM11/4/21
to django-...@googlegroups.com
#29299: Add type hints (PEP 484) and variable annotations (PEP 526)
-------------------------------------+-------------------------------------
Reporter: Andreas Galazis | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Thiago Bellini Ribeiro):

Just to add here too, this project here is a fork of the original `django-
stubs` but without the mypy dependency and that works fine with pyright.
It has some interesting stuff in it, like defined a field with
`null=True`/`null=False` automatically types it as being able to get/set
None together with the field's primary type.

--
Ticket URL: <https://code.djangoproject.com/ticket/29299#comment:13>

Reply all
Reply to author
Forward
0 new messages