-
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
Add solutions for common errors #2396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to seeing this in action. A few minor comments.
poetry/mixology/version_solver.py
Outdated
@@ -40,7 +39,7 @@ class VersionSolver: | |||
def __init__( | |||
self, | |||
root, # type: ProjectPackage | |||
provider, # type: Provider | |||
provider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we are dropping the type hint here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember exactly. I thin I got a cyclic import error at some point due to this import. I can check again to see if we really need to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I just checked and we need to remove it to avoid a cyclic import error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy
/typing
actually has a solution for just this problem! https://mypy.readthedocs.io/en/stable/common_issues.html#import-cycles
tl;dr:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from poetry.puzzle.provider import Provider
Fixed!
poetry.lock
Outdated
category = "main" | ||
description = "Manage Python errors with ease" | ||
marker = "python_version >= \"3.6\" and python_version < \"4.0\"" | ||
name = "crashtest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see crashtest on pypi but not on github, is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not open source yet, I need to write a proper README for the project first. It should be ready tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now open source: https://github.com/sdispater/crashtest
@@ -0,0 +1,3 @@ | |||
from .python_requirement_incompatibility_solution_provider import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These modules are a mouth full :) Would be great to put them into a structure, eg poetry.solutions.providers.incompatibility.python_requreiment
.
Would solutions
be better placed in poetry.mixology
consdiering we only really provide solutions for version solving issues or is the intent here to provide a generic mechanism?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted them to be as explicit as possible :-) But yeah I can see if we can reorganize a bit.
The idea is to extend the solutions beyond solver issues, for instance for configuration and validation errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I reorganized a bit and now each module (in this case mixology
) can provide its own solutions and providers.
This allows for a more flexible implementation.
d2f8cda
to
2196064
Compare
2196064
to
0341e52
Compare
0341e52
to
3eda75a
Compare
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. |
Pull Request Check List
Resolves: #2386
Resolves: #2076
Resolves: #2054
Resolves: #1930
This PR adds a way to provide solutions for common errors that users may encounter while using Poetry.
For now, the only solution implemented is for the resolution process failures due to Python requirements incompatibilities, which is the most common source of confusion regarding the way the resolver works.
This will serve as the base implementation for future solutions that we might want to add to provide an overall better user experience.
Here is an example: