You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first step here is to make a simple script that uses this visitor to apply stubs. Later, the ApplyTypeAnnotationsVisitor will be subclassed with some custom code, if we'd need any special casing.
We need to start using actual Django sources to test stubs. For that, we have to merge our
.pyi
files inside the.py
files of Django.There's a library called LibCST https://github.com/Instagram/LibCST, which allows traversing and modifying Python source code. It's new, Python 3 only, covered with type annotations and well-maintained by Instagram. I think we should use it as a base for our merging tool, instead of
https://github.com/ambv/retype
https://github.com/google/pytype/tree/master/pytype/tools/merge_pyi
which are both lib2to3 based.
I used it in the #288 to make an example script to add stubs versioning.
It even has some built-in support for this particular task via https://libcst.readthedocs.io/en/latest/codemods.html#libcst.codemod.visitors.ApplyTypeAnnotationsVisitor
The first step here is to make a simple script that uses this visitor to apply stubs. Later, the
ApplyTypeAnnotationsVisitor
will be subclassed with some custom code, if we'd need any special casing.@kszmigiel Could you take a look at it? Maybe make a script which will merge https://github.com/typeddjango/django-stubs/blob/master/django-stubs/shortcuts.pyi into the Django source, and then run mypy on top of it?
I think you should work on it before you make more changes to the stubs.
The text was updated successfully, but these errors were encountered: