Metadata-Version: 2.1
Name: emojit
Version: 1.1.0
Summary: Support for emoji digits in Python
Author: Ivan Dmitrievskii
Author-email: yellow.iron9441@headless.place
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Description-Content-Type: text/markdown

# Emojit

This package aims to address a long-standing Python issue:
```python
int("1️⃣") != 1
```

## Usage

```python
from emojit import emj

emoji_str = emj("4️⃣0️⃣2️⃣")

assert isinstance(emoji_str, str) is True
assert int(emoji_str) == 402
```
<sub><sup>Please, don't actually use this.</sup></sub>

## Simplified usage

You can simplify the previous example as:
```python
# coding: emoji-digit

emoji_str = "4️⃣0️⃣2️⃣"

assert isinstance(emoji_str, str) is True
assert int(emoji_str) == 402
```

To achieve this, you have to do two things. Find your `site-packages` directory:
```shell
python -c "import site; print(site.getsitepackages())"
```

And then create a new file called `sitecustomize.py` in this directory with the following contents:
```python
import builtins
import codecs

import emojit
import emojit.emoji_digit_codec

builtins.emj = emojit.emj

codecs.register(emojit.emoji_digit_codec.search_function)
```

You can read more about codecs [here](https://docs.python.org/3/library/codecs.html).

## Advanced usage

### Underscores as visual separators

```python
from emojit import emj

assert int(emj("4️⃣0️⃣2️⃣_0️⃣0️⃣0️⃣")) == 402_000
```

### Shorthand emojis

```python
from emojit import emj

assert int(emj("🔟")) == int(emj("1️⃣0️⃣"))
assert int(emj("💯")) == int(emj("1️⃣0️⃣0️⃣"))
assert int(emj("🔢")) == int(emj("1️⃣2️⃣3️⃣4️⃣"))
```

## Support

This package is considered feature complete. It will be archived once the functionality is upstreamed into the Python standard library.

