{"id":311,"library":"wrapt","title":"wrapt","description":"wrapt is a Python module designed for decorators, wrappers, and monkey patching. It emphasizes correctness and transparency, ensuring that decorators preserve introspectability and function signatures. The current version is 2.1.2, with a release cadence that reflects active maintenance and updates.","status":"active","version":"2.1.2","language":"python","source_language":"en","source_url":"https://github.com/GrahamDumpleton/wrapt","tags":["decorators","wrappers","monkey patching","Python"],"install":[{"cmd":"pip install wrapt","lang":"bash","label":"Install wrapt"}],"dependencies":[],"imports":[{"note":"The correct import is directly from wrapt; importing from wrapt.decorators is incorrect.","wrong":"from wrapt.decorators import decorator","symbol":"decorator","correct":"from wrapt import decorator"}],"quickstart":{"code":"import wrapt\n\n@wrapt.decorator\ndef pass_through(wrapped, instance, args, kwargs):\n    return wrapped(*args, **kwargs)\n\n@pass_through\ndef function():\n    print(\"Function executed\")\n\nfunction()","lang":"python","description":"This example demonstrates creating a simple pass-through decorator using wrapt."},"warnings":[{"fix":"Apply decorators outside of @classmethod to ensure correct behavior.","message":"In Python 3.13, the behavior of @classmethod.__get__() was reverted to its pre-3.9 state, affecting decorators applied inside @classmethod.","severity":"breaking","affected_versions":"Python 3.13"},{"fix":"Use super(OriginalClass, self).__init__() instead of super().__init__() within decorated classes.","message":"Using a decorated class with super() requires accessing the original wrapped class to avoid issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use Base.__wrapped__ as the base class when deriving from a decorated class.","message":"Deriving from a decorated class necessitates using the original wrapped class as the base to prevent inheritance issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Avoid using issubclass() on decorated abstract classes or access the original class using __wrapped__.","message":"Using issubclass() on abstract classes decorated with wrapt can raise TypeError due to Python's handling of abstract base classes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure wrapt is reinstalled correctly if uninstallation causes issues, particularly when other packages rely on it.","message":"Uninstalling wrapt improperly can lead to Python runtime errors, especially if other packages depend on it.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.1.2':31 'activ':38 'cadenc':35 'correct':16 'current':28 'decor':9,21,42 'design':7 'emphas':15 'ensur':19 'function':25 'introspect':23 'mainten':39 'modul':6 'monkey':12,44 'patch':13,45 'preserv':22 'python':5,46 'reflect':37 'releas':34 'signatur':26 'transpar':18 'updat':41 'version':29 'wrapper':10,43 'wrapt':1,2","created_at":"2026-03-28T08:21:29.361376+00:00","updated_at":"2026-03-28T08:21:29.361376+00:00","problems":[],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"2.3.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/GrahamDumpleton/wrapt","docs":"https://wrapt.readthedocs.io/","changelog":"https://wrapt.readthedocs.io/en/latest/changes.html","pypi":"https://pypi.org/project/wrapt/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}