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

Remote installation with minor typo (capitalization) hidden in resulting error #537

Closed
1 task done
gregdan3 opened this issue Jul 12, 2021 · 0 comments
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@gregdan3
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  1. Set up a pdm project
  2. pdm add some remote dependency, but with the following (example) typo: Git+ssh://... instead of the intended git+ssh://...
  3. Observe the resulting error message, which no longer contains the capitalization typo that causes the error

Actual behavior

The error message resulting from a capitalization error in the remote dependency specification does not show the original capitalization of the given string, hiding what caused the error.

Example on a freshly created pdm project:

~/temp via 🐍 v3.9.6 ❯ pdm add Git+ssh://[email protected]/pdm-project/pdm.git#egg=pdm
Adding packages to default dependencies: pdm
See /tmp/pdm-lock-1s46lqml.log for detailed debug log.
[InvalidSchema]: No connection adapters were found for 'git+ssh://github.com/pdm-project/pdm.git'
Add '-v' to see the detailed traceback

The same error in the verbose output:

Traceback (most recent call last):
  File "/home/gregdan3/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 185, in main
    return Core().main(args)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 146, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 141, in main
    f(options.project, options)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/commands/add.py", line 51, in handle
    actions.do_add(
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 207, in do_add
    resolved = do_lock(project, strategy, tracked_names, reqs)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 67, in do_lock
    mapping, dependencies, summaries = resolve(
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/core.py", line 50, in resolve
    candidate.hashes = provider.get_hashes(candidate)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/providers.py", line 110, in get_hashes
    return self.repository.get_hashes(candidate)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/repositories.py", line 211, in get_hashes
    return {
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/repositories.py", line 212, in <dictcomp>
    c.link.filename: self._hash_cache.get_hash(c.link)  # type: ignore
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/caches.py", line 95, in get_hash
    hash_value = self._get_file_hash(link).encode()
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/caches.py", line 101, in _get_file_hash
    with open_file(link.url, self.session) as fp:
  File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/home/gregdan3/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/utils.py", line 351, in open_file
    with session.get(url, headers=headers, stream=True) as resp:
  File "/home/gregdan3/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/home/gregdan3/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/network/session.py", line 449, in request
    return super().request(method, url, *args, **kwargs)
  File "/home/gregdan3/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/gregdan3/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 649, in send
    adapter = self.get_adapter(url=request.url)
  File "/home/gregdan3/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 742, in get_adapter
    raise InvalidSchema("No connection adapters were found for {!r}".format(url))
pip._vendor.requests.exceptions.InvalidSchema: No connection adapters were found for 'git+ssh://github.com/pdm-project/pdm.git'

Expected behavior

The original remote dependency specification should be preserved and shown in the error message instead of altered.

Environment Information

Note this is the latest master branch version of pdm, installed via pipx

PDM version:        1.6.5.dev26+g1d68237                  
Python Interpreter: /usr/bin/python (3.9)                 
Project Root:       /home/gregdan3/temp                   
Project Packages:   /home/gregdan3/temp/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.6",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.12.10-arch1-1",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT Thu, 10 Jun 2021 16:34:50 +0000",
  "python_full_version": "3.9.6",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}
@gregdan3 gregdan3 added the 🐛 bug Something isn't working label Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant