Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow plugins to define settings #9695

Open
fpottbaecker opened this issue Sep 20, 2024 · 1 comment
Open

Allow plugins to define settings #9695

fpottbaecker opened this issue Sep 20, 2024 · 1 comment
Labels
area/plugin-api Related to plugins/plugin API kind/feature Feature requests/implementations

Comments

@fpottbaecker
Copy link

fpottbaecker commented Sep 20, 2024

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], 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.

@fpottbaecker fpottbaecker added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Sep 20, 2024
@Secrus
Copy link
Member

Secrus commented Sep 20, 2024

This is on the roadmap for the plugin API.

@Secrus Secrus added area/plugin-api Related to plugins/plugin API and removed status/triage This issue needs to be triaged labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin-api Related to plugins/plugin API kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

2 participants