-
-
Notifications
You must be signed in to change notification settings - Fork 628
Open
Description
In commit 809239a
the logic for relative/absolute path detection was reworked, however there seem to be some issues with it.
When running pip compile with pip-compile requirements.in
the following scenarios will cause errors:
- Having a -r with a relative path (
-r ../otherProject/requirements.in
) - Having a -r with an absolute path (
-r
D:\code\otherProject\requirements.in)
Both of these break with the same error:
suffix = file_path.relative_to(pathlib.Path.cwd()).as_posix()
File "C:\Python310\lib\pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
I understand why these specificity changes were necessary to prevent possible ambiguity, however there should be a fallback when the preferred path does not exist vs an error.
Environment Versions
- OS Type: - Win 11
- Python version: Python 3.10.11
- pip version: pip 25.2
- pip-tools version: pip-compile, version 7.5.0
Steps to replicate
Run pip compile with pip-compile requirements.in
with the following scenarios:
- Having a -r with a relative path (
-r ../otherProject/requirements.in
) - Having a -r with an absolute path (
-r
D:\code\otherProject\requirements.in)
Expected result
pip-compile would use the files specified since there were not other options which were more preferred.
Actual result
suffix = file_path.relative_to(pathlib.Path.cwd()).as_posix()
File "C:\Python310\lib\pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
MikeMoore63