Skip to content
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

tweak messaging re incompatible python versions #8423

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ In this case, you can disable this feature by setting the `virtualenvs.create` s
poetry config virtualenvs.create false
```

### Why is Poetry telling me that the current project's Python requirement is not compatible with one or more packages' Python requirements?
### Why is Poetry telling me that the current project's supported Python range is not compatible with one or more packages' Python requirements?

Unlike `pip`, Poetry doesn't resolve for just the Python in the current environment. Instead it makes sure that a dependency
is resolvable within the given Python version range in `pyproject.toml`.
Expand All @@ -179,18 +179,18 @@ This means your project aims to be compatible with any Python version >=3.7,<4.0
whose Python requirement doesn't match the whole range Poetry will tell you this, e.g.:

```
The current project's Python requirement (>=3.7.0,<4.0.0) is not compatible with some of the required packages Python requirement:
The current project's supported Python range (>=3.7.0,<4.0.0) is not compatible with some of the required packages Python requirement:
- scipy requires Python >=3.7,<3.11, so it will not be satisfied for Python >=3.11,<4.0.0
```

Usually you will want to match the Python requirement of your project with the upper bound of the failing dependency.
Alternative you can tell Poetry to install this dependency [only for a specific range of Python versions]({{< relref "dependency-specification#multiple-constraints-dependencies" >}}),
Usually you will want to match the supported Python range of your project with the upper bound of the failing dependency.
dimbleby marked this conversation as resolved.
Show resolved Hide resolved
Alternatively you can tell Poetry to install this dependency [only for a specific range of Python versions]({{< relref "dependency-specification#multiple-constraints-dependencies" >}}),
if you know that it's not needed in all versions.


### Why does Poetry enforce PEP 440 versions?

This is done so to be compliant with the broader Python ecosystem.
This is done to be compliant with the broader Python ecosystem.

For example, if Poetry builds a distribution for a project that uses a version that is not valid according to
[PEP 440](https://peps.python.org/pep-0440), third party tools will be unable to parse the version correctly.
Expand Down
2 changes: 1 addition & 1 deletion docs/managing-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ By default, Poetry will try to use the Python version used during Poetry's insta
to create the virtual environment for the current project.

However, for various reasons, this Python version might not be compatible
with the `python` requirement of the project. In this case, Poetry will try
with the `python` range supported by the project. In this case, Poetry will try
to find one that is and use it. If it's unable to do so then you will be prompted
to activate one explicitly, see [Switching environments](#switching-between-environments).

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/mixology/failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def write(self) -> str:
if isinstance(incompatibility.cause, PythonCause):
if not required_python_version_notification:
buffer.append(
"The current project's Python requirement"
"The current project's supported Python range"
f" ({incompatibility.cause.root_python_version}) is not"
" compatible with some of the required packages Python"
" requirement:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def can_solve(self, exception: Exception) -> bool:
return False

m = re.match(
"^The current project's Python requirement (.+) is not compatible "
"^The current project's supported Python range (.+) is not compatible "
"with some of the required packages Python requirement",
str(exception),
)
Expand Down
4 changes: 2 additions & 2 deletions tests/mixology/version_solver/test_python_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def test_dependency_does_not_match_root_python_constraint(
add_to_repo(repo, "foo", "1.0.0", python="<3.5")

error = """\
The current project's Python requirement (>=3.6,<4.0) is not compatible with some of\
the required packages Python requirement:
The current project's supported Python range (>=3.6,<4.0) is not compatible with some\
of the required packages Python requirement:
- foo requires Python <3.5, so it will not be satisfied for Python >=3.6,<4.0

Because no versions of foo match !=1.0.0
Expand Down