Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] Transform Link back into Path inside FileDependency #225

Conversation

rsayn
Copy link

@rsayn rsayn commented Oct 28, 2021

Resolves: python-poetry/poetry#4541 (& related issues)

Context

Whenever I try installing dependencies with poetry-core 1.0.7, I run into an AttributeError since a Link object is passed to FileDependency instead of a Path object.

I saw that the code that initializes the class in Poetry performs a cast, but for some reason this cast is not working on my local machine. The fix I performed directly inside the FileDependency class is the only thing that made Poetry work consistently on my machine.

I tried running every Poetry version in the range 1.1.6 -> 1.1.11, without success.

My local machine is a MacOS, not sure if this is the cause since I saw lots of issues about this behaviour in the Poetry repo.

Checklist

  • Added tests for changed code.
  • Updated documentation for changed code.

@radoering
Copy link
Member

The cast has been introduced with poetry 1.1.9. If you check the source of poetry 1.1.8, you can see that there is no cast in this version. I can't imagine how a Link object could be passed to FileDependency in poetry 1.1.9 and above with the cast. Maybe, you have experienced another issue with 1.1.9 to 1.1.11?

In 1.1.12, there has been another fix considering this part of the code. This was primarily for Windows, but you may want to check if 1.1.12 fixes your issue, too.

@rsayn
Copy link
Author

rsayn commented Jan 22, 2022

@radoering I can confirm this still happens with Poetry 1.1.12, this time on a Windows 10 machine on which I had not applied the fix I listed in my first comment

@radoering
Copy link
Member

At the moment, I can only imagine that your poetry installation has been corrupted somehow.

Maybe you can check, if the following files look like the tagged versions for poetry 1.1.12 resp. poetry-core 1.0.7: When looking into poetry/installation/executor.py#L615-L624 you should see that url_to_path(archive.url) is called if archive is a Link. And when looking into poetry/core/packages/utils/utils.py#L67-L90 you should see that a Path object is returned by url_to_path. If the issue occurs even if both files seem to be ok, probably some debugging is required.

I would appreciate it if you could find out more. I think we need more information on the root cause of the issue.

@rsayn rsayn closed this Jun 16, 2022
@rsayn rsayn deleted the hotfix-erroneous-link-passed-in-file-dependency branch June 16, 2022 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants