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

Entry Point Warnings #850

Merged
merged 34 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2fd67bc
print warning
jeff-hernandez Feb 20, 2020
e44de76
update changelog
jeff-hernandez Feb 20, 2020
c45eba6
use warnings
jeff-hernandez Feb 20, 2020
0ef44d7
pip
jeff-hernandez Feb 24, 2020
abf92c7
test plugin warning
jeff-hernandez Feb 25, 2020
bc772b5
featuretools plugin package
jeff-hernandez Feb 25, 2020
322084a
subprocess check
jeff-hernandez Feb 26, 2020
534c3be
test package outside path
jeff-hernandez Feb 27, 2020
7ef2810
update changelog
jeff-hernandez Feb 27, 2020
6497e38
updates
jeff-hernandez Feb 27, 2020
75892d0
outside path of pytest
jeff-hernandez Feb 27, 2020
db26528
refactor
jeff-hernandez Feb 27, 2020
d18c53a
updates
jeff-hernandez Feb 27, 2020
3ac9394
updates
jeff-hernandez Feb 27, 2020
c2f9cc5
updates
jeff-hernandez Feb 27, 2020
7f61a6d
updates
jeff-hernandez Feb 27, 2020
5c51366
updates
jeff-hernandez Feb 27, 2020
9104ef2
updates
jeff-hernandez Feb 27, 2020
3d575c9
warning message
jeff-hernandez Feb 28, 2020
16de6b3
resolve changelog
jeff-hernandez Mar 2, 2020
5a8fa86
removed pandas requirement
jeff-hernandez Mar 2, 2020
2d5e5fa
changelog update
jeff-hernandez Mar 10, 2020
74b33d9
changelog update
jeff-hernandez Mar 10, 2020
605f320
log and test warning
jeff-hernandez Mar 10, 2020
c57bde7
merge master
jeff-hernandez Mar 10, 2020
f27ddb6
Merge branch 'master' into entry-points
jeff-hernandez Mar 10, 2020
71d9461
test update
jeff-hernandez Mar 10, 2020
d9fb87e
Merge branch 'master' into entry-points
jeff-hernandez Mar 10, 2020
ac449df
changelog update
jeff-hernandez Mar 10, 2020
37b5d0c
test update
jeff-hernandez Mar 11, 2020
3b5f885
utils update
jeff-hernandez Mar 11, 2020
9292396
remove test filter
jeff-hernandez Mar 11, 2020
212624f
info for debug
jeff-hernandez Mar 12, 2020
e16fd36
update message
jeff-hernandez Mar 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
source = featuretools
omit = */featuretools_plugin/*

[report]
exclude_lines =
Expand Down
4 changes: 3 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
Changelog
---------
**Future Release**
* Changes
* Added Plugin Warnings at Entry Point (:pr:`850`)
* Documentation Changes
* Add links to primitives.featurelabs.com (:pr:`860`)
* Add source code links to API reference (:pr:`862`)
* Testing Changes
* Miscellaneous changes (:pr:`861`)

Thanks to the following people for contributing to this release:
:user:`rwedge`, :user:`thehomebrewnerd`
:user:`rwedge`, :user:`thehomebrewnerd`, :user:`jeff-hernandez`

**v0.13.3 Feb 28, 2020**
* Fixes
Expand Down
11 changes: 9 additions & 2 deletions featuretools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# flake8: noqa
import warnings
from .config_init import config
from . import variable_types
from .entityset.api import *
Expand All @@ -15,8 +14,13 @@
from . import feature_base
from .feature_base import AggregationFeature, DirectFeature, Feature, FeatureBase, IdentityFeature, TransformFeature, GroupByTransformFeature, save_features, load_features

import logging
import pkg_resources
import sys
import traceback

logger = logging.getLogger('featuretools')

# Call functions registered by other libraries when featuretools is imported
for entry_point in pkg_resources.iter_entry_points('featuretools_initialize'):
try:
Expand All @@ -31,4 +35,7 @@
try:
sys.modules["featuretools." + entry_point.name] = entry_point.load()
except Exception:
pass
message = "Featuretools failed to load plugin {} from library {}. "
message += "For a full stack trace, set logging to debug."
logger.warn(message.format(entry_point.name, entry_point.module_name))
logger.debug(traceback.format_exc())
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
raise NotImplementedError('plugin not implemented')
11 changes: 11 additions & 0 deletions featuretools/tests/plugin_tests/featuretools_plugin/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from setuptools import setup

setup(
name='featuretools_plugin',
packages=['featuretools_plugin'],
entry_points={
'featuretools_plugin': [
'module = featuretools_plugin',
],
},
)
20 changes: 20 additions & 0 deletions featuretools/tests/plugin_tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from featuretools.tests.plugin_tests.utils import (
import_featuretools,
install_featuretools_plugin,
uninstall_featuretools_plugin
)


def test_plugin_warning():
install_featuretools_plugin()
warning = import_featuretools('warning').stdout.decode()
debug = import_featuretools('debug').stdout.decode()
uninstall_featuretools_plugin()

message = 'Featuretools failed to load plugin module from library featuretools_plugin'
traceback = 'NotImplementedError: plugin not implemented'

assert message in warning
assert traceback not in warning
assert message in debug
assert traceback in debug
28 changes: 28 additions & 0 deletions featuretools/tests/plugin_tests/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import subprocess
import sys


def import_featuretools(level=None):
c = ''
if level:
c += 'import os;'
c += 'os.environ["FEATURETOOLS_LOG_LEVEL"] = "%s";' % level

c += 'import featuretools;'
return python('-c', c)


def install_featuretools_plugin():
pwd = os.path.dirname(__file__)
os.chdir(os.path.join(pwd, 'featuretools_plugin'))
return python('-m', 'pip', 'install', '-e', '.')


def python(*args):
command = [sys.executable, *args]
return subprocess.run(command, stdout=subprocess.PIPE)


def uninstall_featuretools_plugin():
return python('-m', 'pip', 'uninstall', 'featuretools_plugin', '-y')
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
description-file = README.md
[tool:pytest]
addopts = --doctest-modules
addopts = --doctest-modules --ignore=featuretools/tests/plugin_tests/featuretools_plugin
jeff-hernandez marked this conversation as resolved.
Show resolved Hide resolved
python_files = featuretools/tests/*
filterwarnings =
ignore::DeprecationWarning
Expand Down