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

TemplateEngine improvements, updated template.md #155

Merged
merged 10 commits into from
Oct 31, 2021
Merged

Conversation

nozmore
Copy link
Collaborator

@nozmore nozmore commented Apr 8, 2021

I updated the template to showcase #150 and #154. Also expanded template_engine to support the call operator with methods that return a list and support to call methods within a report utility class. Updated template.md with examples of each.

Updated tests and ensured tests passed. Also updated report test to write output_current.md At some point tests could use this but for now can be used to quickly commit the new expected value when the report changes. Added output_current.mdto.gitignore`

I also added an example in the template.md to get the parents of each Boundary, to see this I updated tm.py with a hierarchy of Boundaries. If we think this is too much for the intro tm.py I can back those changes out.

@nozmore nozmore requested a review from izar as a code owner April 8, 2021 14:20
@nozmore
Copy link
Collaborator Author

nozmore commented Apr 8, 2021

oh also added entries in the Data table for carriedBy and processedBy.

@ghost
Copy link

ghost commented Apr 8, 2021

Congratulations 🎉. DeepCode analyzed your code in 2.765 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

Copy link
Collaborator

@nineinchnick nineinchnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced we need such a complicated template as an example. I believe it would confuse new users. We should send a clear message that the templating engine in pytm is very simple by design, and if it's not enough, users should override it and use a different one.

docs/template.md Outdated Show resolved Hide resolved
docs/template.md Outdated Show resolved Hide resolved
docs/template.md Outdated Show resolved Hide resolved
pytm/report_util.py Show resolved Hide resolved
tests/output.md Outdated Show resolved Hide resolved
docs/template.md Outdated Show resolved Hide resolved
docs/template.md Outdated Show resolved Hide resolved
docs/template.md Outdated Show resolved Hide resolved
…sed review comments and deep code suggestion
@nineinchnick
Copy link
Collaborator

@nozmore @izar WDYT about keeping two template examples? One simple, one more advanced?

@nozmore
Copy link
Collaborator Author

nozmore commented Apr 10, 2021

lol I put that in my reply to an earlier comment before reading this. Yes, I think we are viewing this report differently I would prefer to have a fairly complete report and then in docs have a simple version to go along with the simple.tm

@nozmore
Copy link
Collaborator Author

nozmore commented Apr 10, 2021

Why did my tests fail here? Is this executing against the test files in master or in the branch, locally everything passes and I didn't touch DFD logic.

@izar izar added this to the v1.1.3 milestone Apr 12, 2021
@izar izar modified the milestones: v1.1.3, v1.1.4 Apr 30, 2021
@nozmore
Copy link
Collaborator Author

nozmore commented Sep 28, 2021

Sorry I disappeared, life got in the way. I fixed some issues and cleaned up the reports, merged in master. I think this is ready to be merged, well at least reviewed : )

@raphaelahrens
Copy link
Contributor

Hi,

first I like the change and I wanted to add my thoughts.
Might it be a better idea to have extra repos for reports?
Since a fancy report does not have to be part of the software.
In addition one could also add build instruction and files in the repos which would be solely for the report.
For example I wanted to checkout if I could make a pdf report and if I find the time I thought about pushing it to a separate repo, which could then be linked to.
Also the users could fork repot to adjust it to their needs (people love company logos and names).

This does not really affect this PR but maybe future PRs which want to change the report template.

@izar
Copy link
Collaborator

izar commented Sep 29, 2021

I like the idea of more complex reports but I think they should go into a directory, not a separate repo, lest the two repos get out of sync version-wise.

@nineinchnick
Copy link
Collaborator

I'm still not convinced it's the right thing to do to extend this basic template engine. It's already non-trivial to write advanced templates in it. I vote for replacing it with jinja2.

@nozmore
Copy link
Collaborator Author

nozmore commented Oct 6, 2021

I'm still not convinced it's the right thing to do to extend this basic template engine. It's already non-trivial to write advanced templates in it. I vote for replacing it with jinja2.

If it wasn't already done I'd agree. Its done, functional, adds minimal changes to the engine, and moves pytm forward. Replacing with another library can still be done later or use something to render the JSON output.

This is my only open source project, how to tie breakers work?

@nineinchnick
Copy link
Collaborator

I'm still not convinced it's the right thing to do to extend this basic template engine. It's already non-trivial to write advanced templates in it. I vote for replacing it with jinja2.

If it wasn't already done I'd agree. Its done, functional, adds minimal changes to the engine, and moves pytm forward. Replacing with another library can still be done later or use something to render the JSON output.

This is my only open source project, how to tie breakers work?

I don't agree that changes proposed here are minimal.
@izar has they final word here. I can disagree and commit.

@izar
Copy link
Collaborator

izar commented Oct 11, 2021 via email

@nozmore
Copy link
Collaborator Author

nozmore commented Oct 13, 2021

Sounds good to me. I don't have plans to add any additional logic to the templating system. That said I do see additions to either the various internal classes or the report_util class when data needs to be formatted in a way for reporting.

For example the PR about custom properties using a dict, I have a method drafted locally that I will push to report_util once the template changes are merged that will enable looping over the dict and prevent KeyError exceptions when the key does not exist in the dict.

@ghost
Copy link

ghost commented Oct 30, 2021

CodeSee Review Map:

Review these changes using an interactive CodeSee Map

Review in an interactive map

View more CodeSee Maps

Legend

CodeSee Map Legend

@izar izar merged commit f13629c into master Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants