bavaza
bavaza

Reputation: 11037

Conflicting names in Python namespace plugins

I'm following the plugins packaging guide, using the 'namespace packages' approach. I've written two plugins, with the following structure:

plugin_1
├── pyproject.toml
├── setup.py
└── myapp
    └── plugins
        └── plugin_1.py

plugin_2
├── pyproject.toml
├── setup.py
└── myapp
    └── plugins
        └── plugin_2.py

This works as long the the actual plugins file names are different - pip copies both files (plugin_1.py, plugin_2.py) to venv\Lib\site-packages\myapp\plugins\, where they live side-by-side.

However, if the file names are identical, pip will happily overwrite the first plugin which was installed. Since I do not have control over plugin writers, this could lead to serious problems.

Is there a way to mitigate this, or at least make pip fail in such cases?

Upvotes: 1

Views: 106

Answers (0)

Related Questions