-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Issue description
When this Python version compatibility error message is displayed:
pipenv/pipenv/utils/project.py
Lines 79 to 84 in 483baf4
| err.print( | |
| f"[red][bold]Warning[/bold][/red]: Your Pipfile requires " | |
| f'[bold]"python_version"[/bold] [cyan]{project.required_python_version}[/cyan], ' | |
| f"but you are using [cyan]{python_version(path_to_python)}[/cyan] " | |
| f"from [green]{shorten_path(path_to_python)}[/green]." | |
| ) |
...it prints paths with an additional leading forward slash like so:
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.13.10
from //usr/local/bin/python3.
ie: It should print the path /usr/local/bin/python3 not //usr/local/bin/python3.
I'm presuming this is a bug in shorten_path():
Lines 542 to 550 in 483baf4
| def shorten_path(location, bold=False): | |
| """Returns a visually shorter representation of a given system path.""" | |
| path = Path(location) if not isinstance(location, Path) else location | |
| path_parts = list(path.parts) | |
| short_parts = [p[0] if len(p) > len("2long4") else p for p in path_parts[:-1]] | |
| short_parts.append(path_parts[-1]) | |
| if bold: | |
| short_parts[-1] = f"[bold]{short_parts[-1]}[/bold]" | |
| return os.sep.join(short_parts) |
Expected result
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.13.10
from /usr/local/bin/python3.
Actual result
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.13.10
from //usr/local/bin/python3.
Steps to replicate
Create this Dockerfile:
FROM python:3.13.10-slim
WORKDIR /testcase
COPY <<EOF Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
typing-extensions = "*"
[requires]
python_version = "3.11"
EOF
COPY <<EOF Pipfile.lock
{
"_meta": {
"hash": {
"sha256": "5a5846099fd5ceb0291e704a94f49cf0b8a226109fdae915a61253b56eaf3ed6"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.11"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"typing-extensions": {
"hashes": [
"sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c",
"sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==4.13.2"
}
},
"develop": {}
}
EOF
RUN pip install pipenv==v2026.0.3 --disable-pip-version-check --quiet --root-user-action ignore
RUN pipenv install --deploy --systemThen run it with:
docker build . --progress plain --no-cache
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels