-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Transitive dependency forces dev dependency installation #12412
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
Comments
I see the same issue. When I fetch this repo: https://github.com/opentelemetry-php/contrib-auto-pdo/blob/main/composer.json and run:
I still see in the output:
When i run:
Diagnose:
|
Ok this took me a while to realize what was going on 🙈 but the good news (for me..) is there is no bug. The root cause is this:
Since shopware decides to replace the symfony polyfills that it doesn't need, but ramsey/uuid actually needs those.. This means that within the installed dependencies ramsey/uuid actually ends up depending on shopware, which is why it pulls it up into the non-dev requirements. If you pin the ramsey/uuid to 4.2.3 (to keep things simpler) and then remove the shopware requirement and run an update you will see this:
So you see in that case it ends up adding the missing polyfill. But when trying to figure out which packages are dev requirements and which are not, it doesn't have access to symfony/polyfill-ctype because that would create a corrupt lock file as installing it without shopware but without the polyfill would not fulfill ramsey/uuid's requirements. So we compute things without considering other packages than those we currently have selected when resolving all dependencies together, and then it fails to remove shopware as it is needed. I hope this explanation is understandable to everyone here. Anyway the only solution would be for shopware to drop these replaces. If we resolve #7557 that would be much easier to sell them as the replaces would become entirely useless. But right now up to them if they think this issue is more important than wasting a few bytes with polyfills installed. |
My
composer.json
:Output of
composer diagnose
:When I run this command:
I get the following output:
And I expected this to happen:
Removal of all dependencies that are installed through the sole dev dependency.
The shopware dependency also depends on the ramsey/uuid package. As soon as i add it to the requirements, whenever i run composer install --no-dev the shopware package is installed along with all of its dependencies. My expectation would be that only the uuid package is provided. The composer.lock file reflects this change as the packages-dev array is empty.
I don't know it this is expected behavior, but as from my user perspective I am quite surprised.
The text was updated successfully, but these errors were encountered: