python-poetry / python-poetry/poetry
application plugin build error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: Poetry (version 1.4.0)
- Python version: Python 3.10.6
- OS version and name: macOS 12.6
- pyproject.toml: https://github.com/Rusteam/poetry-check-existing-plugin/blob/main/pyproject.toml
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
When I try to poetry build my application plugin i get the following error:
CheckExistingPlugin.activate() takes 2 positional arguments but 3 were given
at ~/opt/miniconda3/envs/poetry_env/lib/python3.10/site-packages/poetry/plugins/plugin_manager.py:71 in activate
67│ self._plugins.append(plugin)
68│
69│ def activate(self, *args: Any, **kwargs: Any) -> None:
70│ for plugin in self._plugins:
→ 71│ plugin.activate(*args, **kwargs)
72│
73│ def _load_plugin_entry_point(self, ep: metadata.EntryPoint) -> None:
74│ logger.debug("Loading the %s plugin", ep.name) # type: ignore[attr-defined]
75│
When inspecting the source code, I see that PluginManager.activate is called with poetry and io as args in ./poetry/factory.py:
plugin_manager = PluginManager(Plugin.group, disable_plugins=disable_plugins)
plugin_manager.load_plugins()
poetry.set_plugin_manager(plugin_manager)
plugin_manager.activate(poetry, io)
while the application plugin docs clearly say there's only one argument to ApplicationPlugin.activate:
class MyApplicationPlugin(ApplicationPlugin):
def activate(self, application):
application.command_loader.register_factory("my-command", factory)
which is bound to raise an exception, isn't it?
Is there an inconsistency then, or am I doing something wrong?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with poetry/factory.py and poetry/plugins/plugin_manager.py, then compare the ApplicationPlugin documentation with the reported CheckExistingPlugin.activate signature. Reproduce the failure using the linked pyproject.toml and poetry build; done means the documented application plugin interface and the activation call agree without raising the argument-count error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100