Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladiibine/d4bccc9485333156eb022600fa275f72 to your computer and use it in GitHub Desktop.
Save vladiibine/d4bccc9485333156eb022600fa275f72 to your computer and use it in GitHub Desktop.
Python entry point scripts
# List all the console_scripts entry points in the given distribution, or all distributions if None
def list_entry_points(desired_distribution=None):
all_entry_maps = {}
for key, distribution in pkg_resources.working_set.by_key.items():
if desired_distribution and distribution.key != desired_distribution:
continue
distribution_entrypoints = distribution.get_entry_map()
if distribution_entrypoints:
if 'console_scripts' in distribution_entrypoints:
all_entry_maps[key]= [str(entry_point) for entry_point in distribution_entrypoints['console_scripts'].values()]
return all_entry_maps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment