-
Notifications
You must be signed in to change notification settings - Fork 988
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
Improve conan inspect
output, it now understands set_name
/set_version
#13716
Conversation
…efault_options and options_description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple of open issues about serialization to discuss.
conan/cli/commands/inspect.py
Outdated
from conan.cli.formatters import default_json_formatter | ||
|
||
|
||
def inspect_text_formatter(data): | ||
for name, value in data.items(): | ||
for name, value in sorted(data.items(), key=lambda x: x[0]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this lambda? Not very intuitive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While playing with the output I realized it would be insertion-order dependant and implemented a sort on the items to have them show up alphabetically. Maybe we want to have a custom order and just have to be carefurl about when we insert the result in the serialization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure. sorted(mydict.items())
already sorts by the first element (key), no need for the lambda
conan inspect
conan inspect
output, it now understands set_name
/set_version
if self.version is not None: | ||
result["version"] = str(self.version) | ||
if self.topics is not None: | ||
result["topics"] = list(self.topics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not happy about this, but some tests were failing when calling graph create
for json formatter (test/integration/command/create_test.py:475
). I do wonder why now and not with the old changes the also has the topics returned
conans/model/conan_file.py
Outdated
for a in ("name", "user", "channel", "url", "license", | ||
"author", "description", "homepage", "build_policy", "upload_policy", | ||
"revision_mode", "provides", "deprecated", "win_bash", "win_bash_run", | ||
"default_options", "options_description", "generators", "requires"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serialization of the requires
field is a bit uncertain how is being serialized, as it is a Python Requirements
object?
Changelog: Feature: Improve
conan inspect
output, it now understandsset_name
/set_version
.Docs: conan-io/docs#3204
conan inspect
now parses the conanfile and returns its serializationClose #13628