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 for local, per-project plugins #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zimLeTux
Copy link

@zimLeTux zimLeTux commented Sep 20, 2022

Edit: I am currently reworking this as I have realized this relies on a dist-info present in the working directory, which is not the wanted behaviour at all !

This small change allow to have custom converters in a given project.
It is more like a proof of concept and should probably be reworked/cleaned up.
Project plugins should be located in a "plugins" directory.

Current limitations:

  • the plugin class name must be the same name as the file, but starting with a capital letter ;
  • plugins can only be located in the plugins subdirectory, and nested subdirs are not yet possible ;

Some use-cases:

  • Have a tool to create NPC (both mesh and in-game properties, or even scripts) and export them automatically ;
  • Mesh generation based on parametric files ;
  • Conversion of table-based data (for instance an ODS table listing all the items or monsters) to a more game-friendly format (XML, json, SQLite...)
  • ...

@zimLeTux
Copy link
Author

Rework is complete!

The limitation on the filename/classname is removed: as long as the file is in the plugins directory and contains a class whose name ends with "Plugin", it is available.
Maybe the name of the plugins directory should be configured in the .pman file?

@Moguri
Copy link
Owner

Moguri commented Sep 21, 2022

Why not have the project register entrypoints for its custom plugins in its setup.py (or equivalent)? This should work with something like:
pip install -e .

@zimLeTux
Copy link
Author

It is actually (almost) what I did in the first version, but it requires the user to re-run pip each time they add a new plugin (which might not be a real problem).
I can reimplement this behaviour, but as a user I think it is better to just set a directory where plugins are located and have your plugins "just work".

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

Successfully merging this pull request may close these issues.

2 participants