Add entry point at runtime in Python
I want to use setuptools entry points to subscribe method groups to messages coming from a communication channel.
It is very easy to do this by declaring all the entry points in your setup.py
. But I'm not sure if I can add additional entry points while the program is running.
Can I add new entry points to an application that is already running?
I tried to add a new "fake" setuptools command in an interactive session:
std = pkg_resources.get_distribution('setuptools')
pkg_resources.EntryPoint.parse_group(
'distutils.commands', 'antialias = setuptools.command.alias:alias', std)
pprint(std.get_entry_map())
But my new entry point is missing from the printed object. Am I doing something wrong?
+3
source to share
No one has answered this question yet
Check out similar questions: