python-poetry / python-poetry/poetry
Allow plugins to define settings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
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.
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 by tracing the existing poetry config command and the plugin activate entry point described in the issue. Review how poetry.config currently stores and reads settings, then determine the interface needed for plugin-defined defaults, validation, normalization, and runtime access. Done means plugins can register settings and users can configure them through poetry config.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100