Type Annotations + mypyc compiling ansible

Hi All,

I saw https://github.com/ansible/ansible/issues/69424 indicated that type annotations was not considered for the ansible code base. I would like to revist this topic and share the added on ability to potentially “compile” ansible using mypyc to get performance and resource usage wins for anisble itself.

I personally run ansible-playbook over my personal infra of 6 VPS’s and home routers and am very surprised at the resources it uses to do so.

Here is some good points on why this could be a good thing to support:

I understand this is a large undertaking, but was just wanting to see peoples point of views here. Thoughts?

Hi, I’ve started adding type stubs for the Ansible codebase, currently its not public

понедельник, 30 мая 2022 г. в 23:30:11 UTC+3, Cooper Lees:

We are working towards type annotations. I would recommend reading over the proposal[1] that we have largely agreed to. But regardless, this isn’t something that will happen overnight, it will likely take years. And we don’t have any intention of just blanket applying it to the whole code base up front. It’ll be slow, and only added as necessary. In some cases, it may require rewriting code, which in some cases could also require deprecation cycles.

[1] https://github.com/ansible/proposals/issues/202

It can be firstly added to typeshed.

пн, 6 июн. 2022 г., 19:56 Matt Martz <matt@sivel.net>:

Awesome news to hear this is happening. I do appreciate the time required here and the need for refactoring to make Python code more type sane.

Cheers,
Cooper