PySequenceReverseThis extension for VS Code enables you to create UML-compliant Mermaid sequence diagrams from Python code to perform reverse engineering and to gain more knowledge about a piece of code. What's NewVersion 1.1.0:
Legal StuffMIT license applies, so it's all free and open. Donation options available in the repo to support further development. CreditsThis work is loosely based on VS Code Chartographer, the call graph creating extension from Richard Putra. Thanks for the valuable advices of arpicheck. Features
How to Use?
If automated saving and automatically opening diagrams are both enabled, you'll be presented with the diagram once the operation completes. If auto-save is not enabled, first you'll need to save the diagram. Configuration SettingsIn VS Code, click File > Preferences > Settings, select User or Workspace, expand Extensions and select PySequenceReverse to view and edit settings. ScopingSet the scope of what you would like to see on the sequence diagrams. Ignore: Ignore on GenerateList file patterns. Files matching these patterns won't be analyzed. If a call targets an item in such a file, it won't be added to the diagram. Use this to ignore calls that are not of much value or only distract the reader. Logging methods may be a typical example. Ignore: Ignore Non-Workspace FilesLimit code analysis to the current VS Code workspace. Calls targeting anything out of it won't be added to the diagrams. You can use this to not analyze third-party packages. Ignore: Ignore Analyzing Third-Party PackagesWith this self-explanatory setting. This includes folders named Proceeding with FilesSettings to control what to do once a diagram is created. Files: Save Diagram File AutomaticallyWhen checked, each diagram you create will be saved automatically to the workspace's root folder, with the file name composed of the name of the function, its containing class or module and workspace-relative path. When not checked, you'll be presented with a dialog to select a location and specify a name for the file. Files: Open Diagram AutomaticallyWhen checked, the diagram saved automatically or manually will be displayed in VS Code after successful save if Mermaid Editor is installed. DiagramSettings related to the sequence diagrams, their contents and formatting. Maximum call depth (1 to 32)Only up this level of nesting will calls be detailed to let you control the amount of information and level of complexity you tolerate on a diagram. When limited depth is reached and there are further function calls to deeper levels, instead of gathering them, a note will let you know next to the relevant method that further details are cut. This way you'll know where to go for further details if you need any. Diagram: Omit Message DetailsWhen checked, messages won't show details (like arguments passed or function signature), only the message name.¸ Diagram: Omit Sequence NumbersWhen checked, no sequence numbers will be shown in front of messages. Diagram: Show Signatures Instead ParametersWhen checked, and message details are not omitted, the signatures of the called functions will be shown for messages instead of the parameters passed to the function. If unchecked, you'll find the parameters there. Observed only when message details are not omitted. Diagram: Return Message LabelThe label to show on return messages. The default is return value. If you specify an empty value, a space will be used to comply with Mermaid syntax. RequirementsPySequenceReverse relies on the "call hierarchy" feature of an LSP server. So, to use PySequenceReverse for your project analysis, you must have a language server extension that supports "call hierarchy." Mermaid Editor from tomoyukim is required to view Mermaid diagrams. For more informationSupport, bug reports, feature requests and other stuff in the GitHub repo. |