Currently, the biggest problem for the type checker is that Cython is not 
emitting any type annotations, so pratically all cython classes are `any` 
(which is probably also the reason why the Integer return value is not 
flagged). For now, one would need to generate the `pyi` stub files (using 
some tool) and put them in version control, see 
https://github.com/cython/cython/pull/3818. Oscar, how is that currently 
solved in sympy? Other then that, the typing annotations in sage are at the 
very beginning: relative to 
https://microsoft.github.io/pyright/#/getting-started, we are now at step 
2. I tried to add many typings in the manifold package, but even that 
effort is not yet completed (and is made harder by the fact that everything 
else is untyped).

Of course, help in improving the situation is more than welcome!

On Thursday, September 7, 2023 at 6:21:25 AM UTC+8 John H Palmieri wrote:

> I tried using mypy, and I also just ran "sage --tox -e pyright", and 
> neither seems to flag the conflict between the signature "def 
> signature(self) -> Integer:" and the output, which is some arithmetic with 
> "len(...)" and hence a Python int. (And both mypy and pyright produce a ton 
> of warnings, so if either is managing to flag anything worth fixing, it's 
> likely to get drowned out. Or maybe I'm using them wrong...)
>
> On Wednesday, September 6, 2023 at 1:45:10 PM UTC-7 Matthias Koeppe wrote:
>
>> On Wednesday, September 6, 2023 at 11:02:15 AM UTC-7 Dima Pasechnik wrote:
>>
>> Should we run mypy on all the *.py files, at least, in our CI?
>>
>>
>> We already have "sage --tox -e pyright", which is considered a better 
>> choice than mypy.
>>
>> We are also running it in the GitHub CI as part of the Build & Test 
>> workflow.
>>
>> See https://doc.sagemath.org/html/en/developer/tools.html#pyright
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/7a35b3e3-93cc-4e2f-88d5-dbced1046d45n%40googlegroups.com.

Reply via email to