Some plugins rely on settings which should not necessarily be part of the pyproject.toml, e.g. pypi-mirror (ref. #5958).
Currently settings cannot be configured using poetry config, because they do not exist (in the hardcoded list of settings).
There should be an interface to define plugin settings with default values and read them at runtime. Users should be able to configure these using poetry config.
They might be scoped to plugins.[plugin_name].[setting_key], where plugin_name is the name of the plugin package or poetry.(application.)plugin entrypoint.
Maybe they can be defined and read with something like this:
class SettingsPlugin(Plugin):
def activate(self, poetry: Poetry, io: IO):
self.config = poetry.config.register_plugin(self)
#...
self.config.define_setting("KEY", DEFAULT, validator, normalizer)
#...
value = self.config.get("KEY")
Impact
Providing this capability enables the use of machine/user global plugin settings (e.g. a private PyPi mirror with poetry-plugin-pypi-mirror) with a "native" configuration interface (poetry config).
Workarounds
Plugin settings can be manually added to the relevant config files poetry.toml or the users config.toml.
Validation of entered values has to be handled by each plugin, normalization must be done manually by the user.
Issue Kind
Brand new capability
Description
Some plugins rely on settings which should not necessarily be part of the pyproject.toml, e.g. pypi-mirror (ref. #5958).
Currently settings cannot be configured using
poetry config
, because they do not exist (in the hardcoded list of settings).There should be an interface to define plugin settings with default values and read them at runtime. Users should be able to configure these using
poetry config
.They might be scoped to
plugins.[plugin_name].[setting_key]
, whereplugin_name
is the name of the plugin package orpoetry.(application.)plugin
entrypoint.Maybe they can be defined and read with something like this:
Impact
Providing this capability enables the use of machine/user global plugin settings (e.g. a private PyPi mirror with poetry-plugin-pypi-mirror) with a "native" configuration interface (
poetry config
).Workarounds
Plugin settings can be manually added to the relevant config files
poetry.toml
or the usersconfig.toml
. Validation of entered values has to be handled by each plugin, normalization must be done manually by the user.