-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Poetry removes optional dependencies when using poetry install --only
#9326
Comments
I wonder if there is a good reason for this behavior or if it is just legacy behavior nobody had the courage to change? In other words, it might be something we want to change especially if we do a major version bump. Personally, I think it makes more sense not to remove dependencies that are part of an unrequested extra when running |
there is some sort of expectation in this report that but this has never been so, these commands have always removed packages if they are under poetry control and they are not required by the action being taken
for sure that behaviour could be changed but I think it is currently consistent and understandable. (though perhaps it could be better understood eg with improved docs) |
I think I do not quite understand what exactly you are referring to. Consider the following example:
Commands:
I would say, both, |
removing unspecified groups was declared "counter-intuitive" in #4336. I guess my intuition is the opposite, it does not seem to me to match the meaning of the words for |
one more thought: eg if for whatever reason I have tools in my environment that are not managed by poetry - ie changing the behaviour would be taking something away, it is certainly debatable how valuable that thing is. |
Description
I experienced a strange behavior when using the
poetry install
command with the--only
flag.Let's say that all of my dependencies are installed and up to date. If I run
poetry install --only=mygroup
, I expect that no installations would be required. But, what actually happens is that it removes my optional dependencies, as if I had used the--sync
keyword.My scenario is that for some parts of my (local or remote) CI process, I want to install only a certain subset of my dependencies. So I use the
--only
flag to specify which dependency group to install. My expectations is that, nothing should be uninstalled unless I use the--sync
flag.Workarounds
If I run
poetry install --only=mygroup --all-extras
, the optional dependencies aren't removed. But it feels that it should be the default behaviour.Poetry Installation Method
system package manager (eg: dnf, apt etc.)
Operating System
MacOs (14.4.1 (23E224))
Poetry Version
1.8.2
Poetry Configuration
Python Sysconfig
Example pyproject.toml
Poetry Runtime Logs
The text was updated successfully, but these errors were encountered: