Python 3 Generator/Reverse support

Hey,

I’m interested in introducing the software to my company’s workflow, but the very outdated support for Python 3 (including reversing from type hints) is a deal breaker to me. I’ve seen an old question about it - Python 3.x does not exist in the list - what’s the progress?

Best,
Prem

1 Like

Visual Paradigm in my opinion is a great product, but its Python reversing gives me headaches. I frequently have gotten (presumed) syntax errors or even internal parsing errors. I entered several tickets on Python reversing in the past. Often the problem would be fixed quickly, but sometimes not, or other bugs would be introduced while fixing the initial one.

When I ran into reversing errors again the last days, I created a small helper script, now at https://hg.sr.ht/~sschwarzer/python_skeleton . Tickets can be entered at https://todo.sr.ht/~sschwarzer/python_skeleton . This script – at least at the moment – won’t give you the types from the type hints, but at least it should get the code (the stub code generated by the script) reversed.

Dear Visual Paradigm team, I have the following suggestions:

  • Please support reversing for Python 2 and 3 as two separate options. Don’t try to combine Python 2 and 3 in a common “Python code”.

  • Use the official grammars from the Python project or existing Python parsers for Java. Don’t fix individual reversing bugs case by case.

  • For testing, try to reverse the standard library for each Python version. If this succeeds without errors, I think it’s very likely that almost all source code in the wild will be parsed correctly as well. If you want your code to be even more robust, include the unit tests for the respective Python versions in your reversing tests.

  • Although Python 2 support from the CPython team officially ends on 2020-01-01, this doesn’t mean you shouldn’t invest time in Python 2 reversing support. Many projects have delayed their migration to Python 3, and when they’ll tackle it eventually, they’ll be very thankful if they can reverse their legacy Python 2 code to get an overview for the Python 3 migration.

Best regards,
Stefan

1 Like

I also had to abandon Visual Paradigm because of its lack of support for Python type hints, too.

A little more info if VP ever wants to do better…

  • Documentation of the syntax of Python type hints is at https://www.python.org/dev/peps/pep-0484/
  • In particular, I had trouble with annotating the return type of a method; the log shows "invalid syntax’

Here is a minimal snippet of code to produce the error:

class Foo:
    def bar(self) -> bool:
        return True

Hi, I would like to let you know the Python reverse engineering problem has been fixed and please update the software to latest patch build (20200230cf or later) to get the problem fixed. Details about update to latest patch can be found at

  • Please make sure you have pressed the “Update to latest patch” button on the left hand side of the dialog right after launching the update program

Feel free to contact me if you require any further information.

I am no longer getting that problem; great! Thank you; it was remarkably quick work.

(Unfortunately, I’m getting other errors which don’t seem related to this topic, so I’ll contact separately about that.)