Skip to content

Adds support for emoji-strings in Python, which convert emoji names into actual emoji.

License

Notifications You must be signed in to change notification settings

domdfcoding/emoji-strings

Repository files navigation

emoji-strings

Adds support for emoji-strings in Python, which convert emoji names into actual emoji.

Tests Linux Test Status Windows Test Status macOS Test Status Coverage
PyPI PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel
Activity GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads
QA CodeFactor Grade Flake8 Status mypy status
Other License GitHub top language Requirements Status

Installation

emoji-strings can be installed from PyPI.

To install with pip:

$ python -m pip install emoji-strings

Usage

Emoji strings (g-strings for short) are similar to Python's f-strings. However, rather than using curly braces, g-strings use colons to mark emoji in a string. For example, in the following sentence, :rocket: denotes a substitution, in this case for a 🚀 emoji:

Deploy the app 🚀

In a Python source file, you can write this as:

print(g"Deploy the app :rocket:")
#     ^ note the "g" prefix character

which would print:

Deploy the app 🚀

Ta da! You no longer need to remember unicode code points or use cumbersome emoji entry dialogs. To enable this magic, add the following comment to the top of your python source file:

# -*- coding: emoji_strings -*-

and add emoji-strings to your requirements.txt file.

Disclaimer

This is a joke.

While this absolutely does work I made it for fun. Someone had asked me if, since Python has f-strings, it also has g-strings? It does now.

Credits

Based on future-fstrings, and uses the emoji library to parse the emoji names.

About

Adds support for emoji-strings in Python, which convert emoji names into actual emoji.

Topics

Resources

License

Stars

Watchers

Forks