# Emoji encoding for 🐍
This module provides a custom source code encoding allowing usage of Emoji's for things like variable names or function names.
## Usage
Install the package with pip:
```
pip install emoji-encoding
```
**It's recommended to install it in [a virtualenv](https://virtualenv.readthedocs.org/en/latest/)**
After installation you can specify the encoding in the beginning of a Python file:
```python
# -*- coding: emoji -*-
def 📢(✉️):
print(✉️)
📢("✋ 🌏")
```
## Uninstalling
This package will create `emoji.pth` file in your `site-packages` directory to autoload the codec. After removing the module you need to remove this file manually.
## Known issues
Currently the encoding is only available in imported modules so trying to run Emoji encoded file directly will fail:
```
$ python emoji.py
File "emoji.py", line 1
SyntaxError: encoding problem: emoji
```
Easy workaround is to have an another file that imports the Emoji encoded file:
```shell
$ cat bootstrap.py
import emoji
$ python bootstrap.py
✋ 🌏
```
## History
It all started with Ola Sendecka's talk about [Emoji Driven Development](https://speakerdeck.com/jezdezcon/ola-sendecka-emoji-driven-development) which made me wonder: "why *can't* we use Emoji's in Python?". After a bit of hacking I was able to use them [with a patched cpython](https://twitter.com/suda/status/614814994367168512). This wasn't a perfect solution so playing with this idea I ended up with custom [codec](https://docs.python.org/3/library/codecs.html) that translates Emoji's to their ASCII representations and adds prefix/suffix to decode such unique string back to Unicode.
This module provides a custom source code encoding allowing usage of Emoji's for things like variable names or function names.
## Usage
Install the package with pip:
```
pip install emoji-encoding
```
**It's recommended to install it in [a virtualenv](https://virtualenv.readthedocs.org/en/latest/)**
After installation you can specify the encoding in the beginning of a Python file:
```python
# -*- coding: emoji -*-
def 📢(✉️):
print(✉️)
📢("✋ 🌏")
```
## Uninstalling
This package will create `emoji.pth` file in your `site-packages` directory to autoload the codec. After removing the module you need to remove this file manually.
## Known issues
Currently the encoding is only available in imported modules so trying to run Emoji encoded file directly will fail:
```
$ python emoji.py
File "emoji.py", line 1
SyntaxError: encoding problem: emoji
```
Easy workaround is to have an another file that imports the Emoji encoded file:
```shell
$ cat bootstrap.py
import emoji
$ python bootstrap.py
✋ 🌏
```
## History
It all started with Ola Sendecka's talk about [Emoji Driven Development](https://speakerdeck.com/jezdezcon/ola-sendecka-emoji-driven-development) which made me wonder: "why *can't* we use Emoji's in Python?". After a bit of hacking I was able to use them [with a patched cpython](https://twitter.com/suda/status/614814994367168512). This wasn't a perfect solution so playing with this idea I ended up with custom [codec](https://docs.python.org/3/library/codecs.html) that translates Emoji's to their ASCII representations and adds prefix/suffix to decode such unique string back to Unicode.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
emoji-encoding-0.0.5.tar.gz
(4.3 kB
view details)
File details
Details for the file emoji-encoding-0.0.5.tar.gz.
File metadata
- Download URL: emoji-encoding-0.0.5.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df13b58f9fdd2f53a78dad6e274cdaf9797ebe6f584812f848a2889b10457558
|
|
| MD5 |
2f8ad818927e4e1752bce0a786f8394c
|
|
| BLAKE2b-256 |
86b1c17e333c2c45615119d7c6303eae1d8800cc3664be7ae91289c2f3479228
|