thoth-station / micropipenv

A lightweight wrapper for pip to support requirements.txt, Pipenv and Poetry lock files or converting them to pip-tools compatible output. Designed for containerized Python applications but not limited to them.
https://pypi.org/project/micropipenv/
GNU Lesser General Public License v3.0
231 stars 25 forks source link

Fail to export from poetry with no message #292

Open Alexander-Serov opened 4 months ago

Alexander-Serov commented 4 months ago

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
frenzymadness commented 4 months ago

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?

Alexander-Serov commented 4 months ago

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

frenzymadness commented 4 months ago

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.

Alexander-Serov commented 4 months ago

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:

Thanks for having looked into it so fast!