Repository navigation
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new
_path_to_file_urlhelper assumespackage.source_urlis always a filesystem path; if thereâs any chance it might be afile://URI or another scheme, consider either normalizing/handling those cases or adding a clear assertion/comment so future callers donât accidentally pass non-path strings.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `_path_to_file_url` helper assumes `package.source_url` is always a filesystem path; if thereâs any chance it might be a `file://` URI or another scheme, consider either normalizing/handling those cases or adding a clear assertion/comment so future callers donât accidentally pass non-path strings.
## Individual Comments
### Comment 1
<location path="tests/installation/test_executor.py" line_range="952-961" />
<code_context>
assert not prepare_spy.spy_return.exists(), "archive not cleaned up"
+def test_executor_should_create_pep610_url_reference_for_relative_directory(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ source = tmp_path / "source"
+ source.mkdir()
+ monkeypatch.chdir(tmp_path)
+
+ package = Package("demo", "0.1.2", source_type="directory", source_url="source")
+
+ executor = object.__new__(Executor)
+
+ assert executor._create_directory_url_reference(package) == {
+ "dir_info": {},
+ "url": source.as_uri(),
+ }
+
</code_context>
<issue_to_address>
**suggestion (testing):** Add a companion test for relative file sources to cover `_create_file_url_reference` and the common `_path_to_file_url` helper.
This regression test covers the relative directory case. Since `_path_to_file_url` is also used by `_create_file_url_reference` for `source_type="file"`, please add a similar test for a relative file path (e.g. a temp file under `tmp_path`, using `_create_file_url_reference` with a relative `source_url`, and asserting the resulting `"url"` matches `file_path.as_uri()`) so both call sites are exercised.
</issue_to_address>Help me be more useful! Please click ð or ð on each comment and I'll use the feedback to improve your reviews.
puneetdixit200
force-pushed
the
fix/10830-directory-url-reference
branch
from
May 23, 2026 15:05
64600a0 to
5d5dc6a
Compare
Contributor
Author
|
Pushed Verified:
|
puneetdixit200
force-pushed
the
fix/10830-directory-url-reference
branch
from
May 24, 2026 15:01
5d5dc6a to
ccf2480
Compare
Contributor
Author
|
Rebased again on current Verified locally:
|
puneetdixit200
force-pushed
the
fix/10830-directory-url-reference
branch
from
May 28, 2026 17:03
52af34e to
d534920
Compare
Contributor
Author
|
Rebased onto current New head: Verified locally:
|
puneetdixit200
force-pushed
the
fix/10830-directory-url-reference
branch
from
June 2, 2026 23:17
d534920 to
dab6f7a
Compare
radoering
force-pushed
the
fix/10830-directory-url-reference
branch
from
June 20, 2026 10:57
dab6f7a to
e0e87af
Compare
radoering
approved these changes
Jun 20, 2026
radoering
enabled auto-merge (squash)
June 20, 2026 11:23
ð Knowledge reviewâïļ Documentation updates1 page was updated by changes in this PR.
ð CHANGELOG â changes@@ -9,6 +9,7 @@
### Fixed
- Fix an issue where `poetry update <package>` failed when `<package>` was a transitive dependency ([#10885](https://github.com/python-poetry/poetry/pull/10885)).
+- Fix an issue where Poetry raised an error when writing PEP 610 `direct_url.json` metadata for local directory or file sources with relative paths ([#10830](https://github.com/python-poetry/poetry/issues/10830), [#10917](https://github.com/python-poetry/poetry/pull/10917)).
## [2.4.0] - 2026-05-03 |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #10830
When Poetry writes PEP 610
direct_url.jsonmetadata for local directory or file sources, it now resolves relative source paths before converting them to file URIs. This avoidsPath.as_uri()raising for relative paths such as repositories cloned under a relative virtualenvs path.Added a regression test for relative directory source URLs and kept the existing file/directory direct-url behavior covered.