Skip to content

Commit

Permalink
MAINT Remove wrapt dependency (#1973)
Browse files Browse the repository at this point in the history
* MAINT Remove wrapt dependency

Signed-off-by: Thomas J. Fan <[email protected]>

* MAINT Removes wrapt dependency from requirements

Signed-off-by: Thomas J. Fan <[email protected]>

---------

Signed-off-by: Thomas J. Fan <[email protected]>
  • Loading branch information
thomasjpfan authored Nov 22, 2023
1 parent e5c3c78 commit a6f9991
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ wheel==0.41.3
wrapt==1.15.0
# via
# aiobotocore
# flytekit
# tensorflow
yarl==1.9.2
# via aiohttp
Expand Down
1 change: 0 additions & 1 deletion doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,6 @@ wrapt==1.15.0
# via
# aiobotocore
# astroid
# flytekit
# pandera
# tensorflow
xarray==2023.8.0
Expand Down
21 changes: 17 additions & 4 deletions flytekit/exceptions/scopes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from functools import wraps as _wraps
from sys import exc_info as _exc_info
from traceback import format_tb as _format_tb

from wrapt import decorator as _decorator

from flytekit.exceptions import base as _base_exceptions
from flytekit.exceptions import system as _system_exceptions
from flytekit.exceptions import user as _user_exceptions
Expand Down Expand Up @@ -134,8 +133,22 @@ def _is_base_context():
return _CONTEXT_STACK[-2] == _NULL_CONTEXT


def _decorator(outer_f):
"""Decorate a function with signature func(wrapped, args, kwargs)."""

@_wraps(outer_f)
def inner_decorator(inner_f):
@_wraps(inner_f)
def f(*args, **kwargs):
return outer_f(inner_f, args, kwargs)

return f

return inner_decorator


@_decorator
def system_entry_point(wrapped, instance, args, kwargs):
def system_entry_point(wrapped, args, kwargs):
"""
The reason these two (see the user one below) decorators exist is to categorize non-Flyte exceptions at arbitrary
locations. For example, while there is a separate ecosystem of Flyte-defined user and system exceptions
Expand Down Expand Up @@ -178,7 +191,7 @@ def system_entry_point(wrapped, instance, args, kwargs):


@_decorator
def user_entry_point(wrapped, instance, args, kwargs):
def user_entry_point(wrapped, args, kwargs):
"""
See the comment for the system_entry_point above as well.
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"typing_extensions",
"urllib3>=1.22,<2.0.0",
"wheel>=0.30.0,<1.0.0",
"wrapt>=1.0.0,<2.0.0",
],
extras_require=extras_require,
scripts=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ wrapt==1.15.0
# via
# aiobotocore
# deprecated
# flytekit
yarl==1.9.2
# via aiohttp
zipp==3.16.2
Expand Down

0 comments on commit a6f9991

Please sign in to comment.