-
Notifications
You must be signed in to change notification settings - Fork 25
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] Installing a package in main deps and its extras in group deps breaks requirements string #283
Comments
sounds reasonable. @frenzymadness wdyt? please re-label if needed /kind bug |
I have an implementation that should fix this but it causes another 14 tests to fail which might be okay but I'd like to verify my understanding of the problem first. Let's use httpcore as an example. httpcore requires h2 for extras named http2. If I have something like this in my pyproject.toml:
The expected result of
because I want only dependencies from the main category and h2 is not there, there is no reason to add [http2]. But when I manually add h2 into the main dependencies so then I have:
then the result of the same command is:
The reason for this is that h2 and httpcore are now in the same category so the detection of extras thinks that h2 is there because httpcore has been requested with [http2] - this is not true in this case but causes no harm because But there is another problem with this implementation - recursion. Let's say I have this part in poetry.lock:
The question to answer is: Should we install Also, thanks to this reproducer, I've realized that we have another problem: dependency can only belong to one category and the main/default one has a higher priority for us which means that when we use this example and run micropipenv with |
Describe the bug
When specifying
package
as a core dependency andpackage[extras]
as a dev dependency in pyproject.toml,micropipenv requirements --no-dev
renderspackage[extras]
.To Reproduce
poetry lock
micropipenv requirements --no-dev
Expected behavior
The package, without extras, should be output
Additional context
Related to assumptions around the extras resolver
https://github.com/thoth-station/micropipenv/blob/master/micropipenv.py#L838-L849
Because all the extras are present and the root dependency is flagged as a main dependency, the resolver adds the extras.
Especially with 1.5 and on I'm not sure how you'd solve this issue besides checking the pyproject.toml file. Pre-1.5 you could theoretically check to see if all the extra dependencies had a different category than the parent but that might be a little heavy and especially considering #249 this whole discussion could be moot anyways
The text was updated successfully, but these errors were encountered: