GitXplorerGitXplorer
c

load-plugins

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
b33d32385a1ad1c9344ee929de6a515e9cfc75c9

Temporarily disable dependabot

ccdce8p committed 2 years ago
Verified
5ea12407ce89d7eaa960c8da410a38f01de00b0f

Bump actions/setup-python from 2.3.2 to 3.0.0 (#5)

ddependabot[bot] committed 3 years ago
Verified
37247e954fb03cd6921782e7e6b279401f1e23ae

Bump actions/checkout from 2.4.0 to 3.0.0 (#4)

ddependabot[bot] committed 3 years ago
Verified
41b8e766a248ea4529b4b7d5fc9bad6bd4706926

Bump tomli from 2.0.0 to 2.0.1 (#3)

ddependabot[bot] committed 3 years ago
Verified
1bba8338f78f962969c79f84c63c39edafbdf2b4

Update twine requirement from ~=3.7.1 to ~=3.8.0 (#2)

ddependabot[bot] committed 3 years ago
Verified
5701dbb0f3a498cf375ac0d6ff95e0e8d5bef854

Bump actions/setup-python from 2.3.1 to 2.3.2 (#1)

ddependabot[bot] committed 3 years ago

README

The README file for this repository.

Load-plugins

Dynamically load plugin packages based on pyproject.toml config. Only recommend to use for applications that use a plugin structure internally but don't officially support custom plugins.

How does it work?

The library installs a .pth file into the site-packages directory. This is executed for every Python program call.

The .pth file itself will load a Python module which reads the pyproject.toml file to determine which packages to import. For each package, it will import all individual modules separately. Thus, it's not necessary to import them inside the package __init__.py file.

All that happens before the actual Python program is executed.

Disclaimer

This library will slow down the startup of any Python program. It is recommended to only use it in isolated environments! E.g. together with pre-commit.

Configuration and Usage

To configure the library, add a pyproject.toml file to the root of your project.

There are two different options, which can be used together.

  1. Packages which should always be loaded
[tool.load_plugins]
packages = [
    "plugin_package",
    "folder.with_package",
]
  1. And packages which should only be loaded for certain applications. The name of the binary is used as filter. E.g. for a Python application with entry point app, use this config.
[tool.load_plugins.app]
packages = [
    "plugin_package",
]

If used with pre-commit, remember to add load-plugins as additional_dependencies.

License

This Project is licensed under the MIT license. See LICENSE for the full license text.