Issues #2049 <https://github.com/leo-editor/leo-editor/issues/2049>and #2103 
<https://github.com/leo-editor/leo-editor/issues/2103> concern mypy and 
static type checking. I worked yesterday on these issues in the ekr-2103 
branch.  This Engineering Notebook post "thinks out loud" re these issues. 
Feel free to ignore.

*Significance*

The improved mypy command shows errors as clickable links in Leo's log 
pane. That part of the work is complete. Otherwise, completing these issues 
is of little importance to Leo.

Still, I am eager to complete these issues. At that point, Leo 6.4 will be 
almost complete!

I am near the end of my interest and involvement in static type checking. 
Imo, static type checking adds little to python. If you want proper type 
checking, try rust or other typed languages.

Experience shows that mypy complaints are generally less useful than pylint 
complaints.* Altering code to fix mypy complaints is always risky.*


*Completing these issues*

Yesterday's work showed that some strategy is required to do what I want *and 
no more*. Here is the general plan:

*Step 1*: Create a *new *branch, say ekr-mypy2, to work on the mypy command 
itself. The main question is what to do about mypy arguments. At present, 
the mypy command supports the `@data mypy-arguments` and the `@int 
mypy-link-limit` settings. However, it will probably be better always to 
use the .mypy.ini file. We shall see.

*Step 2*: I'll merge ekr-mypy2 into devel, then create another new branch, 
say ekr-stubs, to work on annotating leoGlobals.py. Much of this work is 
complete, but I was pretty hasty yesterday, so I may want to redo some work 
as a precaution against bugs.   *leoGlobals.pyi* might be the only 
"deliverable" of this branch. We shall see.

*Step 3*: mypy does seem to have found problems with the following methods: 
execute_single_pytest,  writeZipFile, and (maybe)  indentToCommentColumn. 
But it would be unbearable to introduce new bugs while trying to placate 
mypy! I'll investigate these problems and create separate issues (and PR's) 
as needed for each.

*Summary*

This work will mark the end of my interest and involvement with mypy and 
static type checking for Leo.

Impatience is the clear enemy here. The work is mundane, but I must not 
introduce any new bugs!

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/15abec04-3b60-4ba2-b089-c2c1b7676bb6n%40googlegroups.com.

Reply via email to