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
Graphviz output for 2to3 fixer patterns #53830
Comments
As part of my GSoC project working on 2to3, I've created a script which will allow compiled fixer patterns to be visualized using graphviz. This would be useful for debugging and understanding exactly how patterns are matched. I've written using the 2to3 sandbox as my base. The script is named pat2dot and is found in the scripts directory. The script currently relies on an external graphviz library (I provided bindings for the GvGen library with this patch), they are separated enough from the rest of the code that it would be trivial to create a class that would work using a different graphviz library. Additionally, since the code is never called within 2to3 proper, this dependency will only appear if you wish to use pat2dot, and will not affect any other usages of lib2to3. Usage of the script is |
Can you port your diff to 3.2? It’s where new features land. I think the implicit relative import (“import gvgraph” with the Tools/scripts dir is not on sys.path) won’t work. |
Matt, Can you post a sample graph in a common image format, say PNG? I am curious to see it, but not curious enough to install graphviz. |
Éric, When I was working with 2to3 this summer I was running it via python3, so I think the patch should work - however, if I've submitted it to the wrong place or the wrong branch, where should I be looking at to ensure my code does work on 3.2 and is submitted to the right place? In regard to the import gvgraph, I wasn't sure what to do with it - for my distribution gvgraph wasn't available as a package, and it was only one file so I just dumped it in the same directory as the script. I'm open to suggestions as to how that import should be handled better. Alexander - I'll attach a sample image as soon as I get back to my development machine, which should be later this week. |
As requested, attached is the output for the fix_buffer fixer, as an example of the kind of output this patch can produce. |
(Cheers from a fellow GSoCer, by the way :) |
Huh. I must have diffed the wrong version of my code - how embarrassing! I'll update the attached patch later this week. Thanks for catching that. |
Hey Matt, can you give us a status update? |
Sorry for the delay in responding, and for getting this patch cleaned up and submitted. While I was going through my code to submit it, I found a couple of additional issues with it. Then I ended up becoming very busy with my grad courses. As a result, I haven't had a chance to do anything with it. Currently, my plan is to rework it over the winter break to fix the issues, make it work correctly with python 3, and remove the dependence on the external graphviz package (which should resolve the import issue as well). |
Matt, do you just want to drop the issue or provide a new patch? Your code might well still be useful, but it's been 6 years, so you may not even have the code any longer. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: