{"id":27484,"library":"twitter-common-lang","title":"twitter.common.lang","description":"A library from Twitter's commons providing Python language and compatibility utilities such as compatibility shims for Python 2/3, locks, and concurrency helpers. Current version 0.3.11, last released in 2015. No longer actively maintained.","status":"maintenance","version":"0.3.11","language":"python","source_language":"en","source_url":"https://github.com/twitter/commons","tags":["twitter","compatibility","utilities","deprecated"],"install":[{"cmd":"pip install twitter-common-lang","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"this package is part of the twitter.common namespace; other subpackages may conflict","package":"twitter.common","optional":false}],"imports":[{"note":"Do not use dot-path imports; requires explicit from import.","wrong":"import twitter.common.lang.compat","symbol":"compat","correct":"from twitter.common.lang import compat"},{"note":"Lock is a compatibility wrapper for threading locks.","wrong":"","symbol":"Lock","correct":"from twitter.common.lang import Lock"},{"note":"","wrong":"","symbol":"Singleton","correct":"from twitter.common.lang import Singleton"}],"quickstart":{"code":"from twitter.common.lang import compat, Lock\n\n# Check Python version compatibility\nprint(compat.PY3)  # True if Python 3\n\n# Use a reentrant lock\nlock = Lock()\nwith lock:\n    print(\"Lock acquired\")","lang":"python","description":"Basic usage of twitter.common.lang for compatibility checks and locking."},"warnings":[{"fix":"Use virtual environments and pin all twitter-common dependencies to same version.","message":"Package is part of a namespace package (twitter.common). Installing multiple twitter-common-* subpackages may cause import conflicts if versions mismatch.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider migrating to standard library or modern alternatives (e.g., six, future, threading).","message":"The library is no longer maintained; Python 3 support is partial and may have edge cases.","severity":"deprecated","affected_versions":">=0.3.11"},{"fix":"Always use explicit from imports.","message":"import twitter.common.lang does not work; must use from twitter.common.lang import ...","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":"pip install twitter-common-lang","cause":"Missing dependency or incorrect installation; package name is twitter-common-lang.","error":"ImportError: No module named twitter.common.lang"},{"fix":"Reinstall with pip install --upgrade twitter-common-lang, or check if the package is in site-packages/twitter/common/lang","cause":"Namespace package not properly installed; python may not find subpackages.","error":"AttributeError: module 'twitter.common' has no attribute 'lang'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}