Re: PEP 484 type hinting in Django

2018-04-11 Thread Andreas Galazis
To me one approach would be to put a cut off for any merged code /PR  start 
inlining type hints/annotations for all new code. This seems to simple to 
be a solution but at the end of the day as code gets updated even 
bigger part of the codebase will have type hints. The question is whether 
partial type-hinting is actually useful, but at least it supports heading 
towards the right direction.

On Tuesday, 10 April 2018 15:24:19 UTC+3, dmoisset wrote:
>
> A long due update on this, given that the question popped up recently:
>
> I worked at some time in type annotations and published some for Django 
> 1.10 ; I'm currently not working on them, given that my current work has 
> not been very close to Django development
>
> After trying a few things, the best way to get this would be:
> 1) Add annotations upstream. Having to maintain a separate set of 
> annotations is probably not sustainable and will lead to errors. This of 
> course needs annotations accepted by the team.
> 1.1) Integrate typechecking into Django's build/CI process. This would 
> ensure that annotations are consistent with the implementation.
> 1.2) Annotations do not need to be exhaustive (and there are certainly 
> parts of Django which could benefit from them much more than others)
> 2) Generate stubs from the annotated source. This was not possible when I 
> wrote my stubs, but I've commited the mypy improvements with that feature. 
> 2.1)A few stubs may need to be overridden manually from the autogenerated 
> (I found a few examples of this when I wrote my stubs)
> 3) Distribute annotated files separately (not with typeshed, and probably 
> not with django) so people can install the version they need. Distribution 
> of stubs has been problematic, PEP 561 should solve it but an 
> implementation for it has been just merged last week into mypy, and 
> probably released soon.
>
> Before PEP561 and the ability to generate stubs, I don't believe it was 
> practical to make this project sustainable. At this time, it might be and 
> it can be a good time to restart this discussion.
>
> Best,
> D
>
> On 6 April 2018 at 12:19, Florian Apolloner  > wrote:
>
>> To the best of my knowledge JetBrains fundled the money to Django for 
>> that specific purpose -- so yes the funding should be here if needed. That 
>> said, there is no decission on a) whether we actually want type hints and 
>> b) if the should be inline or stubs. Those two points have to be cleared 
>> first.
>>
>> Cheers,
>> Florian
>>
>> On Friday, April 6, 2018 at 9:11:04 AM UTC+2, Eddy C wrote:
>>>
>>> Hi Tim, do you know if JetBrains still willing to fund the project as 
>>> the upcoming django 2.1 will only support python 3.5+ that pave the way for 
>>> inline annotations.
>>>
>>> On Wednesday, August 17, 2016 at 11:41:03 PM UTC+10, Tim Graham wrote:

 The JetBrains announcement that they want to fund the project isn't a 
 guarantee that it'll be implemented. The feature needs to go through the 
 normal feature acceptance process, which as Markus said, might involve a 
 DEP.

 Assuming the idea is accepted, my sense on timing would be to wait 
 until January when Django drops support for Python 2.7 and 3.4 in master. 
 Then we could use inline annotations rather than the stub files.

 Past discussions of type hinting:

 https://groups.google.com/d/topic/django-developers/z_P1TvJ6QG8/discussion

 https://groups.google.com/d/topic/django-developers/xOTmq93YZuQ/discussion

 On Wednesday, August 17, 2016 at 5:30:56 AM UTC-4, Florian Apolloner 
 wrote:
>
>
>
> On Wednesday, August 17, 2016 at 11:06:47 AM UTC+2, dmoisset wrote:
>>
>> @Florian
>> Would you care to ellaborate? I couldn't find the post you mention 
>> (although requests is one of the few 3rd party projects that have 
>> support 
>> at the official typeshed repository, 
>> https://github.com/python/typeshed )
>>
>
> https://lwn.net/Articles/643269/ and https://lwn.net/Articles/643399/ 
> -- might be that things changed by now.
>
 -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com .
>> To post to this group, send email to django-d...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/6f2b5dd9-f8e6-4b67-8e25-585cbd802413%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Daniel F. Moisset - UK Country Manager - Machinali

Re: PEP 484 type hinting in Django

2018-04-11 Thread Andreas Galazis
I agree with you, but at some point, we could combine solid annotated core 
with a cut off for non annotated code? Otherwise, this will end up being a 
loop.

On Wednesday, 11 April 2018 17:16:21 UTC+3, dmoisset wrote:
>
>
>
> On 11 April 2018 at 11:21, Andreas Galazis  > wrote:
>
>> To me one approach would be to put a cut off for any merged code /PR  
>> start inlining type hints/annotations for all new code. This seems to 
>> simple to be a solution but at the end of the day as code gets updated even 
>> bigger part of the codebase will have type hints. The question is whether 
>> partial type-hinting is actually useful, but at least it supports heading 
>> towards the right direction.
>>
>>
> I don't think that approach will work. Partial type hinting is useful and 
> viable, but not randomly you need to do it bottom up (covering basic 
> abstractions first). So the place to start is probable the parts of django 
> that change less and are more solid foundations (in my case I started with 
> requests, views and URL resolvers, etc)
>
>
>
> -- 
> Daniel F. Moisset - UK Country Manager - Machinalis Limited
> www.machinalis.co.uk <http://www.machinalis.com>
> Skype: @dmoisset T: + 44 7398 827139
>
> 1 Fore St, London, EC2Y 9DT
>
> Machinalis Limited is a company registered in England and Wales. 
> Registered number: 10574987.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2d2a2ce3-23c7-4616-af48-52d2c1c6c866%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PEP 484 type hinting in Django

2018-12-26 Thread Andreas Galazis
Just stumbled on this blog post: 
https://www.willmcgugan.com/blog/tech/post/adding-type-hints-to-the-django-orm/.
 
An interesting but too theoretical suggestion: We could even get rid of 
field/ field configuration. But I guess that's far ahead of what we are 
trying to achieve xD.

On Wednesday, 12 December 2018 18:06:16 UTC+2, Carlton Gibson wrote:
>
> Hi all. 
>
>
> Where are we with this Type Hinting work? 
>
>
> I just closed https://code.djangoproject.com/ticket/30019 as needsinfo 
> pointing back to this thread. 
>
>
> As far as I can see: 
>
> * There's keenness for this. 
> * There's a number of people who are prepared to put in the effort. 
> * But we just need a strategy. 
>
> It looks then like a coordination problem. Do we just need to get said 
> people in a (virtual) room...? 
>
> Maybe one of you — anyone — opening a DEP to begin the conversation would 
> be enough.. 
> (That's just an idea.) 
>
> Looking here: 
> https://github.com/django/deps/blob/master/final/0001-dep-process.rst#dep-submission-workflow
> I'd guess "Forming the Team" is relevant. 
>
> Happy to help if I can. 
> (I recall Frank mentioned it no too long ago...) 
>
> Kind Regards,
>
> Carlton
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/30039f0c-6cbd-4ef4-954a-d0343b21e46d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.