Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

featuretools_primitives entry point expects list of primitive classes #529

Merged
merged 4 commits into from May 3, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions featuretools/primitives/__init__.py
Expand Up @@ -2,12 +2,18 @@
from .api import *

import pkg_resources
# Load in primitives registered by other libraries into Featuretools namespace
# Load in a list of primitives registered by other libraries into Featuretools
# Example entry_points definition for a library using this entry point:
# entry_points={
# "featuretools_primitives": [
# other_library = other_library:LIST_OF_PRIMITIVES
# ]
# }
for entry_point in pkg_resources.iter_entry_points('featuretools_primitives'):
try:
loaded = entry_point.load()
if hasattr(loaded, 'primitives'):
for name, obj in loaded.primitives.items():
globals()[name] = obj
for primitive in loaded:
if issubclass(primitive, (AggregationPrimitive, TransformPrimitive)):
globals()[primitive.__name__] = primitive
except Exception:
pass