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

inspection: improve package info error message #2997

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

abn
Copy link
Member

@abn abn commented Sep 29, 2020

A common issue when determining root cause of inspection errors is the lack of information on why a package inspect failed (eg: #2898). This change improves the situation by adding more contextual information for failures.

Current error output

$ poetry@master add git+https://bitbucket.org/jmtaylor/py_sad_correlation

  PackageInfoError

  Unable to determine package info for path: /tmp/pypoetry-git-py_sad_correlationaw_3sjs8

  at ~/.local/pipx/venvs/poetry@master/lib64/python3.8/site-packages/poetry/inspection/info.py:485 in _pep517_metadata
      481│                 try:
      482│                     venv.run("python", "setup.py", "egg_info")
      483│                     return cls.from_metadata(path)
      484│                 except EnvCommandError:
    → 485│                     raise PackageInfoError(path)
      486│                 finally:
      487│                     os.chdir(cwd.as_posix())
      488│ 
      489│         if info:

New error output

$ poetry@local add git+https://bitbucket.org/jmtaylor/py_sad_correlation

  PackageInfoError

  Unable to determine package info for path: /tmp/pypoetry-git-py_sad_correlations74oa0g7
  
  Fallback egg_info generation failed.
  
  Command ['/tmp/tmptlla0klg/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "setup.py", line 2, in <module>
      import numpy  # So we can work out where the numpy headers live!
  ModuleNotFoundError: No module named 'numpy'

  at ~/workspace/python-poetry/poetry/poetry/inspection/info.py:484 in _pep517_metadata
      480│                 try:
      481│                     venv.run("python", "setup.py", "egg_info")
      482│                     return cls.from_metadata(path)
      483│                 except EnvCommandError as fbe:
    → 484│                     raise PackageInfoError(path, "Fallback egg_info generation failed.", fbe)
      485│                 finally:
      486│                     os.chdir(cwd.as_posix())
      487│ 
      488│         if info:

@abn abn requested a review from a team September 29, 2020 16:21
@abn abn added this to the 1.1 milestone Sep 29, 2020
@finswimmer finswimmer merged commit 4276811 into python-poetry:master Sep 30, 2020
@abn abn deleted the inspection-improve-info-error branch September 30, 2020 20:28
@sdispater sdispater mentioned this pull request Sep 30, 2020
Copy link

github-actions bot commented Mar 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants