https://github.com/emoji-gen/ecode-py
🎼 The emoji code utilities for Python
https://github.com/emoji-gen/ecode-py
emoji python python3
Last synced: 4 months ago
JSON representation
🎼 The emoji code utilities for Python
- Host: GitHub
- URL: https://github.com/emoji-gen/ecode-py
- Owner: emoji-gen
- License: mit
- Created: 2019-08-27T14:44:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-07T23:24:26.000Z (over 2 years ago)
- Last Synced: 2025-01-22T15:30:21.717Z (6 months ago)
- Topics: emoji, python, python3
- Language: Python
- Homepage: https://pypi.org/project/ecode/
- Size: 145 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ecode-py
[](https://travis-ci.com/emoji-gen/ecode-py)
[](https://codecov.io/gh/emoji-gen/ecode-py)
[](https://badge.fury.io/py/ecode):musical_score: The emoji code utilities for Python
## Requirements
- Python 3.6 or later## Getting started
### Pip```shell script
$ pip install ecode
```### Poetry
```shell script
$ poetry add ecode
```## Usage
### Encoding```python
from ecode import *ecode = Ecode(
locale=EcodeLocale.EN,
flags=frozenset(EcodeFlag.SIZE_FIXED, EcodeFlag.STRETCH),
align=EcodeAlign.CENTER,
size=EcodeSize.XHDPI,
format=EcodeFmt.WEBP,
font_id=0xcf,
foreground_color=0x12345678,
background_color=0x9abcdef0,
text='ab\nc'
)code = EcodeEncoder().encode(ecode)
print(code) #=> 'BA0hzxI0VniavN7wYWIKYw'
```### Decoding
```python
from ecode import EcodeDecoderecode = EcodeDecoder().decode('BA0hzxI0VniavN7wYWIKYw')
print(ecode.text) #=> 'ab\nc'
```## Development
You should install [Poetry](https://python-poetry.org/) first to develop.```shell script
$ pip install poetry
```### Install requirements
```shell script
$ poetry install
```### Upgrade requirements
```shell script
$ poetry update
```### Test
```shell script
$ poetry run pytest # Test
$ poetry run mypy -p ecode # Type checking
```### Publish
```shell script
$ ./scripts/publish-pypi.sh
```## Ported projects
|Name|Language|
|---|---|
|[ecode-java](https://github.com/emoji-gen/ecode-java)|Java|
|[ecode-js](https://github.com/emoji-gen/ecode-js)|JavaScript|## License
MIT © [Emoji Generator](https://emoji-gen.ninja)