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

Reduce default errors verbosity #5559

Conversation

Bobronium
Copy link

@Bobronium Bobronium commented May 8, 2022

Pull Request Check List

Replaces: #2915
Resolves: #2854, #3273, #4014, #5229

image

Verbose output
~/dev/contrib/poetry reduce-default-errors-verbosity.
(.venv) $ poetry add something_usefull -v
Using virtualenv: /Users/bobronium/dev/contrib/poetry/.venv

Stack trace:

21  .venv/lib/python3.10/site-packages/cleo/application.py:330 in run
      exit_code = self._run(io)

20  src/poetry/console/application.py:184 in _run
      return super()._run(io)

19  .venv/lib/python3.10/site-packages/cleo/application.py:425 in _run
      exit_code = self._run_command(command, io)

18  .venv/lib/python3.10/site-packages/cleo/application.py:467 in _run_command
      raise error

17  .venv/lib/python3.10/site-packages/cleo/application.py:451 in _run_command
      exit_code = command.run(io)

16  .venv/lib/python3.10/site-packages/cleo/commands/base_command.py:118 in run
      status_code = self.execute(io)

15  .venv/lib/python3.10/site-packages/cleo/commands/command.py:85 in execute
      return self.handle()

14  src/poetry/console/commands/add.py:159 in handle
      requirements = self._determine_requirements(

13  src/poetry/console/commands/init.py:355 in _determine_requirements
      name, version = self._find_best_version_for_package(

12  src/poetry/console/commands/init.py:390 in _find_best_version_for_package
      package = selector.find_best_candidate(

11  src/poetry/version/version_selector.py:39 in find_best_candidate
      candidates = self._pool.find_packages(dependency)

10  src/poetry/repositories/pool.py:167 in find_packages
      packages += repo.find_packages(dependency)

 9  src/poetry/repositories/pypi_repository.py:53 in find_packages
      info = self.get_package_info(dependency.name)

 8  src/poetry/repositories/pypi_repository.py:141 in get_package_info
      return self._cache.store("packages").remember_forever(

 7  .venv/lib/python3.10/site-packages/cachy/repository.py:174 in remember_forever
      val = value(callback)

 6  .venv/lib/python3.10/site-packages/cachy/helpers.py:6 in value
      return val()

 5  src/poetry/repositories/pypi_repository.py:142 in <lambda>
      name, lambda: self._get_package_info(name)

 4  src/poetry/repositories/pypi_repository.py:146 in _get_package_info
      data = self._get(f"pypi/{name}/json")

 3  src/poetry/repositories/pypi_repository.py:231 in _get
      json_response = self.session.get(self._base_url + endpoint)

 2  src/poetry/utils/authenticator.py:229 in get
      return self.request("get", url, **kwargs)

 1  src/poetry/utils/authenticator.py:215 in request
      resp.raise_for_status()

HTTPError

404 Client Error: Not Found for url: https://pypi.org/pypi/something-usefull/json/

at .venv/lib/python3.10/site-packages/requests/models.py:960 in raise_for_status
    956elif 500 <= self.status_code < 600:
    957http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
    958959if http_error_msg:
  → 960raise HTTPError(http_error_msg, response=self)
    961962def close(self):
    963│         """Releases the connection back to the pool. Once this method has been
    964called the underlying ``raw`` object must not be accessed again.
  • Added tests for changed code.
  • Updated documentation for changed code.

@Bobronium
Copy link
Author

Not sure I should add anything to docs, they don't really describe errors much.
As for the tests, I will add them tomorrow.

@Bobronium
Copy link
Author

Unfortunately, this implementation doesn't support solutions in non-verbose mode.
As per #5229 (comment), these, or part of these changes indeed belong to cleo (see python-poetry/cleo#132)

@Secrus Secrus added area/cli Related to the command line area/ux Features and improvements related to the user experience status/external-issue Issue is caused by external project (platform, dep, etc) Dependency labels May 21, 2022
@branchvincent branchvincent mentioned this pull request Jun 3, 2022
Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli Related to the command line area/ux Features and improvements related to the user experience status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli: improve messaging around usage errors
2 participants