kinparse icon indicating copy to clipboard operation
kinparse copied to clipboard

Supporting MyPy static analizer

Open HamzaHajeir opened this issue 4 years ago • 2 comments

Hi

I'm new to Python really, but as a C++ programmer, I really weight the static typing.

I heard of MyPy as type checking tool, so I've used it in my simple kinparse-based script.

Before diving into the errors log, I'd really thank you for this great library, if there's a suggestion is to support parts pins (if possible) nlst.parts[0].pins.

Returning to the error log:

LibManager.py:1: error: Skipping analyzing "kinparse": found module but no type hints or library stubs
LibManager.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
LibManager.py:12: error: "list" expects 1 type argument, but 2 given <<< Dismiss this >>>
LibManager.py:69: error: "List[Any]" has no attribute "name"
LibManager.py:87: error: "List[Any]" has no attribute "ref"
LibManager.py:93: error: "List[Any]" has no attribute "name"

Is there a way to help mypy doing it?

Thanks

HamzaHajeir avatar Sep 30 '21 17:09 HamzaHajeir

I've never used MyPy so I'm not sure what issue it's having other than the fact my code isn't annotated for type checking. kinparse is mostly a syntax table that gets passed to the pyparsing package along with the netlist as a text string. Maybe you could do some minimal type annotation to see if you can get past the errors.

devbisme avatar Oct 01 '21 14:10 devbisme

So I think it's in pyparsing's field, not directly to kinparse. Am I correct?

HamzaHajeir avatar Oct 01 '21 14:10 HamzaHajeir