{"id":6283,"library":"types-emoji","title":"Typing Stubs for Emoji","description":"`types-emoji` provides static type checking definitions for the popular `emoji` Python library. It enables type checkers like MyPy to understand the types used in `emoji.emojize()`, `emoji.demojize()`, and other functions, improving code reliability and developer experience. This package is part of the `typeshed` project, which maintains external type annotations for numerous Python libraries and the standard library. `types-emoji` follows the release cadence of `typeshed`, which is often independent of the runtime `emoji` library's release schedule.","status":"active","version":"2.1.0.3","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","emoji","typeshed","static analysis"],"install":[{"cmd":"pip install types-emoji","lang":"bash","label":"Install typing stubs"},{"cmd":"pip install emoji","lang":"bash","label":"Install runtime library (required for execution)"}],"dependencies":[{"reason":"Runtime library for which these are type stubs.","package":"emoji","optional":false}],"imports":[{"wrong":"from emoji-stubs import emojize","symbol":"emojize","correct":"from emoji import emojize"},{"wrong":"from emoji-stubs import demojize","symbol":"demojize","correct":"from emoji import demojize"}],"quickstart":{"code":"import emoji\nimport os\n\n# Example 1: Convert shortcode to emoji\ntext_with_emoji = emoji.emojize(\"Python is fun :red_heart:\")\nprint(f\"Emojized: {text_with_emoji}\")\n\n# Example 2: Convert emoji to shortcode\ntext_with_shortcode = emoji.demojize(\"Python is fun ❤️\")\nprint(f\"Demojized: {text_with_shortcode}\")\n\n# Example 3: Check if a string contains an emoji\nhas_emoji = emoji.is_emoji(\"👍\")\nprint(f\"Is '👍' an emoji? {has_emoji}\")\n\n# Example 4: Using language-specific shortcodes (e.g., Spanish)\nspanish_text_emojized = emoji.emojize(\"Python es :pulgar_hacia_arriba:\", language='es')\nprint(f\"Spanish emojized: {spanish_text_emojized}\")\n\nspanish_text_demojized = emoji.demojize(\"Python es 👍\", language='es')\nprint(f\"Spanish demojized: {spanish_text_demojized}\")\n\n# Example 5: Using variant for emoji presentation (if supported)\nheart_emoji_type = emoji.emojize(\"Python is fun :red_heart:\", variant=\"emoji_type\")\nprint(f\"Heart emoji type: {heart_emoji_type}\")","lang":"python","description":"This quickstart demonstrates basic usage of the `emoji` library's core functions: `emojize` to convert text shortcodes into Unicode emojis, `demojize` to reverse this process, `is_emoji` to detect emojis, and how to use language-specific shortcodes or presentation variants."},"warnings":[{"fix":"Ensure both `types-emoji` and `emoji` are installed in your environment.","message":"`types-emoji` provides only type hints for static analysis. To execute Python code that uses emoji functionalities, you must also install the actual `emoji` runtime library (e.g., `pip install emoji`).","severity":"gotcha","affected_versions":"All versions of `types-emoji`"},{"fix":"Ideally, align the version bounds of `types-emoji` with your `emoji` runtime library version. Regularly update your type checker and stubs, addressing any new type errors as they arise, or pin `types-emoji` to a specific version if strict stability is required for type checking.","message":"As `types-emoji` is part of `typeshed`, any version bump might introduce changes to type annotations that could cause your code to fail type checking, even if the underlying `emoji` runtime library remains unchanged. This can happen due to more precise type definitions or bug fixes in stubs.","severity":"breaking","affected_versions":"All versions of `types-emoji`"},{"fix":"Pass the appropriate `language` argument to `emojize()` or `demojize()` if you are not using English shortcodes or require alias support.","message":"Emoji shortcodes in `emoji.emojize()` and `emoji.demojize()` default to English. If you intend to use shortcodes from other languages (e.g., Spanish, Portuguese, French) or enable a broader set of aliases, you must explicitly provide the `language` argument (e.g., `language='es'` or `language='alias'`).","severity":"gotcha","affected_versions":"All versions of `emoji` (runtime library)"},{"fix":"Use the `variant` argument if a specific emoji presentation is desired, especially when dealing with mixed environments or older systems.","message":"Some emojis have different Unicode presentation styles (e.g., text vs. emoji presentation). For explicit control over the output, `emoji.emojize()` supports a `variant` argument (e.g., `variant='emoji_type'`).","severity":"gotcha","affected_versions":"All versions of `emoji` (runtime library)"}],"env_vars":null,"search_vec":"'analysi':89 'annot':54 'cadenc':69 'check':11 'checker':22 'code':37 'definit':12 'develop':40 'emoji':4,7,16,65,79,86 'emoji.demojize':32 'emoji.emojize':31 'enabl':20 'experi':41 'extern':52 'follow':66 'function':35 'improv':36 'independ':75 'librari':18,58,62,80 'like':23 'maintain':51 'mypi':24 'numer':56 'often':74 'packag':43 'part':45 'popular':15 'project':49 'provid':8 'python':17,57 'releas':68,82 'reliabl':38 'runtim':78 'schedul':83 'standard':61 'static':9,88 'stub':2,85 'type':1,6,10,21,28,53,64,84 'types-emoji':5,63 'typesh':48,71,87 'understand':26 'use':29","created_at":"2026-04-14T18:49:53.643854+00:00","updated_at":"2026-04-16T23:35:49.233391+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'emoji'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.1.0.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/emoji.md","pypi":"https://pypi.org/project/types-emoji/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}