-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Ability to block a transitive dependency #5330
Comments
You should ask prospector to treat pylint as an optional extra, if that's the behaviour you want. |
In an ideal world, where every project marked all dependencies as optional if it is possible to use parts of their project without that dependency, this would be feasible. In reality, working with extras is just cumbersome enough that if 90% of your users are going to need a specific dependency, you're not going to make that an optional extra. Solving this use case in the "package manager" has a much higher bang-for-bucks ratio. The second use case mentioned above could also be solved by making every project that depend on package A change to allow using package B instead, but I think that's even less realistic. Solving it in the "package manager" is way more efficient and practical. |
Interesting, I would find fixing the problem at the source way more efficient and practical than having to exclude transitive dependencies 😄 @mortenlj you seem to be the only person who ever raised this point, which means that it's unlikely this will ever get implemented if you don't provide a change request. Otherwise, I feel this issue will get closed as unplanned |
For 1 package: sure It boils down to how likely this situation is, and in other ecosystems it is so common that the tools support it. Both Gradle and Maven allow it in JVM, Go allows using On the other hand, if I'm the only person in all of Python who has ever needed this (and even I can't remember which project this was anymore), I guess it's fair to close it as unplanned. 🤷 |
i could use this functionality as well. i have a package that needlessly declares |
You're not alone. I also need this 😃. |
@ralbertazzi consider the following use case: "My" library has a dependency to library "A" which provides "import A" package, then in a wild there is a library "A+" which provides "import A" also, though with a different api or purpose, so that library is a part of some dependency to the project with is using the "My" library. So I as an author of "My" library would like to have as a precaution an ability to indicate via package manager that the "My" library is incompatible with "A+" library and they cannot be installed both into the same environment. |
I'm finding a need for this presently as I want to install Ultimately, I think I'm headed down the track of manually specifying the torch CPU packages à la #4231 (comment). |
A concrete example. So as a user of
Obviously it'd be much simpler and more reliable for me if I could just change my own dependencies today, and move on. Aside: My experience is that the Python community seems to get most of this library management process right, which may be why it's not a common issue for us. But in general, if one of the goals of a dependency management tool like |
@garyd203 +1 and thanks for bringing this up. For me it was also the |
@garyd203 +1 I'm running on the same situation. |
Another example where that would be useful: run-llama/llama_index#11896 |
But thinking about it again, I believe this should be supported in Python packaging first. |
A case where idealism clashes with reality. This is indeed a feature that is needed for real-world usage, where sometimes you can't just update to a newer version or wait for a fix to be made upstream. |
Another case is to prevent installation of |
This is unlikely to get implemented as long as there is no standard in the python ecosystem. There are some discussions around about the ability to declare alternative dependencies e.g. https://discuss.python.org/t/require-any-of-several-alternative-package-dependencies/26293 If there is finally a PEP for it, it might be possible together with #7051 to block a transitive dependency. |
@finswimmer I'm not sure that this should be dependent on upstream support for alternative dependencies.
My understanding of that discussion is that the proposal is for a package (eg. But the point of the proposal in this discussion is that i get to control which transitive dependencies I bring in even when another package has done a bad job of specifying dependencies. That is, I want to fully control my transitive dependencies via some |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
It would in some cases be useful to block a transitive dependency from being installed.
There are a couple use cases that I can think of:
The first one is why I started looking for this feature, because we use Prospector to run various code quality tools. One of the tools Prospector pulls in is PyLint, but we are not using PyLint and since PyLint is GPL we would rather avoid pulling it in causing licensing questions.
The second one could be things like the PIL -> Pillow transition that happened some years ago, or similar situations where a new library intends to take the place of an older, deprecated library. This kind of thing is more common in other ecosystems (logging in JVM is a prime example), but can be very useful in some situations.
Both of these use cases would be supported if you could somehow tell poetry to ignore packages with a certain name when processing the dependency graph.
The text was updated successfully, but these errors were encountered: