[Refactor] Phrase out python dependency decorator#17661
Merged
tqchen merged 8 commits intoapache:mainfrom Feb 18, 2025
Merged
Conversation
tqchen
requested changes
Feb 17, 2025
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.
5df34b0 to
ebd2ad3
Compare
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.
tqchen
reviewed
Feb 17, 2025
| The wrapped function | ||
| """ | ||
| import decorator | ||
| @functools.wraps(func) |
Member
There was a problem hiding this comment.
if we confirm functools.wraps can do the job, perhaps we can simply replace all the callsite with functools and remove this function
Contributor
Author
There was a problem hiding this comment.
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.
Member
|
great, we can merge once ci is green |
tqchen
approved these changes
Feb 18, 2025
Member
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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