Skip to content

How to set a source for a sub dependency of a direct dependant package? #9578

Answered by radoering
wwuck asked this question in Q&A
Discussion options

You must be logged in to vote

Is there any way for package-b to tell package-a about the source url for torch? I can't see anything being added to the package-b wheel metadata for this.

No, there is no way to do this because explicit package sources is a Poetry feature so this information cannot be added to metadata when building a wheel.

Do I need to add torch as an explicit dependency with custom source into package-a/pyproject.toml as I did for package-b even if package-a is not directly using or importing torch?

Yes, but you can add it without a specific version constraint in an optional dependency group so that it is only installed if it is required by a direct dependency. For example:

[tool.poetry]
name = "p…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wwuck
Comment options

Answer selected by wwuck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants