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

Allow displaying the derivation tree #6124

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Allow displaying the derivation tree #6124

merged 1 commit into from
Aug 16, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Aug 15, 2024

I need this for debugging error messages.

I used an environment variable instead of a trace log so you can do UV_INTERNAL__SHOW_DERIVATION_TREE=1 and run a test to see the tree in the test snapshot without further changes.

e.g.

    // Resolving should fail.
    uv_snapshot!(context.filters(), context.lock().arg("--preview").current_dir(&workspace), @r###"
    success: false
    exit_code: 1
    ----- stdout -----
    UV_INTERNAL__SHOW_DERIVATION_TREE
      root==0a0.dev0 depends on foo*
        root==0a0.dev0 depends on bar[some-extra]*
          foo==0.1.0 depends on anyio==4.1.0
            bar[some-extra]==0.1.0 depends on anyio==4.2.0
            no versions of bar[some-extra]<0.1.0 | >0.1.0

    ----- stderr -----
    Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
      × No solution found when resolving dependencies:
      ╰─▶ Because only bar[some-extra]==0.1.0 is available and bar[some-extra] depends on anyio==4.2.0, we can conclude that all versions of bar[some-extra] depend on anyio==4.2.0.
          And because foo depends on anyio==4.1.0, we can conclude that foo and all versions of bar[some-extra] are incompatible.
          And because your workspace requires bar[some-extra] and foo, we can conclude that your workspace's requirements are unsatisfiable.
    "###
    );

@zanieb zanieb added internal A refactor or improvement that is not user-facing tracing Verbose output and debugging labels Aug 15, 2024
@zanieb zanieb requested a review from charliermarsh August 15, 2024 17:55
@@ -248,6 +253,51 @@ impl std::fmt::Display for NoSolutionError {
}
}

#[allow(clippy::print_stdout)]
Copy link
Member

Choose a reason for hiding this comment

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

You can also use anstream::println.

@zanieb zanieb enabled auto-merge (squash) August 16, 2024 14:19
@zanieb zanieb merged commit d7abe82 into main Aug 16, 2024
56 checks passed
@zanieb zanieb deleted the zb/show-tree branch August 16, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing tracing Verbose output and debugging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants