pdm icon indicating copy to clipboard operation
pdm copied to clipboard

print the `conflict` reason before trying an older version of dep in `pdm add`

Open goyalyashpal opened this issue 1 year ago • 5 comments

summaries & titles

  • print the conflict reason before trying an older version of dep in pdm add
  • it would be good to know the reason of why the resolution is failing.

Is your feature/enhancement proposal related to a problem? Please describe.

  • pdm add ... would keep on trying and trying and trying with older and older versions; taking sooo long time
  • with no feedback or any clue to the user of what is happening or if they should intervene.
  • is it due to the arch, the os? or some other dependency? or the toolchain used?

Describe the solution you'd like

a brief/short version of the conflict reason can be shared (optionally) similar to how a locked pdm add ... i.e. say pdm add tensorflow>=2.16 on windows 10 os immediately shows the following:

ERROR: Unable to find a resolution for tensorflow-cpu-aws
because of the following conflicts:
  tensorflow-cpu-aws==2.16.1; (platform_machine == "arm64" or platform_machine == "aarch64") and platform_system == "Linux" (from [email protected])

it is similar but not same as #1639

goyalyashpal avatar May 05 '24 05:05 goyalyashpal

Have you tried the -v verbose option? IIRC it shows such info.

pawamoy avatar May 05 '24 07:05 pawamoy

hi!

  • yes, i did (see #2867)
  • and -v is some 100 long lines for a single dep.
  • so no, it won't work.

like i said, the output should very short (70-110 "chars" at max per dep, not 70-110 lines lol), formatted to become even shorter than the one with fixed dep if possible... just as an FYI nudge to the user. not an essay for debugging.

say smth like:

CONFLICT: from [email protected], can't resolve:
  tensorflow-cpu-aws==2.16.1; (machine == "arm64" or "aarch64") and system == "Linux" 

above is took from following, and reformatted to be even shorter.

ERROR: Unable to find a resolution for tensorflow-cpu-aws
because of the following conflicts:
  tensorflow-cpu-aws==2.16.1; (platform_machine == "arm64" or platform_machine == "aarch64") and platform_system == "Linux" (from [email protected])

goyalyashpal avatar May 05 '24 07:05 goyalyashpal

but pdm may attempt many times to find the matching version, keeping falling back to older versions. even shortest conflict summary will make the log big, have you imagined how it would look like?

frostming avatar May 05 '24 13:05 frostming

  • thats why i said optional... like many apps allow repeating vs to allow setting verbosity levels

  • the issue currently with pdm is that even single verbose is just too verbose.

  • i think the long scroll backs occur only majorly in case of os things. as the deps specify there further dep straight away. but i might be naive here as i have not worked on huge projects


also, the specific is one line per try of a single explicit dep. the heading wont be repeated. so, format would become:

CONFLICT: from tensorflow, can't resolve:
  [email protected]<-tensorflow-cpu-aws==2.16.1; (machine == "arm64" or "aarch64") and system == "Linux" 
  [email protected]<-tensorflow-cpu-aws==2.15.0; (machine == "arm64" or "aarch64") and system == "Linux" 
 ...

goyalyashpal avatar May 05 '24 13:05 goyalyashpal

  • i just noticed from https://github.com/pdm-project/pdm/issues/2867
  • that the same 3-4 lines were repeated for 20 times lol....
  • so, n * (1 + (m * 1-normal-line)) vs n * m * (20 * 3-long-lines) lines n: number of deps, m: multiple failed tries per dep
  • ... is 30-60 times difference straight away; no matter how many retries it does.

goyalyashpal avatar May 05 '24 22:05 goyalyashpal