micropipenv icon indicating copy to clipboard operation
micropipenv copied to clipboard

Fail to export from poetry with no message

Open Alexander-Serov opened this issue 5 months ago • 4 comments

Describe the bug Export fails with no error message.

To Reproduce Steps to reproduce the behavior:

> micropipenv requirements --method poetry
'url'
> 

When trying to export requirements in my current project, I only get 'url' in return. No error message and no requirements file is produced.

Expected behavior requirements.txt file is created or a clear error message is shown

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

> micropipenv --version
1.6.0

Alexander-Serov avatar Feb 14 '24 15:02 Alexander-Serov

Could you please provide pyproject.toml and poetry.lock or a link to your project so I can try to reproduce the problem you have?

frenzymadness avatar Feb 14 '24 22:02 frenzymadness

Could you please provide pyproject.toml and poetry.lock or a link to your project so I can try to reproduce the problem you have?

Hello, I am attaching the files here. I had to cut out and redact some of the private parts of it, but I hope you will be able to reproduce. Please let me know.

Archive.zip

Alexander-Serov avatar Feb 15 '24 13:02 Alexander-Serov

Thank you. I'm able to reproduce the problem and the truth is that the error message isn't very helpful so we have to do something with that.

The cause of the trouble is in this part:

[[tool.poetry.source]]
name = "source"
url = "***"
priority = "supplemental"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

Micropipenv expects every source to have an URL address, see:

https://github.com/thoth-station/micropipenv/blob/383bb66d770d0523d2249bb9e833ec1c5dae85c2/micropipenv.py#L762-L763

I'm not yet sure whether the poetry config is entirely valid without an url (and therefore the bug is in the false expectation of micropipenv) or not. In the meantime, you can fix the problem just by adding url = "https://pypi.org/pypi/" to the PyPI section.

frenzymadness avatar Feb 16 '24 13:02 frenzymadness

Thanks @frenzymadness ,

Glad to hear there is an easy explanation to the observed behavior. Let me try and put the URL to see if the workaround works for me. A couple of comments in the meantime:

  • the tool.poetry.source was created by poetry itself without a URL, so I would expect it to reproduce in other projects as well
  • I agree, the question of whether the config is valid without a "URL" is interesting, even though poetry created it in my case
  • A random search on Github has pointed me to this 23k-starrs Github repo with the same problem, so I would expect 23k potential 👍 to this issue. 🐛
  • Totally agree that printing a clearer message would have helped me debug the issue faster!

Thanks for having looked into it so fast!

Alexander-Serov avatar Feb 16 '24 15:02 Alexander-Serov