{"id":24182,"library":"oslo-limit","title":"Oslo Limit","description":"Limit enforcement library to assist with quota calculation, part of the OpenStack Oslo project. Current version 2.10.0, requires Python >=3.10. Maintenance mode with infrequent releases.","status":"active","version":"2.10.0","language":"python","source_language":"en","source_url":"https://opendev.org/openstack/oslo.limit","tags":["openstack","oslo","limit","quota","enforcement"],"install":[{"cmd":"pip install oslo.limit","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"Correct package is oslo_limit, not oslo.limit.","wrong":"from oslo.limit import limit","symbol":"Limit","correct":"from oslo_limit import limit"},{"note":"Enforcer is accessed via the limit module.","wrong":"from oslo.limit import enforcer","symbol":"Enforcer","correct":"from oslo_limit import limit; enforcer = limit.Enforcer(...)"}],"quickstart":{"code":"from oslo_limit import limit\n\n# Define a resource with a limit of 10\nresource = {'name': 'instances', 'limit': 10}\n# Check usage\nenforcer = limit.Enforcer()\n# Would raise exception if exceeded\nenforcer.enforce('project-id', resource, usage=5)","lang":"python","description":"Basic usage: create an Enforcer and call enforce() to check quota limits."},"warnings":[{"fix":"Update code to use async/await; see migration guide in documentation.","message":"Version 2.0.0 dropped Python 2 support and changed the API to be async-only. Synchronous usage will break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use limit.Enforcer instead of instantiating limit.Limit.","message":"The 'limit.Limit' class is deprecated in favor of using the Enforcer directly.","severity":"deprecated","affected_versions":"2.5.0 and later"},{"fix":"Always use consistent casing for resource names (e.g., 'instances' not 'Instances').","message":"Resource names are case-sensitive and must match exactly the names used in the backend.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install oslo.limit\nThen import: from oslo_limit import limit","cause":"Using wrong import path; the correct package is oslo_limit.","error":"ImportError: No module named oslo.limit"},{"fix":"Use: await enforcer.enforce(...) inside an async function.","cause":"Enforcer methods are async and must be awaited.","error":"TypeError: object Enforcer can't be used in 'await' expression"},{"fix":"Verify resource names are registered in the backend and use exact case (e.g., 'instances' vs 'Instances').","cause":"Resource name is not registered or case mismatch.","error":"oslo_limit.limit.ResourceNotFound: Resource 'instances' not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}