Python Dynamic Plugins
In a nutshell Python Dynamic plugins is a small library for manage Python plugins dynamically.
Quickstart
This library has two main parts:
- Pip utils
- Dynamic library loading
Pip utils
This module provides some utilities for pip from Python.
Dynamic library loading
This library load, following some contrains, Python packages and load specific symbols from them. This is: functions, class definitions, variables, etc
The main idea of the project is to be able to create a plugin system which is easy to use and easy to maintain.
Install
> pip install dynamic-plugins
Dynamic module load usage
For this example we'll use the demo package demo_module that you can find in the demo_plugins folder.
First you need to install the demo package
> cd demo_plugins/demo_module
> pip install . -U
Load symbols
In this example we'll load the hello_world() function dynamically from the demo_module package.
from dynamic_plugins import get_extensions
def main():
for package_name, package_content in get_extensions("demo-", sub_package="setup",symbols="hello_world").items():
print(package_name)
print(package_content["module_object"])
for fn in package_content["symbols"]:
print(fn())
if __name__ == '__main__':
main()
Pip utils
List installed packages
from dynamic_plugins import list_installed_packages
def main():
for package_name, package_version in list_installed_packages().items():
print(f"{package_name} {package_version}")
if __name__ == '__main__':
main()
Install a package from Pypi
from dynamic_plugins import install_library_from_pypi
def main():
install_library_from_pypi("requests")
if __name__ == '__main__':
main()
Install a package from local folder
from dynamic_plugins import install_library_from_path
def main():
install_library_from_path("/path/to/package")
if __name__ == '__main__':
main()
License
Dictionary Search is Open Source and available under the MIT.
Contributions
Contributions are very welcome. See CONTRIBUTING.md or skim existing tickets to see where you could help out.
Metadata
Release files for dynamic-plugins 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dynamic-plugins-1.0.10.tar.gz | 5.4 kB | Without provenance | Details |
Release files / dynamic-plugins-1.0.10.tar.gz
| Download URL | dynamic-plugins-1.0.10.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f24b1d1fa679edc48acc7e68f0abbf9786dcdf67a1a260072ec4f6410dac02e
|
|
BLAKE2b-256 checksum How to use checksums |
632599b386f33a98492a4f375a20e81a492b88a6f25949a0fad1ee1ed99be3d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for dynamic-plugins 1.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.