poetry env info
doesn't work if pyproject.toml
contains path dependency to non existing local directory
#7277
Closed
4 tasks done
Labels
status/duplicate
Duplicate issues
pyproject.toml
-vvv
option) and have included the output below.Issue
pyproject.toml
references a dependency with a relative path and the referenced directory has been removed (or renamed).Now, running
poetry env info
results in error:Directory ... does not exist
.Reproduce with:
It should not be necessary to resolve dependencies just to get the environment info.
Output of
```log Stack trace:poetry -vvv env info -p"
15 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
14 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
13 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
12 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
11 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
455│
456│ if command_event.command_should_run():
→ 457│ exit_code = command.run(io)
458│ else:
459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
10 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/base_command.py:119 in run
117│ io.input.validate()
118│
→ 119│ status_code = self.execute(io)
120│
121│ if status_code is None:
9 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/command.py:62 in execute
60│
61│ try:
→ 62│ return self.handle()
63│ except KeyboardInterrupt:
64│ return 1
8 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/env/info.py:23 in handle
21│ from poetry.utils.env import EnvManager
22│
→ 23│ env = EnvManager(self.poetry).get()
24│
25│ if self.option("path"):
7 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/command.py:23 in poetry
21│ def poetry(self) -> Poetry:
22│ if self._poetry is None:
→ 23│ return self.get_application().poetry
24│
25│ return self._poetry
6 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/application.py:129 in poetry
127│ project_path = self._io.input.option("directory")
128│
→ 129│ self._poetry = Factory().create_poetry(
130│ cwd=project_path,
131│ io=self._io,
5 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/factory.py:55 in create_poetry
53│ io = NullIO()
54│
→ 55│ base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
56│
57│ locker = Locker(
4 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/core/factory.py:65 in create_poetry
63│ assert isinstance(version, str)
64│ package = self.get_package(name, version)
→ 65│ package = self.configure_package(
66│ package, local_config, poetry_file.parent, with_groups=with_groups
67│ )
3 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/core/factory.py:159 in configure_package
157│
158│ if "dependencies" in config:
→ 159│ cls._add_package_group_dependencies(
160│ package=package, group=MAIN_GROUP, dependencies=config["dependencies"]
161│ )
2 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/core/factory.py:105 in _add_package_group_dependencies
103│
104│ group.add_dependency(
→ 105│ cls.create_dependency(
106│ name,
107│ _constraint,
1 ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/core/factory.py:317 in create_dependency
315│ )
316│ else:
→ 317│ dependency = DirectoryDependency(
318│ name,
319│ path,
ValueError
Directory ../prj1 does not exist
at ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/core/packages/directory_dependency.py:38 in init
34│
35│ self._develop = develop
36│
37│ if not self._full_path.exists():
→ 38│ raise ValueError(f"Directory {self._path} does not exist")
39│
40│ if self._full_path.is_file():
41│ raise ValueError(f"{self._path} is a file, expected a directory")
42│
The text was updated successfully, but these errors were encountered: