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
[tool.pdm.dev-dependencies]
dev = [
"-e file:///${PROJECT_ROOT}/project-b#egg=project-b",
]
When you then attempt to add as a local package via pdm add ./project-b it fails with:
Adding packages to default dependencies: project-b @ file:///${PROJECT_ROOT}/project-b
pdm.termui: ======== Start resolving requirements ========
pdm.termui: project-b @ file:///${PROJECT_ROOT}/project-b
pdm.termui: -e file:///${PROJECT_ROOT}/project-b#egg=project-b
pdm.termui: python>=3.7
pdm.termui: Adding requirement project-b @ file:///${PROJECT_ROOT}/project-b
pdm.termui: Adding requirement -e file:///${PROJECT_ROOT}/project-b#egg=project-b
pdm.termui: Adding requirement python>=3.7
pdm.termui: ======== Starting round 0 ========
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
pdm.termui: Pinning: project-b 0.0.1
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: Stable pins:
pdm.termui: python None
pdm.termui: project-b file:///${PROJECT_ROOT}/project-b#egg=project-b
🔒 Lock successful
Changes are written to pdm.lock.
Changes are written to pyproject.toml.
Traceback (most recent call last):
File "/Users/maestro/.asdf/installs/python/3.7.13/bin/pdm", line 8, in <module>
sys.exit(main())
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/core.py", line 254, in main
return Core().main(args)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/core.py", line 187, in main
raise cast(Exception, err).with_traceback(traceback)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/core.py", line 182, in main
f(options.project, options)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/cli/commands/add.py", line 72, in handle
hooks=HookManager(project, options.skip),
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/cli/actions.py", line 301, in do_add
hooks=hooks,
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/cli/actions.py", line 203, in do_sync
candidates = resolve_candidates_from_lockfile(project, requirements)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/cli/actions.py", line 150, in resolve_candidates_from_lockfile
resolve_max_rounds,
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/resolver/core.py", line 30, in resolve
result = resolver.resolve(requirements, max_rounds)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/resolvelib/resolvers.py", line 373, in resolve
failure_causes = self._attempt_to_pin_criterion(name)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
criteria = self._get_updated_criteria(candidate)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/resolvelib/resolvers.py", line 203, in _get_updated_criteria
for requirement in self._p.get_dependencies(candidate=candidate):
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/resolver/providers.py", line 180, in get_dependencies
deps, requires_python, _ = self.repository.get_dependencies(candidate)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/models/repositories.py", line 426, in get_dependencies
reqs, python, summary = super().get_dependencies(candidate)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/models/repositories.py", line 70, in get_dependencies
requirements, requires_python, summary = getter(candidate)
File "/Users/maestro/.asdf/installs/python/3.7.13/lib/python3.7/site-packages/pdm/models/repositories.py", line 418, in _get_dependencies_from_lockfile
return self.candidate_info[self._identify_candidate(candidate)]
KeyError: ('project-b', None, 'file:///${PROJECT_ROOT}/project-b', False)
Expected behavior
It would be nice if pdm would understand that the project has both a local and editable package of the same name, and dedupe the dependencies to avoid the key error. Perhaps locally installed packages on the file system could be treated as editable installs by default?
The text was updated successfully, but these errors were encountered:
It also appears that pdm install will not allow you to switch between dependency groups without attempting to resolve all of them first. In general, it doesn't seem like pdm was designed to support local+editable+remote installs of the same package. Is this working as intended, or something pdm might support in the future?
It seems that pdm is unable to manage dependencies installed as an editable and local package.
Given the following project structure:
And a
pyproject.toml
for project-a:When you then attempt to add as a local package via
pdm add ./project-b
it fails with:Expected behavior
It would be nice if pdm would understand that the project has both a local and editable package of the same name, and dedupe the dependencies to avoid the key error. Perhaps locally installed packages on the file system could be treated as editable installs by default?
The text was updated successfully, but these errors were encountered: