Skip to content

Conversation

@LeiWang1999
Copy link
Contributor

Remove the 'decorator' package from various installation scripts, requirements, and documentation. Update the FFI base module to use a local decorator implementation instead of the external package.

Previous pull request #17652

Replace decorator package with functools.wraps for simpler and more standard function wrapping. This change removes an external dependency and uses Python's built-in functools module for function decoration.
Remove the decorator package from various installation scripts and requirements files. This follows the previous refactoring of decorators to use functools.wraps, eliminating an external dependency and simplifying the project's package requirements.
@LeiWang1999 LeiWang1999 force-pushed the phraseout_decorator_v2 branch from 5df34b0 to ebd2ad3 Compare February 17, 2025 16:23
Update the decorate function to create a wrapper that allows more flexible function decoration. The new implementation passes the original function as the first argument to the wrapped function, enabling more dynamic decoration behavior while maintaining the functools.wraps functionality.
The wrapped function
"""
import decorator
@functools.wraps(func)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we confirm functools.wraps can do the job, perhaps we can simply replace all the callsite with functools and remove this function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest commit has replaced all decorator call sites with functools.wraps, cc @tqchen

Remove the custom decorate function from base.py and update multiple files to use functools.wraps directly. This change eliminates the need for a custom decorator implementation and simplifies the codebase by leveraging Python's built-in functools module.
@tqchen
Copy link
Member

tqchen commented Feb 18, 2025

great, we can merge once ci is green

@tqchen tqchen merged commit 0d42dc4 into apache:main Feb 18, 2025
10 checks passed
@tqchen
Copy link
Member

tqchen commented Feb 18, 2025

Thanks @LeiWang1999 for great work, this is now merged!

ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
* Refactor decorate function to use functools.wraps

Replace decorator package with functools.wraps for simpler and more standard function wrapping. This change removes an external dependency and uses Python's built-in functools module for function decoration.

* Remove decorator package dependency

Remove the decorator package from various installation scripts and requirements files. This follows the previous refactoring of decorators to use functools.wraps, eliminating an external dependency and simplifying the project's package requirements.

* Modify decorate function to support more flexible function wrapping

Update the decorate function to create a wrapper that allows more flexible function decoration. The new implementation passes the original function as the first argument to the wrapped function, enabling more dynamic decoration behavior while maintaining the functools.wraps functionality.

* Remove decorate function and replace with functools.wraps

Remove the custom decorate function from base.py and update multiple files to use functools.wraps directly. This change eliminates the need for a custom decorator implementation and simplifies the codebase by leveraging Python's built-in functools module.

* Remove generic_func.py as upstream did

* Fix dominant issues of decorator

* fix for pickle memoize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants