Poetry 1.1.0a2 Breaks Support for File Dependencies on Networked Drives
See original GitHub issue-
I am on the latest {*pre-release} Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option). -
OS version and name:
Win10 1909
-
Poetry version:
1.1.0a2
-
Link of a Gist with the contents of your pyproject.toml file:
See example toml snippet at bottom
Issue
Poetry 1.1.0a2
attempts to determine the relative path to a file dependency, but this fails (os.path.relpath
raises a ValueError) if the dependency is not on the same drive. In my use case, we deploy wheel/tar files to a folder on a networked drive (\\company.com\dfsroot\etc...
) so that the files are accessible to all internal users.
Poetry 1.1.0a1
does not have this issue, so I have downgraded to 1.1.0a1 for now
Logs
poetry update -vvv
Using virtualenv: C:\Users\me\project_b\.venv
Updating dependencies
Resolving dependencies...
1: fact: project_b is 0.0.0
1: derived: project_b
1: fact: project_b depends on project_a (0.1.1 \\company.com\dfsroot\project_a-0.1.1-py3-none-any.whl)
1: selecting project_b (0.0.0)
1: derived: project_a (0.1.1 \\company.com\dfsroot\project_a-0.1.1-py3-none-any.whl)
1: Version solving took 0.540 seconds.
1: Tried 1 solutions.
Stack trace:
13 ~\.poetry\lib\poetry\_vendor\py3.7\clikit\console_application.py:131 in run
129β parsed_args = resolved_command.args
130β
β 131β status_code = command.handle(parsed_args, io)
132β except KeyboardInterrupt:
133β status_code = 1
12 ~\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py:120 in handle
118β def handle(self, args, io): # type: (Args, IO) -> int
119β try:
β 120β status_code = self._do_handle(args, io)
121β except KeyboardInterrupt:
122β if io.is_debug():
11 ~\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py:171 in _do_handle
169β handler_method = self._config.handler_method
170β
β 171β return getattr(handler, handler_method)(args, io, self)
172β
173β def __repr__(self): # type: () -> str
10 ~\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\command.py:92 in wrap_handle
90β self._command = command
91β
β 92β return self.handle()
93β
94β def handle(self): # type: () -> Optional[int]
9 ~\.poetry\lib\poetry\console\commands\update.py:49 in handle
47β installer.update(True)
48β
β 49β return installer.run()
50β
8 ~\.poetry\lib\poetry\installation\installer.py:74 in run
72β
73β local_repo = Repository()
β 74β self._do_install(local_repo)
75β
76β return 0
7 ~\.poetry\lib\poetry\installation\installer.py:170 in _do_install
168β )
169β
β 170β ops = solver.solve(use_latest=self._whitelist)
171β else:
172β self._io.write_line("Installing dependencies from lock file")
6 ~\.poetry\lib\poetry\puzzle\solver.py:59 in solve
57β with self._provider.progress():
58β start = time.time()
β 59β packages, depths = self._solve(use_latest=use_latest)
60β end = time.time()
61β
5 ~\.poetry\lib\poetry\puzzle\solver.py:213 in _solve
211β try:
212β result = resolve_version(
β 213β self._package, self._provider, locked=locked, use_latest=use_latest
214β )
215β
4 ~\.poetry\lib\poetry\mixology\__init__.py:7 in resolve_version
5β solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
6β
β 7β return solver.solve()
8β
3 ~\.poetry\lib\poetry\mixology\version_solver.py:84 in solve
82β while next is not None:
83β self._propagate(next)
β 84β next = self._choose_package_version()
85β
86β return self._result()
2 ~\.poetry\lib\poetry\mixology\version_solver.py:392 in _choose_package_version
390β return dependency.name
391β
β 392β version = self._provider.complete_package(version)
393β
394β conflict = False
1 ~\.poetry\lib\poetry\puzzle\provider.py:685 in complete_package
683β relative_path = Path(
684β os.path.relpath(
β 685β dep.full_path.as_posix(), package.root_dir.as_posix()
686β )
687β )
ValueError
path is on mount '\\\\company.com\\dfsroot', start on mount 'C:'
at ~\AppData\Local\Continuum\anaconda3\lib\ntpath.py:562 in relpath
558β start_drive, start_rest = splitdrive(start_abs)
559β path_drive, path_rest = splitdrive(path_abs)
560β if normcase(start_drive) != normcase(path_drive):
561β raise ValueError("path is on mount %r, start on mount %r" % (
β 562β path_drive, start_drive))
563β
564β start_list = [x for x in start_rest.split(sep) if x]
565β path_list = [x for x in path_rest.split(sep) if x]
566β # Work out how much of the filepath is shared by start and path.
Example TOML
[build-system]
requires = ["poetry>=1.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "project_b"
version = "0.0.0"
description = "Example toml with DFS-linked wheel file"
authors = [""]
[tool.poetry.dependencies]
python = "^3.7"
[tool.poetry.dev-dependencies.project_a]
path = "\\\\company.com\\dfsroot\\project_a-0.1.1-py3-none-any.whl"
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Hmm, thanks for the details @KyleKing much appreciated. It might be better to handle this as a file dependency (as you originally did) I reckon. I forgot that poetry handles file uriβs as file dependnecies as opposed to url dependency, so my original recommendation is moot
As for the the issue itself, I think adding an βis absoluteβ test might work. Assuming that
pathlib
correcly recognises the mount path as an absolute path. Would be great if you can test that solution in your environment. I do not readily have access to a viable environment to test this.Regarding the URI, you are correct that
file:////company.com/dfsroot/project_a-0.1.1-py3-none-any.whl
is what would be expected. For testing this you can just dopoetry run pip install -U pip
in your current venv before trying, or recreate the venv sincepoetry-1.1.0b1
now usesvirtualenv
to create a new environment withpip-20.x
.Still an issue, but not worth nudging maintainers until reviewed