Skip to main content

emoji-rs

Rust-accelerated demojize, replace_emoji, emoji_list and friends for the emoji package. Output is identical to the original; anything the Rust core does not handle is passed to the original implementation.

import emoji, emoji_rs
emoji_rs.patch()                 # emoji.demojize / replace_emoji / emoji_list / ... now use Rust
emoji.demojize("Python is fun 👍")
emoji_rs.unpatch()               # restore the original implementation

or call emoji_rs.demojize(...) etc. directly. Names imported earlier with from emoji import demojize keep pointing at the original; patch first or import from emoji_rs.

Speed

emoji 2.16.0, Python 3.13, 2 cores (bench/bench.py). The original builds a Token object for every character of the input, so it runs at about 3 MB/s regardless of how many emoji the text contains:

operation original Rust speedup
demojize (1 MB text) 365.5 ms 13.50 ms 27x
demojize (5000 x 100 chars) 189.0 ms 11.19 ms 17x
replace_emoji (1 MB text) 348.6 ms 8.42 ms 41x
replace_emoji (5000 x 100 chars) 186.0 ms 6.77 ms 27x
emoji_list (1 MB text) 327.6 ms 20.65 ms 16x
emoji_list (5000 x 100 chars) 160.0 ms 13.92 ms 11x
distinct_emoji_list (1 MB text) 320.7 ms 14.77 ms 22x
distinct_emoji_list (5000 x 100 chars) 175.9 ms 11.94 ms 15x
emoji_count (1 MB text) 329.0 ms 7.85 ms 42x
emoji_count (5000 x 100 chars) 150.4 ms 5.76 ms 26x
purely_emoji (200k emoji, True) 315.0 ms 12.15 ms 26x
demojize (20k emoji, no text) 29.5 ms 1.92 ms 15x
demojize(language='de') (1 MB) 349.5 ms 12.90 ms 27x
replace_emoji('X') 1 MB 346.5 ms 7.60 ms 46x

Short strings gain less because the call overhead (Python wrapper plus argument conversion, about 1.5 µs) becomes visible, and emoji_list builds one Python dict per match, which stays in Python's hands.

What is ported

  • emoji.tokenizer.tokenize, line by line, including its quirks: greedy trie walk without backtracking, the ignore list for ZWJ characters, rewinding for non-RGI ZWJ sequences and for components, variation selectors (U+FE0E / U+FE0F) being dropped, and filter_tokens joining.
  • demojize (all languages, delimiters, version, string handle_version, language='alias', config.demojize_keep_zwj), replace_emoji (string replacement, version, config.replace_emoji_keep_zwj), emoji_list, distinct_emoji_list, emoji_count, purely_emoji.

Not ported, because the gain is small or the result is made of Python objects: emojize (already regex based), is_emoji (a dict lookup), analyze / tokenize (return EmojiMatch objects), version.

The emoji data is not baked into the wheel: the Rust tables are built from the live emoji.EMOJI_DATA when emoji_rs is imported (a few milliseconds) and per-language names when a language is first used. A new emoji release therefore needs no new emoji-rs release.

Fallbacks (results stay identical)

Callables for replace / handle_version, non-str arguments, lone surrogates, unknown languages (the original raises its usual error), config.*_keep_zwj combined with version for joined non-RGI sequences (the original raises AssertionError), and any case where EMOJI_DATA was modified in place after import (call emoji_rs.refresh() to rebuild the tables).

The ported algorithms are identical in emoji 2.13.2 to 2.16.0. For any other release emoji_rs hashes the source of the ported functions (tools/source_hashes.py) and keeps the fast path off, with a warning from patch(), unless the digest matches a verified release.

Testing

  • tests/diff_test.py runs every case through the Rust core directly (so a silent fallback cannot make the test pass vacuously) and through the public wrappers, and compares with the original: all 5244 emoji alone and in context (with/without variation selectors, doubled, ZWJ-joined), sampled pairs and triples of emoji, fuzzed strings built from emoji, truncated and mutated emoji, ZWJ, VS15/VS16, skin-tone and hair components, regional indicators, tag characters and keycaps, over all 14 languages, delimiters, version values, handle_version and both keep_zwj settings. About 8 million comparisons passed against emoji 2.16.0 (0 failures); the same suite passes against 2.13.2.
  • emoji's own test suite (102 tests) passes unchanged with emoji_rs.patch() applied.
  • tests/test_basic.py: unit tests.

License

BSD 3-Clause, same as emoji; see LICENSE.

Metadata

Release files for emoji-rs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emoji-rs 0.1.0
File Size Uploaded Provenance Actions
emoji_rs-0.1.0.tar.gz 19.0 kB With provenance Details for emoji_rs-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for emoji-rs 0.1.0
File Actions
emoji_rs-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for emoji_rs-0.1.0-cp39-abi3-win_amd64.whl
emoji_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for emoji_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
emoji_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for emoji_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
emoji_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for emoji_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
emoji_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for emoji_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 1.2 MB

Release files / emoji_rs-0.1.0.tar.gz

Download URL emoji_rs-0.1.0.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a3153a98aaa4a4009a48171f3f056f28e7a99c7738aba04730bfeddf5ec96e8f
BLAKE2b-256 checksum
How to use checksums
7a196d9e77de54a12733232394adebd8650c9bc781d18374b7b6fb5c9cc05406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / emoji_rs-0.1.0-cp39-abi3-win_amd64.whl

Download URL emoji_rs-0.1.0-cp39-abi3-win_amd64.whl
Size 165.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2c99141c5d11e672c58985321bc918036a2c20246993c8c4b03dc76a528de3d4
BLAKE2b-256 checksum
How to use checksums
eb6d3ab6f3b93e4d54f7a2601752165c2fac9ce8d09cf08e1f9bc39b9459d68d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / emoji_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL emoji_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 275.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bd18a71b3ee4d37f7ccea9a933d64767d1e3733d7889148d99d6c489896ab598
BLAKE2b-256 checksum
How to use checksums
a5d3d055c97111689097204a920be4767dabf49526c41e4be99f3f7523dba1e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / emoji_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL emoji_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 272.4 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
ec9496866a2f811d2ba215b9fc572f3e9920f61d36aca6959e2c1f842a4073fd
BLAKE2b-256 checksum
How to use checksums
29dec3b24f619497225cffc554f6b1ea0580b5ba64655bd8740f2a08d22b12ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / emoji_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL emoji_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 251.7 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d9b6d58fc56e5b0f1db129f8c90c445dbae1c138a7d700f8296e154d3a029ba9
BLAKE2b-256 checksum
How to use checksums
3c19e912c851e70477cad8e535f3e04818aa1e078c2d6e12ca620ce6ce493c12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / emoji_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL emoji_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 258.7 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f8129385af78db5fb532406f0500d9877a5f498da37852f182097bf940c4304e
BLAKE2b-256 checksum
How to use checksums
920bbbfb8f300f16736b95c10e9a91ea2fb702e0879a845e1d9c293d11200dad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for emoji-rs 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for emoji_rs-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page