Skip to content

Fix for Plugin Import Path Issue

Issue Description

There was an issue with the import path for the CrudToolsModule in the crud_tools plugin. The entry point in the package metadata specified the import path as fastpluggy_plugin.crud_tools.plugin:CrudToolsModule, but in the source code, the file was at fastpluggy_plugin/crud_tools/src/plugin.py. This caused the following import to fail:

import fastpluggy_plugin.crud_tools.plugin

While this import worked:

import fastpluggy_plugin.crud_tools.src.plugin

Solution

A new plugin.py file was created in the fastpluggy_plugin/crud_tools directory that imports and re-exports the CrudToolsModule from fastpluggy_plugin.crud_tools.src.plugin. This allows both import paths to work:

  • import fastpluggy_plugin.crud_tools.plugin (the expected path after installation)
  • import fastpluggy_plugin.crud_tools.src.plugin (the path in the source code)

Testing

A test script test_import.py was created to verify that both import paths work. You can run it with:

cd /home/jerome/PycharmProjects/fastpluggy/fastpluggy_plugin/crud_tools
python test_import.py

If the fix works, you should see output indicating that both imports were successful and that they refer to the same class.

Next Steps

After verifying that the fix works, you should rebuild and reinstall the package to ensure that the fix is included in the installed package.