{"id":7152,"library":"demoji","title":"demoji","description":"demoji is a Python library (current version 1.1.0) designed to accurately find, remove, and replace emojis in text strings. It leverages data from the Unicode Consortium's emoji code repository, bundling this data at install time rather than requiring a runtime download. The library's release cadence is infrequent, with major versions introducing significant, often backwards-incompatible, changes.","status":"active","version":"1.1.0","language":"en","source_language":"en","source_url":"https://github.com/bsolomon1124/demoji","tags":["emoji","text processing","unicode","nlp"],"install":[{"cmd":"pip install demoji","lang":"bash","label":"Standard Install"},{"cmd":"pip install demoji[ujson]","lang":"bash","label":"Install with ujson support (optional, for faster data loading)"}],"dependencies":[{"reason":"Required for Python versions < 3.7 (e.g., Python 3.6) as a backport for accessing package resources.","package":"importlib_resources","optional":false},{"reason":"Optional dependency for faster loading of emoji data compared to the standard library's `json` module.","package":"ujson","optional":true}],"imports":[{"symbol":"demoji","correct":"import demoji"},{"symbol":"findall","correct":"demoji.findall(text_string)"},{"symbol":"replace","correct":"demoji.replace(text_string, repl='')"},{"note":"The `emoji` library (a separate project) uses `emoji.demojize` for converting emojis to shortcodes. `demoji` uses `demoji.replace_with_desc` for replacing emojis with their descriptions.","wrong":"emoji.demojize(text_string)","symbol":"replace_with_desc","correct":"demoji.replace_with_desc(text_string, sep=':')"}],"quickstart":{"code":"import demoji\n\ntweet = \"\"\"\n#startspreadingthenews yankees win great start by 🎅🏾 going 5strong innings with 5k's🔥 🐂\nsolo homerun 🌋🌋 with 2 solo homeruns and👹 3run homerun… 🤡 🚣🏼 👨🏽‍⚖️ with rbi's … 🔥🔥\n🇲🇽 and 🇳🇮 to close the game🔥🔥!!!….\nWHAT A GAME!!..\n\"\"\"\n\n# Find all emojis and their descriptions\nemojis_found = demoji.findall(tweet)\nprint(\"Emojis found:\", emojis_found)\n\n# Replace emojis with an empty string (remove them)\nclean_text = demoji.replace(tweet, '')\nprint(\"Text with emojis removed:\", clean_text)\n\n# Replace emojis with their descriptions (e.g., :fire:)\ndesc_text = demoji.replace_with_desc(tweet)\nprint(\"Text with emoji descriptions:\", desc_text)","lang":"python","description":"This quickstart demonstrates how to import the `demoji` library, find all emojis and their descriptions within a string, remove emojis entirely, and replace them with their textual descriptions."},"warnings":[{"fix":"Upgrade to Python 3.6+ or remain on `demoji` version 0.x.","message":"Version 1.0.0 introduced backwards-incompatible changes, dropping support for Python 2 and Python 3.5. Users on these older Python versions must remain on `demoji` v0.x.","severity":"breaking","affected_versions":"< 1.0.0"},{"fix":"Remove all calls to `demoji.download_codes()` and other removed functions. The emoji data is now available automatically upon import.","message":"From version 1.0.0 onwards, `demoji` bundles emoji data at install time, removing the need for runtime downloads. Consequently, `download_codes()`, `parse_unicode_sequence()`, `parse_unicode_range()`, and `stream_unicodeorg_emojifile()` functions have been removed.","severity":"breaking","affected_versions":"< 1.0.0"},{"fix":"Avoid direct reliance on `demoji.DIRECTORY` or `demoji.CACHEPATH`. The library no longer uses a runtime cache for emoji data.","message":"The attributes `demoji.DIRECTORY` and `demoji.CACHEPATH` were deprecated in version 1.0.0 as they are no longer functionally used by the package. Accessing them will issue a `FutureWarning`.","severity":"deprecated","affected_versions":">= 1.0.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Remove the call to `demoji.download_codes()`. Emoji data is automatically available when `demoji` is imported in versions 1.0.0+.","cause":"Attempting to call `demoji.download_codes()` after upgrading to version 1.0.0 or later. This function was removed because emoji data is now bundled with the package.","error":"AttributeError: module 'demoji' has no attribute 'download_codes'"},{"fix":"Install the package using `pip install demoji`. If using virtual environments, ensure the correct environment is activated before running your script.","cause":"The `demoji` package is not installed in the current Python environment, or the environment where it was installed is not active.","error":"ModuleNotFoundError: No module named 'demoji'"}]}