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

Domain parsing error when adding package from git+ssh #3304

Open
1 task
BeautyyuYanli opened this issue Nov 21, 2024 · 2 comments
Open
1 task

Domain parsing error when adding package from git+ssh #3304

BeautyyuYanli opened this issue Nov 21, 2024 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@BeautyyuYanli
Copy link

BeautyyuYanli commented Nov 21, 2024

Describe the bug

Run command:

pdm add "git+ssh://[email protected]:pdm-project/pdm.git"

Output:

Adding packages to default dependencies: git+ssh://[email protected]:pdm-project/pdm.git
⠙ 0:00:00 Resolve for environment (==3.9.*) None
See /home/yanli.yu/.local/state/pdm/log/pdm-lock-vhu5sgik.log for detailed debug log.
[UnpackError]: ssh: Could not resolve hostname github.com:pdm-project: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

WARNING: Add '-v' to see the detailed traceback

Workaround:

pdm add "git+ssh://[email protected]/pdm-project/pdm.git"

Seems like pdm (or its dependency?) cannot parse the :username after github.com

To reproduce

As previous

Expected Behavior

As previous

Environment Information

PDM version:
  2.20.1
Python Interpreter:
  /home/yanli.yu/test/.venv/bin/python (3.9)
Project Root:
  /home/yanli.yu/test
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.8",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.0-112-generic",
  "platform_system": "Linux",
  "platform_version": "#122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024",
  "python_full_version": "3.9.20",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}

pdm -v output

Adding packages to default dependencies: git+ssh://[email protected]:pdm-project/pdm.git
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   pdm @ git+ssh://[email protected]/pdm-project/pdm.git
pdm.termui:   git+ssh://[email protected]:pdm-project/pdm.git
pdm.termui:   Adding requirement python==3.9.*
pdm.termui:   Adding requirement pdm @ git+ssh://[email protected]/pdm-project/pdm.git
pdm.termui:   Adding requirement git+ssh://[email protected]:pdm-project/pdm.git
unearth.vcs.git: Cloning ssh://***@github.com:pdm-project/pdm.git to /tmp/pdm-build-v73s8e7j
Traceback (most recent call last):
  File "/opt/Anaconda3/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/core.py", line 379, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/core.py", line 267, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/core.py", line 262, in main
    self.handle(project, options)
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/core.py", line 194, in handle
    command.handle(project, options)
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/cli/commands/add.py", line 71, in handle
    self.do_add(
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/cli/commands/add.py", line 155, in do_add
    resolved = do_lock(
               ^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/cli/actions.py", line 133, in do_lock
    resolved, collected_groups = resolver.resolve()
                                 ^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/resolver/resolvelib.py", line 51, in resolve
    mapping = self._do_resolve()
              ^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/resolver/resolvelib.py", line 89, in _do_resolve
    result = resolver.resolve(requirements, max_rounds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/resolvelib/resolvers/resolution.py", line 515, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/resolvelib/resolvers/resolution.py", line 388, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/opt/Anaconda3/lib/python3.11/site-packages/resolvelib/resolvers/resolution.py", line 141, in _add_to_criteria
    if not criterion.candidates:
  File "/opt/Anaconda3/lib/python3.11/site-packages/resolvelib/structs.py", line 169, in __bool__
    next(iter(self))
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/resolver/providers.py", line 350, in matches_gen
    yield from super_find()
               ^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/resolver/providers.py", line 221, in matches_gen
    candidates = self._find_candidates(reqs[0])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/resolver/providers.py", line 172, in _find_candidates
    can.prepare(self.repository.environment).metadata
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/models/candidates.py", line 603, in metadata
    result = self.prepare_metadata()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/models/candidates.py", line 494, in prepare_metadata
    self._unpack(validate_hashes=False)
  File "/opt/Anaconda3/lib/python3.11/site-packages/pdm/models/candidates.py", line 465, in _unpack
    result = finder.download_and_unpack(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/unearth/finder.py", line 441, in download_and_unpack
    file = unpack_link(
           ^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/unearth/preparer.py", line 322, in unpack_link
    backend.fetch(link, location)
  File "/opt/Anaconda3/lib/python3.11/site-packages/unearth/vcs/base.py", line 152, in fetch
    return self.fetch_new(location, url, rev, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Anaconda3/lib/python3.11/site-packages/unearth/vcs/git.py", line 50, in fetch_new
    self.run_command(
  File "/opt/Anaconda3/lib/python3.11/site-packages/unearth/vcs/base.py", line 78, in run_command
    raise UnpackError(e.output) from None
unearth.errors.UnpackError: Cloning into '/tmp/pdm-build-v73s8e7j'...
ssh: Could not resolve hostname github.com:pdm-project: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.
@BeautyyuYanli BeautyyuYanli added the 🐛 bug Something isn't working label Nov 21, 2024
@frostming
Copy link
Collaborator

git+ssh://[email protected]/pdm-project/pdm.git
[email protected]:pdm-project/pdm.git
git+ssh://[email protected]:pdm-project/pdm.git

@BeautyyuYanli
Copy link
Author

Maybe add it to the doc?

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

2 participants