MySQL Shell 9.1  /  ...  /  Common Code and Packages

10.3.1.1 Common Code and Packages

If you use common code or inner packages in Python code that is part of a MySQL Shell plugin or plugin group, you must follow these requirements for naming and importing to avoid potential clashes between package names:

  • The plugin or plugin group's top-level folder, and each inner folder that is to be recognized as a package, must be a valid regular package name according to Python's PEP 8 style guide, using only letters, numbers, and underscores.

  • Each inner folder that is to be recognized as a package must contain a file named __init__.py.

  • When importing, the full path for the package name must be specified. For example, if a plugin group named ext contains a plugin named demo, which has an inner package named src containing a module named sample, the module must be imported as follows:

    from ext.demo.src import sample