How Many Hours To Create A Vst Plugin
Often when creating a Python application or library you’ll want the ability toprovide customizations or extra features via plugins. Because Pythonpackages can be separately distributed, your application or library may want toautomatically discover all of the plugins available.
So first confirm you have installed the 64 bit or 32 bit version of the plugin into the C:Program FilesVstplugins folder or in the C:Program Files (x86)VstPlugins folder. Now, IF the VST manufacturer does not have a 64 bit version you will need to run the Studio One 32 bit version to use that plugin. This sample uses a sub-package as the namespace package (myapp.plugins), but it’s also possible to use a top-level package for this purpose (such as myappplugins).How to pick the namespace to use is a matter of preference, but it’s not recommended to make your project’s main top-level package (myapp in this case) a namespace package for the purpose of plugins, as one bad plugin could.
There are three major approaches to doing automatic plugin discovery:
Using naming convention.
Using namespace packages.
Using package metadata.
Using naming convention¶
If all of the plugins for your application follow the same naming convention,you can use pkgutil.iter_modules()
to discover all of the top-levelmodules that match the naming convention. For example, Flask uses thenaming convention flask_{plugin_name}
. If you wanted to automaticallydiscover all of the Flask plugins installed:
How Many Hours To Create A Vst Plugins
If you had both the Flask-SQLAlchemy and Flask-Talisman plugins installedthen discovered_plugins
would be:
Using naming convention for plugins also allows you to query thePython Package Index’s simple API for all packages that conform to yournaming convention.
Using namespace packages¶
Namespace packages can be used to providea convention for where to place plugins and also provides a way to performdiscovery. For example, if you make the sub-package myapp.plugins
anamespace package then other distributions canprovide modules and packages to that namespace. Once installed, you can usepkgutil.iter_modules()
to discover all modules and packages installedunder that namespace:
Specifying myapp.plugins.__path__
to iter_modules()
causesit to only look for the modules directly under that namespace. For example,if you have installed distributions that provide the modules myapp.plugins.a
and myapp.plugins.b
then discovered_plugins
in this case would be:
This sample uses a sub-package as the namespace package (myapp.plugins
), butit’s also possible to use a top-level package for this purpose (such asmyapp_plugins
). How to pick the namespace to use is a matter of preference,but it’s not recommended to make your project’s main top-level package(myapp
Hybrid 3 vst plugin. in this case) a namespace package for the purpose of plugins, as onebad plugin could cause the entire namespace to break which would in turn makeyour project unimportable. For the “namespace sub-package” approach to work,the plugin packages must omit the __init__.py
for your top-levelpackage directory (myapp
in this case) and include the namespace-packagestyle __init__.py
in the namespace sub-package directory(myapp/plugins
). This also means that plugins will need to explicitly passa list of packages to setup()
’s packages
argument instead of usingsetuptools.find_packages()
.
Warning
Namespace packages are a complex feature and there are severaldifferent ways to create them. It’s highly recommended to read thePackaging namespace packages documentation and clearly documentwhich approach is preferred for plugins to your project.
Using package metadata¶
Setuptools provides special support for plugins. Byproviding the entry_points
argument to setup()
in setup.py
plugins can register themselves for discovery.
How To Create A Vst
For example if you have a package named myapp-plugin-a
and it includesin its setup.py
:
Then you can discover and load all of the registered entry points by usingpkg_resources.iter_entry_points()
:
In this example, discovered_plugins
would be:
Note
The entry_point
specification in setup.py
is fairlyflexible and has a lot of options. It’s recommended to read over the entiresection on entry points.