-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes most mypy errors and run it on CI #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with the comments above, could you give this PR a run of pre-commit
after these changes. (Specifically black
recommended some changes)
Hi @kc611, thanks for the review. Do you have any other comments or request in this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this PR LGTM!
Thank you |
@guilhermeleobas I gave this another review and noticed that I can't run
What else do I need for this to pass? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed this and it seems, beyond the annotations there has been some functional changes. Specifically, the following example, which works on main
at 93ad199 will raise an exception while trying to render:
from numba_rvsdg.rendering.rendering import render_func
def foo(x):
c = 0
for i in range(x):
c += i
if c <= 0:
continue
else:
for j in range(c):
c += j
if c > 100:
break
return c
render_func(foo)
And the exception is:
Traceback (most recent call last):
File "/Users/esc/git/numba-rvsdg/example2.py", line 16, in <module>
render_func(foo)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 332, in render_func
render_flow(ByteFlow.from_bytecode(func))
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 368, in render_flow
ByteFlowRenderer().render_byteflow(bflow).view("branch restructured")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 200, in render_byteflow
self.render_block(self.g, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 75, in render_block
self.render_region_block(digraph, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 154, in render_region_block
self.render_block(subg, name, block)
File "/Users/esc/git/numba-rvsdg/numba_rvsdg/rendering/rendering.py", line 77, in render_block
raise Exception("unreachable")
Exception: unreachable
@@ -1,3 +1,5 @@ | |||
# mypy: ignore-errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests here seem to be annotated, can we include this file too?
Not much we can do here, as graphviz doesn't follow PEP-561: It doesn't ship with a |
OK. Do you know why running it with |
Is this PR waiting on anything? If not, can we go ahead with merging it? |
Not that I am aware of |
Perhaps it is related to pypa/pip#9502 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The skipping of graphviz
checking by mypy
can be made into an separate issue for now. There doesn't seem to be a clear reason as to why it is happening and is anyways beyond the scope of the changes being implemented in this PR.
OK! |
@guilhermeleobas thank you for the patch. @kc611 thank you for the review. |
This PR fixes most mypy errors and enable it on CI.