poetry-plugin-export icon indicating copy to clipboard operation
poetry-plugin-export copied to clipboard

Export to requirements.txt omits extra-index flags for non-default sources

Open mrogaski opened this issue 5 years ago • 3 comments

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Microsoft Windows 7
  • Poetry version: 1.0.5
  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/mrogaski/72ac083fb3a1652c176d778062571db8

Issue

If I have multiple sources defined in pyproject.toml, with one marked as default to disable accesses to the public PyPI, the export command adds and index-url flag for the default but does not add extra-index for the other sources.

mrogaski avatar Mar 03 '20 13:03 mrogaski

The relevant code is below

Index builder:

https://github.com/python-poetry/poetry/blob/6cd3645d889f47c10425961661b8193b23f0ed79/poetry/utils/exporter.py#L107-L111

Output:

https://github.com/python-poetry/poetry/blob/6cd3645d889f47c10425961661b8193b23f0ed79/poetry/utils/exporter.py#L136-L164

Haven't had time to dig in yet, but there's definitely something bugged about the implementation as I also don't get any --extra-index-url in my exports with a similar structure.

Halkcyon avatar May 22 '20 00:05 Halkcyon

It looks like this is the intended behavior. The only way to disable public PyPI is to set an alternate source to default, but that causes any other alternate sources to be ignored. So you can either use multiple repositories or exclude pypi.org, but not both.

I think this is problematic behavior, specifically if you are using a PyPI mirror along with private repos.

I'll close this bug report out as it works as designed, but I'll likely submit a proposal for enhancements and/or changes to the repository selection behavior separately.

mrogaski avatar Jul 11 '20 18:07 mrogaski

I did some more experimentation and it looks like the behavior of default within poetry behaves as the name would suggest, and differs from the export behavior. So I'm reopening this.

mrogaski avatar Jul 12 '20 02:07 mrogaski