Registry / data / demoji

demoji

JSON →
library2.0.0pypypi✓ verified 86d ago

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.

pip install demoji
INSTALL
IMPORT
SIG · DEMOJI
D
demoji
datapythonv2.0.0
Install
1.5s avg
Import
415ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.421s · 18MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 1.5s · import 0.410s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

demoji
import demoji
findall
demoji.findall(text_string)
replace
demoji.replace(text_string, repl='')
replace_with_desc
demoji.replace_with_desc(text_string, sep=':')
emoji.demojize(text_string)
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.

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.

import demoji tweet = """ #startspreadingthenews yankees win great start by 🎅🏾 going 5strong innings with 5k's🔥 🐂 solo homerun 🌋🌋 with 2 solo homeruns and👹 3run homerun… 🤡 🚣🏼 👨🏽‍⚖️ with rbi's … 🔥🔥 🇲🇽 and 🇳🇮 to close the game🔥🔥!!!…. WHAT A GAME!!.. """ # Find all emojis and their descriptions emojis_found = demoji.findall(tweet) print("Emojis found:", emojis_found) # Replace emojis with an empty string (remove them) clean_text = demoji.replace(tweet, '') print("Text with emojis removed:", clean_text) # Replace emojis with their descriptions (e.g., :fire:) desc_text = demoji.replace_with_desc(tweet) print("Text with emoji descriptions:", desc_text)
Debug
Known issues
breakingVersion 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.
fix
Upgrade to Python 3.6+ or remain on `demoji` version 0.x.
affects: < 1.0.0
breakingFrom 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.
fix
Remove all calls to `demoji.download_codes()` and other removed functions. The emoji data is now available automatically upon import.
affects: < 1.0.0
deprecatedThe 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`.
fix
Avoid direct reliance on `demoji.DIRECTORY` or `demoji.CACHEPATH`. The library no longer uses a runtime cache for emoji data.
affects: >= 1.0.0
Errors
Common errors & fixes
AttributeError: module 'demoji' has no attribute 'download_codes'
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.
fix
Remove the call to `demoji.download_codes()`. Emoji data is automatically available when `demoji` is imported in versions 1.0.0+.
ModuleNotFoundError: No module named 'demoji'
The `demoji` package is not installed in the current Python environment, or the environment where it was installed is not active.
fix
Install the package using `pip install demoji`. If using virtual environments, ensure the correct environment is activated before running your script.
Upgrade
Version history
2.0.0latest on PyPI · released Apr 19, 2026
Audit
Dependencies
importlib_resourcesrequiredRequired for Python versions < 3.7 (e.g., Python 3.6) as a backport for accessing package resources.
ujsonoptionalOptional dependency for faster loading of emoji data compared to the standard library's `json` module.
Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
demoji — pip install demoji · libregistry