-
Notifications
You must be signed in to change notification settings - Fork 33
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
extract methods #11
Comments
Hi @mskoenz, Thank you for your interest, I am glad if this library is of any help to you. Unfortunately you are right: py2puml does not extract the methods of the parsed classes yet. I initially wrote it to document a folder of tangled dataclasses representing the domain model of an application that I started to work for. I needed to see composition relationships between the dataclasses. But it makes totally sense to improve the library so that it exports methods too. Would you like to contribute? |
I'd like to give this a try. will create a pull request. @lucsorel: any ideas you already have about this? |
Some basic goal would be to cover this point in the plantuml docs https://plantuml.com/class-diagram#090967fbee930909 |
how should it look? @startuml
class Example {
some_attr : int
some_method(some_param: int = 1) -> date
}
@enduml |
Singature could be done as the first example here https://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object
|
hi @jonykalavera A couple answers and thoughts:
|
No problem. I assume you do this in your free time. :)
yeah, I think it is ok because, when no explicit
AFAIK there are no hard rules about the typing order; at least according to the docs: https://plantuml.com/class-diagram#090967fbee930909
I'm with you. In short: let's not use void, I like staying pythonic. let's leave type empty if not hinted, and show it if it is.
I agree. but maybe I am biased. in any case, I think we should leave it out of the scope of this PR.
I agree. it should not be too hard to do. similar to how we dealt with abstract classes. also, I noticed that the signature shows the
I totally agree. we should provide customization options. especially if the pr about functions gets merged. I want that one but i can imagine some might not. for now, if we want to keep the expected behavior, we can add one option to the command default false. Will wait for your comments to proceed |
sorry for the delay, the house is covid19 positive here. It seems to me that the PR lacks some unit tests (for the generation of the UML signature). And could you have a look at what needs to be done in the Contributions and version update section, please, when you have time? |
Hi @lucsorel , I'd like to help here and write some unit tests. Do you know how to proceed when the implementation already exists in @jonykalavera 's forked repository? |
hi @grayfox88, thank you for popping in and proposing your help 😃 The work started in PR #30 and what remains to do is listed in this comment: #30 (comment). The add-methods branch needs rebasing and merging, I modified some core functionalities (homogenized the way type annotations are processed, particularly). There was also the issue that using inspection (stuffs like I suspect that this feature should document only the methods declared in the class from the methods inherited from parent classes. Thus, I wonder whether we should keep this inspection approach or switch to an analysis of the abstract syntax tree 🤷 Adding unit tests that would check the output of py2puml on these cases (extending a dictionary, extending a custom parent class with user-defined methods, a class with user-defined dunder methods, etc.) would help understanding what we want (or accept) as PlantUML outputs. Do you feel like adding them without touching what @jonykalavera did? |
New PR created #43 |
Hi @lucsorel @grayfox88 , |
hi all 😃 PR #51 needs to be reviewed and merged first because it also introduces github actions in the project, including formatting and linting hooks. I would like to enforce an homogeneity of code style in this project as feature requests and contributions are coming. Feel free to review it to accelerate the process 🙏 Then, I will rebase and contribute on this PR. |
Alright, @lucsorel! I've reviewed the entire PR (took a bit...) and left a handful of comments. |
First: awesome package, thx a lot ^^
Second: am I not finding the option, or is is currently not possible to extract the methods of classes?
Best regards
mskoenz
The text was updated successfully, but these errors were encountered: