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

Feat add candidate output #421

Merged
merged 2 commits into from
Apr 29, 2021
Merged

Feat add candidate output #421

merged 2 commits into from
Apr 29, 2021

Conversation

pohlt
Copy link
Contributor

@pohlt pohlt commented Apr 27, 2021

Pull Request Check List

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

I'm currently struggling with installing packages from multiple repos and had the impression that the log output could be improved.
The PR adds some more log output (log level: DETAIL) about matching candidates and their origin. If no matching candidates could be found, the non-matching candidates are printed to give the user some idea what might have gone wrong.

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2021

Codecov Report

Merging #421 (9aed1e0) into master (bb01e47) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

❗ Current head 9aed1e0 differs from pull request most recent head f6592c4. Consider uploading reports for the commit f6592c4 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #421      +/-   ##
==========================================
- Coverage   83.36%   83.17%   -0.19%     
==========================================
  Files          68       68              
  Lines        5289     5302      +13     
  Branches      937      942       +5     
==========================================
+ Hits         4409     4410       +1     
- Misses        609      620      +11     
- Partials      271      272       +1     
Flag Coverage Δ
unittests 83.11% <100.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pdm/models/candidates.py 85.47% <ø> (ø)
pdm/models/repositories.py 71.42% <100.00%> (+2.50%) ⬆️
pdm/models/in_process/__init__.py 72.72% <0.00%> (-12.13%) ⬇️
pdm/models/python.py 88.88% <0.00%> (-6.67%) ⬇️
pdm/models/environment.py 79.65% <0.00%> (-0.87%) ⬇️
pdm/project/core.py 88.85% <0.00%> (-0.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1c4508...f6592c4. Read the comment docs.

@@ -215,7 +215,8 @@ def get_metadata(
return self.metadata

def __repr__(self) -> str:
return f"<Candidate {self.name} {self.version}>"
source = getattr(self.link, "comes_from", "unknown")
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the value if the candidate is from a file link(including VCS, remote file and local file)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I haven't tried and don't know. At least it doesn't break if comes_from is not set.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to make sure it displays a meaningful value not confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the cases you mentioned, pdm doesn't seem to go through the repository search. At least I wasn't able to get the candidate list output.

@frostming
Copy link
Collaborator

frostming commented Apr 28, 2021

The UI needs more careful design, consider this:

  1. What message should be written into the log file when verbose is off.
  2. How many lines will be output to the screen and whether it is easy for users to see what is happening.
  3. Any color formatting to improve the readability?
  4. Should the output go to stderr or stdout?

And in fact, there is a redundant output level DEBUG that is never used in PDM. It can be activated with -vv but currently no message falls into this level.

@pohlt
Copy link
Contributor Author

pohlt commented Apr 28, 2021

The UI needs more careful design, consider this:

  1. What message should be written into the log file when verbose is off.
  2. How many lines will be output to the screen and whether it is easy for users to see what is happening.
  3. Any color formatting to improve the readability?
  4. Should the output go to stderr or stdout?

And in fact, there is a redundant output level DEBUG that is never used in PDM. It can be activated with -vv but currently no message falls into this level.

If you give me your preferences on those topics, I'm happy to adapt the code. I also thought about using the DEBUG level. Might be the better choice.

@frostming
Copy link
Collaborator

Here is a output with the change of this PR:
log.txt

As you can see there are lots of duplicate lines that are not informative. I recommend only log failing cases here in find_matches and log the pinned candidate that is chosen by the resolver. You can do this by improving the output of pdm/resolver/reporters.py. The current output is poorly designed and lacks color emphasis.

@frostming
Copy link
Collaborator

frostming commented Apr 28, 2021

You can log the unfiltered candidate list (length limited to top 10) when find_matches failed to find any.

@pohlt
Copy link
Contributor Author

pohlt commented Apr 28, 2021

Here is a output with the change of this PR:
log.txt

As you can see there are lots of duplicate lines that are not informative. I recommend only log failing cases here in find_matches and log the pinned candidate that is chosen by the resolver. You can do this by improving the output of pdm/resolver/reporters.py. The current output is poorly designed and lacks color emphasis.

I don't understand the "lacks color emphasis" in context with logging the output to a file: We cannot use color there, right?
W.r.t. formatting I tried to be more compliant.

@frostming
Copy link
Collaborator

Here is a output with the change of this PR:
log.txt
As you can see there are lots of duplicate lines that are not informative. I recommend only log failing cases here in find_matches and log the pinned candidate that is chosen by the resolver. You can do this by improving the output of pdm/resolver/reporters.py. The current output is poorly designed and lacks color emphasis.

I don't understand the "lacks color emphasis" in context with logging the output to a file: We cannot use color there, right?
W.r.t. formatting I tried to be more compliant.

You are right, I turned verbose on so the output goes to stdout, improving the format is also good

@pohlt
Copy link
Contributor Author

pohlt commented Apr 28, 2021

I'm going to filter out the duplicate lines. Please don't accept yet.
Ok, done.

Copy link
Member

@linw1995 linw1995 left a comment

Choose a reason for hiding this comment

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

LGTM 💯

@pohlt pohlt requested a review from frostming April 29, 2021 08:15
@frostming frostming merged commit 8d02262 into pdm-project:master Apr 29, 2021
@frostming
Copy link
Collaborator

Thanks for contribution

@pohlt pohlt deleted the feat_add_candidate_output branch May 11, 2021 10:16
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