wolflu05 / inventree-bulk-plugin

A bulk creation plugin for InvenTree, which helps you generating locations, categories and even parts in bulk by using customized naming strategies and ensure them along your complete storage tree.
MIT License
17 stars 1 forks source link

Consistent naming of plugin #9

Closed wolflu05 closed 1 year ago

wolflu05 commented 1 year ago

[...] I would suggest to rename it to match your repository name so nobody can miss it :smiley:

Originally posted by @eeintech in https://github.com/inventree/InvenTree/discussions/4084#discussioncomment-4470781

wolflu05 commented 1 year ago

@matmair are there any naming conventions of plugin names, repository name, sub folder, plugin slug, plugin name, plugin title, ...? What would you recommend me to name it?

matmair commented 1 year ago

@wolflu05 tbh: no. Plugins are classes so the plugin class should use camel case per pep 8. I name the main module the same as the class but that is not up to pep 8.

I should probably write a bit more about writing plugins, conventions etc. are there any other questions/things that are non obvious?

wolflu05 commented 1 year ago

@matmair I am struggling if

  1. my slug should be: inventree-bulk-plugin or inventree_bulk_plugin
  2. if NAME and TITLE can contain spaces
  3. if my plugin should be named with the inventree prefix as like the built in plugins are named. (Btw. Inventree or InvenTree?) so Inventree bulk plugin.
  4. my sub folder (currently called inventree_bulk) cannot contain - as this is no valid import path?
matmair commented 1 year ago
  1. inventree-bulk-plugin
  2. No and yes (both can but it would be better if name did not)
  3. If you refer to the project or org it should be InvenTree (mostly for word mark recognition as it could be read as a misspelling of Inventory)
  4. folders should generally be named with underscores
wolflu05 commented 1 year ago

@matmair There are even inconsistencies in the built in plugins naming.

  1. They contain spaces as NAME
  2. One is called InvenTree and one Inventree.
  3. Some plugins are named starting with InvenTree, others not image
matmair commented 1 year ago

Viele Köche und so

translation

I'll fix that in a bit. Plugins are currently very much driven by the integration needs/wishes of Oliver and me, with growing usage by the userbase I think we will find more of those oddities and need to fix/clarify them.

wolflu05 commented 1 year ago

@matmair I now choose the following naming (implemented in #20 ), is that matching the "conventions"?

setup.py

    entry_points={
        "inventree_plugins": [
            "InvenTreeBulkPlugin = inventree_bulk_plugin.InvenTreeBulkPlugin:InvenTreeBulkPlugin"
        ]
    },

inventree_bulk_plugin/InvenTreeBulkPlugin.py:

    TITLE = "InvenTree Bulk Plugin"
     SLUG = "inventree-bulk-plugin"
     NAME = "InvenTreeBulkPlugin"
matmair commented 1 year ago

I fixed some of the default names. The sample plugins are only shown when the server is in debug so I left those out