{"id":24802,"library":"uwsgidecorators","title":"uwsgidecorators","description":"A standalone package providing decorators compatible with uWSGI, allowing easy integration of uWSGI features like cron, timer, signal, lock, and spooler without the full uwsgi module. Current version 1.1.0 appears to be stable with infrequent releases.","status":"active","version":"1.1.0","language":"python","source_language":"en","source_url":"https://github.com/unbit/uwsgidecorators","tags":["uwsgi","decorators","cron","timer","spooler","mule","standalone"],"install":[{"cmd":"pip install uwsgidecorators","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"uwsgi is a C extension; use this standalone package instead.","wrong":"from uwsgi import decorators","symbol":"timer","correct":"from uwsgidecorators import timer"}],"quickstart":{"code":"from uwsgidecorators import timer\nimport os\n\n# This will only work if the process is managed by uWSGI with --enable-threads\n@timer(10, target='mule')\ndef mytask():\n    print('Task executed in mule')\n\nif not os.environ.get('UWSGI_ORIGINAL_PROC_NAME'):\n    print('This example requires uWSGI runtime. Install uWSGI and run under emperor/emperor.')\n","lang":"python","description":"A simple timer decorator that runs in a mule every 10 seconds."},"warnings":[{"fix":"Uninstall uwsgi if you only need decorators: pip uninstall uwsgi && pip install uwsgidecorators","message":"The package is a standalone extraction from older uWSGI releases. Mixing with an installed uwsgi module (pypi package 'uwsgi') can cause import conflicts or segfaults due to symbol duplication. Prefer using either the full uwsgi package (which includes its own decorators) or this standalone package, not both.","severity":"breaking","affected_versions":"all"},{"fix":"Check uwsgi availability in code: if hasattr(uwsgidecorators, 'uwsgi'): # safe to use decorators","message":"The decorators only function when the process is actually running under uWSGI (i.e., inside a uWSGI worker, mule, or spooler). Using them in a standalone Python script will either silently do nothing or raise an AttributeError due to missing uwsgi C bindings.","severity":"gotcha","affected_versions":"all"},{"fix":"Prefer Python's threading.Lock or multiprocessing.Lock if not within uWSGI's async environment.","message":"The filelock, rlock, and sema decorators rely on uWSGI's internal locking mechanisms that may be removed in future uWSGI versions. Use with caution.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install uwsgidecorators","cause":"Package not installed or installed in a different Python environment.","error":"ImportError: No module named uwsgidecorators"},{"fix":"Check version: pip show uwsgidecorators. Reinstall: pip install --upgrade uwsgidecorators. Ensure process is under uWSGI runtime.","cause":"The package version may be older or corrupted. Also, trying to use decorators outside uWSGI may cause this if the module fails to load properly.","error":"AttributeError: module 'uwsgidecorators' has no attribute 'timer'"},{"fix":"Run your script under uWSGI, e.g., uwsgi --wsgi-file myapp.py --http :8000","cause":"The Python process is not running under uWSGI. The decorators require the uwsgi C module to be loaded (only present in uWSGI workers).","error":"RuntimeError: uwsgi module is not available"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}