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
Ignore dependencies not matching the project's python constraint... #4958
Ignore dependencies not matching the project's python constraint... #4958
Conversation
…atter if the python version is specified by "python" keyword or by "markers"
@radoering Questions:
|
|
My two cents
|
The constraint is propagated from the root package to the root dependency. This makes the filter logic you reference take effect.
The issue addressed by this PR has nothing to do with keyword-type and marker-type python constraints excluding each other. If you look at the examples at the top, you will see there is either a keyword-type or a marker-type constraint (not both together).
Fixing the root cause sounds good, but when I revert the fix in version_solver.py from this PR and apply the changes to factory.py from your PR, the test added in this PR fails. Thus, I suppose this PR is independent of your PR. |
I run your example, and that's why I encourage you to consider the code I provided in reciprocity:-) So, if you set the debugger at the guilty lines I indicated above poetry/src/poetry/puzzle/provider.py Lines 494 to 496 in 1aa4d5b
you will see that
fix the root-cause rather than patching post-hoc, and we will be all fine? As of now, yes, both our PRs are drafts and not fully tested. |
@maciejskorski: I'm afraid I don't quite follow you. I see that there are several places where filtering takes place. At first, the lines you mention (= early filtering). And later the following lines (= late filtering), which also were in place before this PR: poetry/src/poetry/puzzle/provider.py Lines 692 to 713 in 1aa4d5b
The fix in this PR triggers one of the
I understand that filtering earlier is better. However, I am not sure which code you're referring to. If I don't mess something up, your first commit 6d5409b does neither trigger early nor late filtering and fails the test added in this PR. Your later commit ec42fa5 triggers early filtering and passes the test. However, other tests in Nevertheless, even if there is a solution that triggers early filtering for this use case and passes all tests, I don't see a reason why |
Sorry, I think we are both active on few issues and are about to mix topics so let me try to clarify better. First, nothing logically wrong with picking the lost constraint from the parent/root. If your matching mechanism, which I called filtering, already exists better to fix the bug, rather than repeating it once more. |
@maciejskorski: OK, so I've wrongly assumed that you are referring to the other PR. Sorry about that. If I set a breakpoint at the mentioned lines and execute the new test, I see that package A is discarded because a python_constraint is set and package B is not discarded because no python constraint is set. Thus, ensuring that a python_constraint is set in package B somehow would be an alternative solution.
I don't propose to add any matching mechanism. The filtering already exists. It is just not triggered because |
Yes! We are closer and closer to agree on this. Like I detailed in related issues, the reason for non-setting constraints comes from the backend in I checked out that Please make sure you install |
You are right. It seems the issue has already been fixed upstream. Thanks for pointing this out. I still wonder if there are some cases where early filtering is not possible so that setting the root dependency's python constraint is required for late filtering. Maybe, I'll dig a bit deeper if I find some time. |
Closing PR because issue has already been fixed upstream. Created separate PR # #5307 to add only the test case. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
...no matter if the python version is specified by "python" keyword or by "markers"
Pull Request Check List
Relates-to: #4952
Currently, the following equivalent dependency specifications result in different lock files:
When using
python
the pandas dependency not matching the project's python constraint is ignored. When usingmarkers
the dependency is not ignored.This PR harmonizes the behaviour between both variants.