-
Notifications
You must be signed in to change notification settings - Fork 946
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
[question] Full Requires with conan2 python API #16259
Comments
Hi @lstoffer Thanks for your question. If we are talking about a PkgReference, including the
Now, if for a given reference like remotes = conan_api.remotes.list(args.remote) if not args.no_remote else []
lockfile = conan_api.lockfile.get_lockfile(lockfile=args.lockfile, cwd=cwd, partial=args.lockfile_partial)
profile_host, profile_build = conan_api.profiles.get_profiles_from_args(args)
deps_graph = conan_api.graph.load_graph_requires(args.requires, args.tool_requires,
profile_host, profile_build, lockfile, remotes) Where you can input your references in Is this what you are looking for? You shouldn't need to compute the |
Hi @memsharded Thank you very much for your reply. I am not totally sure this is what I am looking for. The reference I am currently obtaining like this: conan2 = ConanAPI()
remote = conan2.remotes.get("inhouse")
recipes = conan2.search.recipes("someproject", remote)
latest_recipe_revision = conan2.list.latest_recipe_revision(recipes[0], remote)
package_configurations = conan2.list.packages_configurations(latest_recipe_revision, remote)
filtered_package_configurations = conan2.list.filter_packages_configurations(package_configurations, query='os=Windows AND arch=x86_64 AND build_type=Release') This leads to the following output:
So I basically want to find all the references for all the dependencies (including the transitive ones) of |
For finding the dependencies of a given reference, it is necessary to build a dependency graph, and this is more or less the code that I showed above. There is not a 1:1 correlation for a given package reference
|
Thank you very much.
Just one more thing that I still do not understand about the code you shared. How are the |
The remotes = conan_api.remotes.list(["myremote1", "myremote2"])
lockfile = conan_api.lockfile.get_lockfile(lockfile="mylockfile.lock", partial=True)
profile_host = conan_api.profiles.get_profile(["myprofilehost"]
profile_build = conan_api.profiles.get_profile(["myprofilebuild"]) |
Thank you very much! I was able to load the dependency graph. |
Yes, this dependency graph, you can call This format is documented in https://docs.conan.io/2/reference/commands/formatters/graph_info_json_formatter.html, you can see for any node, its |
What is your question?
Hi! I have a question regarding the conan2 python API.
I have a
PkgReference
and want to determine all the dependencies that this package has (also transitive dependencies). Is there a way to achieve this with the current state of the conan2 python API.What I found and seems to be on the right track is the
GraphAPI
and its functionload_graph
. However I struggle to see how to get theroot_node
that has to be passed to this function from thePkgReference
I already have.Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: