You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
Summary
When a Python package has a malformed version, the error message only states what version it failed to parse. Would it be helpful for the ParseVersionError to also return the package involved in the error?
Background
Given the following Dockerfile
FROM fedora:31
# install bpython
RUN dnf install python3-pip python3-devel python3-bpython -y
RUN useradd user
RUN echo user ALL=NOPASSWD:ALL > /etc/sudoers.d/user
USER user
WORKDIR /home/user
# install poetry
ENV \
POETRY_HOME=/home/user/.poetry \
POETRY_VERSION=1.1.0 \
POETRY_VIRTUALENVS_CREATE=false
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
ENV PATH="$POETRY_HOME/bin:$PATH"
Installed with:
docker build -t local/bpython-fail
And poetry-proj/pyproject.toml:
[tool.poetry]
name = "poetry-proj"
version = "0.1.0"
description = "A reproducer for a poetry issue"
authors = [
"Issue Reproducer <issues@noreply.com>"
]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
bpython = "^0.19"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Start the docker image and run poetry install:
docker run -v (pwd)/poetry-proj:/home/user/poetry-proj -it local/bpython-fail
$ cd poetry-proj/
$ poetry install -vvv
The command poetry install -vvv will fail with:
Skipping virtualenv creation, as specified in config file.
Stack trace:
10 ~/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py:131 in run
129│ parsed_args = resolved_command.args
130│
→ 131│ status_code = command.handle(parsed_args, io)
132│ except KeyboardInterrupt:
133│ status_code = 1
9 ~/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py:120 in handle
118│ def handle(self, args, io): # type: (Args, IO) -> int
119│ try:
→ 120│ status_code = self._do_handle(args, io)
121│ except KeyboardInterrupt:
122│ if io.is_debug():
8 ~/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py:163 in _do_handle
161│ if self._dispatcher and self._dispatcher.has_listeners(PRE_HANDLE):
162│ event = PreHandleEvent(args, io, self)
→ 163│ self._dispatcher.dispatch(PRE_HANDLE, event)
164│
165│ if event.is_handled():
7 ~/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py:22 in dispatch
20│
21│ if listeners:
→ 22│ self._do_dispatch(listeners, event_name, event)
23│
24│ return event
6 ~/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py:89 in _do_dispatch
87│ break
88│
→ 89│ listener(event, event_name, self)
90│
91│ def _sort_listeners(self, event_name): # type: (str) -> None
5 ~/.poetry/lib/poetry/console/config/application_config.py:147 in set_installer
145│ poetry.locker,
146│ poetry.pool,
→ 147│ poetry.config,
148│ )
149│ installer.use_executor(poetry.config.get("experimental.new-installer", False))
4 ~/.poetry/lib/poetry/installation/installer.py:65 in __init__
63│ self._installer = self._get_installer()
64│ if installed is None:
→ 65│ installed = self._get_installed()
66│
67│ self._installed_repository = installed
3 ~/.poetry/lib/poetry/installation/installer.py:531 in _get_installed
529│
530│ def _get_installed(self): # type: () -> InstalledRepository
→ 531│ return InstalledRepository.load(self._env)
532│
2 ~/.poetry/lib/poetry/repositories/installed_repository.py:118 in load
116│ path = Path(str(distribution._path))
117│ version = distribution.metadata["version"]
→ 118│ package = Package(name, version, version)
119│ package.description = distribution.metadata.get("summary", "")
120│
1 ~/.poetry/lib/poetry/_vendor/py3.7/poetry/core/packages/package.py:61 in __init__
59│
60│ if not isinstance(version, Version):
→ 61│ self._version = Version.parse(version)
62│ self._pretty_version = pretty_version or version
63│ else:
ParseVersionError
Unable to parse "unknown".
at ~/.poetry/lib/poetry/_vendor/py3.7/poetry/core/semver/version.py:206 in parse
202│ except TypeError:
203│ match = None
204│
205│ if match is None:
→ 206│ raise ParseVersionError('Unable to parse "{}".'.format(text))
207│
208│ text = text.rstrip(".")
209│
210│ major = int(match.group(1))
This occurs, because when installed with dnf, bpython --version returns:
$ bpython --version
bpython version unknown on top of Python 3.7.9 /usr/bin/python3
(C) 2008-2016 Bob Farrell, Andreas Stuehrk, Sebastian Ramacher, Thomas Ballinger, et al. See AUTHORS for detail.
This was a bit difficult to debug. Would it be helpful for the ParseVersionError to also return the package involved in the error?
The text was updated successfully, but these errors were encountered:
abn
added
area/error-handling
Bad error messages/insufficient error handling
kind/enhancement
Not a bug or feature, but improves usability or performance
area/ux
Features and improvements related to the user experience
and removed
kind/bug
Something isn't working as expected
labels
Oct 13, 2020
-vvv
option).Summary
When a Python package has a malformed version, the error message only states what version it failed to parse. Would it be helpful for the ParseVersionError to also return the package involved in the error?
Background
Given the following Dockerfile
Installed with:
And
poetry-proj/pyproject.toml
:Start the docker image and run
poetry install
:The command
poetry install -vvv
will fail with:This occurs, because when installed with
dnf
,bpython --version
returns:This was a bit difficult to debug. Would it be helpful for the ParseVersionError to also return the package involved in the error?
The text was updated successfully, but these errors were encountered: