Skip to content
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

Class/Method level comments in metadata? #120

Open
atanikan opened this issue May 17, 2018 · 3 comments
Open

Class/Method level comments in metadata? #120

atanikan opened this issue May 17, 2018 · 3 comments

Comments

@atanikan
Copy link

Hello Developers,

As an enhancement request, I was wondering if it's possible for the metadata to log the class/method level comments within the python file? Class level comments can describe what the class does and the properties of the input arguments. I am trying to build a parser which can parse the log file and construct some sort of workflow with important descriptions as well.

@JoaoFelipe
Copy link
Contributor

Hi @atanikan, thank you for the suggestion.

I'm a bit confused by what you mean by comments, though. In Python, it is advisable to use docstrings to describe what the class does instead of code comments. So, do you really want the code comments or just the docstrings would be enough? noWorkflow currently logs docstrings.

However, the current version of noWorkflow does not properly support classes. We are working on a new version that might suit you better. See the branch 2.0-alpha. Note that this version is in active development and may not support all python scripts. Additionally, it has a different data model. In this version, the docstring is an attribute of CodeBlock, which is a CodeComponent that represents a Script, a Class Definition, or a Function Definition.

CodeComponents have precise line and column attributes. You may use them to relate comment positions (extracted by another script - as we do not collect comments) to their respective classes and methods.

Please, let me know if you have any questions or if you find any bug in the branch 2.0-alpha

@atanikan
Copy link
Author

Hello Joao,

My apologies, yes I did mean docstrings. All comments wouldn't be necessary.

So if I understand you correctly in 2.0-alpha. , I can parse the log file (assuming there are multiple class files imported/called from a main.py file) and can extract the start of the flow of execution (with doc strings, file names and arguments) up to the output (with docstrings & file names)?

@JoaoFelipe
Copy link
Contributor

That's right!
However, we didn't expand the collection beyond the main file yet. It is probably just a matter of calling the collect method in the import machinery, but it will require some filtering, and I'm a bit busy at this moment to try it. Feel free to try and submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants