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

Feature/develop2 info package filters #12836

Merged

Conversation

memsharded
Copy link
Member

Changelog: Fix: Make graph info filters to work on json output too
Docs: Omit

Close #12533
There is still some larger work pending in this area, but too much for this PR:

  • Improve the serialization of the graph, serializating better the depenencies (requires)
  • Use the serialized graph instead of the native Conan object as input to .dot and .html graph renderings

@memsharded memsharded added this to the 2.0.0-beta8 milestone Jan 4, 2023
@memsharded memsharded marked this pull request as ready for review January 4, 2023 10:46
@memsharded memsharded requested a review from AbrilRBS January 4, 2023 10:46
Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

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

In the original issue (Or elsewhere) you mentioned that it made little sense to add filtering to outputs meant for further machine processing because you can always filter the resulting json by yourself. I'm guessing that by implementing this, we're walking back on that, right?

serial = graph.serialize()
# TODO: This is not used, it is necessary to update the renderings to use the serialized graph
# instead of the native graph
serial = filter_graph(serial, package_filter, field_filter)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to save the output of the function if it's not used elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is temporary, with the TODO. The idea is that this serial is the thing that should be fed to the rendering templates, and not the graph object.

Copy link
Member

Choose a reason for hiding this comment

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

Ohh now the PR comment makes sense, I didn't quite understand what it was in reference to, ty for the clarification!

@memsharded
Copy link
Member Author

In the original issue (Or elsewhere) you mentioned that it made little sense to add filtering to outputs meant for further machine processing because you can always filter the resulting json by yourself. I'm guessing that by implementing this, we're walking back on that, right?

Yes, we were reconsidering this, and apparently it would match user expectations, if they provide both the json and a filter is because they want it filtered. It also makes sense to be able to trim the output html/dot graph to the packages that you want, so the filter seems also useful for the other formatters. That seems to mean that all the formatters should be consistent with the user input, filtering out whatever the user wants to filter out. Wdyt?

@AbrilRBS
Copy link
Member

AbrilRBS commented Jan 4, 2023

Yes, that's how I would have guessed all formatters behaved had I not seen the issues related to this, so I think that this change is very useful for those cases :)

@@ -99,6 +100,14 @@ def _render_graph(graph, template, template_folder):
def format_graph_html(result):
graph = result["graph"]
conan_api = result["conan_api"]
field_filter = result["field_filter"]
if field_filter and "requires" not in field_filter:
Copy link
Contributor

Choose a reason for hiding this comment

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

should it check for field_filter is not None instead (as empty list may evaluate to False in python)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this, it doesn't really apply

@czoido czoido merged commit 9b34097 into conan-io:develop2 Jan 5, 2023
@memsharded memsharded deleted the feature/develop2_info_package_filters branch January 5, 2023 10:35
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.

4 participants