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

Improve PDM plugin development support: PDM breaks entirely if developed plug-in cannot be loaded #878

Closed
carstencodes opened this issue Feb 1, 2022 · 5 comments
Labels
⭐ enhancement Improvements for existing features

Comments

@carstencodes
Copy link

PDM plugins are not available if currently developed

Creating a plug-in is frustrating. My current workflow is as follows:

  1. Increment local or development version according to PEP440
  2. Create wheel
  3. Install wheel in user space (pip install --upgrade --user), which might break other repositories.
  4. Test the new and old functionality.

Add PDM development support

When running PDM inside the project, it is clear, that the current project is not searched for entry points. The idea is to create a (local) configuration value to enable PDM to search the current project for entry points, since the current project will be installed as editable package.

I suggest the creation of a command like

$ pdm config plugin.development 1

or similar to make PDM (locally) aware, that there is a plugin to search for.

What do you think of the idea? Is there anything I should do better/else when creating a plug-in?

@carstencodes carstencodes added the ⭐ enhancement Improvements for existing features label Feb 1, 2022
@xanterx
Copy link
Contributor

xanterx commented Feb 1, 2022

I would also like to add my time spent, while working with pdm plugin like pdm-venv I faced few issues like #872 While trying resolving it I faced a problem of not able to figure out a way to identify what all configurations are updated (new or overridden) by that plugin. Thus, while removing a plugin config clean-up was hard. I thought if the plugin API also holds something as source which will be updated during add_config, we could remove/reset the modified configurations by the plugins.
Although, handling same overridden config by multiple plugins is another thing to consider.

@frostming
Copy link
Collaborator

@carstencodes
Copy link
Author

I'll check that later. The last time I tried, my plugin was not listed running the pdm Command...

@carstencodes
Copy link
Author

Ok, I have tried.

You are right, the plugin is found, but it breaks pdm entirely, if the entrypoint is wrong.

$ pdm install
...
$ pdm
Traceback (most recent call last):
  File "/home/developer/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/developer/dev/pdm/plugins/pdm-bump/__pypackages__/3.9/lib/pdm/core.py", line 219, in main
    return Core().main(args)
  File "/home/developer/dev/pdm/plugins/pdm-bump/__pypackages__/3.9/lib/pdm/core.py", line 134, in main
    self.load_plugins()
  File "/home/developer/dev/pdm/plugins/pdm-bump/__pypackages__/3.9/lib/pdm/core.py", line 214, in load_plugins
    plugin.load()(self)
  File "/home/developer/miniconda3/lib/python3.9/importlib/metadata.py", line 79, in load
    return functools.reduce(getattr, attrs, module)
ModuleNotFoundError: No module named 'pdm_bump.cli'

I also had an invalid package installed in my conda environment. But its no good, that PDM breaks, if it cannot load a plug-in. This really hard to debug / check.

@carstencodes carstencodes changed the title PDM plugin development support Improve PDM plugin development support: PDM breaks entirely if developend plug-in cannot be loaded Feb 2, 2022
@carstencodes carstencodes changed the title Improve PDM plugin development support: PDM breaks entirely if developend plug-in cannot be loaded Improve PDM plugin development support: PDM breaks entirely if developed plug-in cannot be loaded Feb 2, 2022
@carstencodes
Copy link
Author

Awesome, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

3 participants