python-poetry / poetry-plugin-export

Poetry plugin to export the dependencies to various formats
MIT License
249 stars 54 forks source link

verbose options passed as tuple rather than str #110

Open abdulkhanbv opened 2 years ago

abdulkhanbv commented 2 years ago

https://github.com/python-poetry/poetry-plugin-export/blob/f8cbb9c7ae0586759f8bfe95f32268812a4f6eec/src/poetry_plugin_export/command.py#L67

Errors out with

TypeError sequence item 0: expected str instance, tuple found at /usr/local/lib/python3.9/site-packages/poetry_plugin_export/command.py:73 in handle

The setting of verbose option arguments in options array joined to add to the lock file has an extra set of parentheses that causes the intended default null value to be combined with the argument into a tuple.

dimbleby commented 2 years ago

Ha, there's even a warning from mypy about this that someone has explicitly ignored...

I expect an MR would be welcome.

david-nano commented 8 months ago

Same here: (poetry 1.7.1)

$ poetry export --verbose
Warning: In a future version of Poetry, PyPI will be disabled automatically if at least one custom primary source is configured. In order to avoid a breaking change and make your pyproject.toml forward compatible, add PyPI explicitly via 'poetry source add pypi'. By the way, this has the advantage that you can set the priority of PyPI as with any other source.
Warning: poetry-plugin-export will not be installed by default in a future version of Poetry.
In order to avoid a breaking change and make your automation forward-compatible, please install poetry-plugin-export explicitly. See https://python-poetry.org/docs/plugins/#using-plugins for details on how to install a plugin.
To disable this warning run 'poetry config warnings.export false'.
The lock file does not exist. Locking.

  TypeError

  sequence item 0: expected str instance, tuple found

  at /usr/local/lib/python3.8/site-packages/poetry_plugin_export/command.py:84 in handle
       80│                 options.append(("-vv", None))
       81│             elif self.io.is_verbose():
       82│                 options.append(("-v", None))
       83│ 
    →  84│             self.call("lock", " ".join(options))  # type: ignore[arg-type]
       85│ 
       86│         if not locker.is_fresh():
       87│             self.line_error(
       88│                 ""