Simplifies the encoding and decoding of Regional Indicator Symbols https://pypi.org/project/RISify/
Find a file
Michaël van de Weerd e56caed94d
All checks were successful
/ test (push) Successful in 9s
/ lint (push) Successful in 10s
/ setup (push) Successful in 3s
/ build (push) Successful in 6s
/ publish (push) Successful in 2s
/ release (push) Successful in 5s
update readme
2026-08-22 11:32:40 +02:00
.forgejo/workflows bump python build version 2026-08-22 11:27:06 +02:00
.idea update repos, renamed assets 2026-08-22 11:09:31 +02:00
assets update repos, renamed assets 2026-08-22 11:09:31 +02:00
ris Fixed log formatting, fixed pylint in CI 2025-09-01 08:58:05 +02:00
test Refactor, added CLI, updated README, restructured project, improved CI 2025-08-31 14:24:17 +02:00
.coveragerc Refactor, added CLI, updated README, restructured project, improved CI 2025-08-31 14:24:17 +02:00
.gitignore Forgejo Migration (#2) 2026-01-28 05:06:12 +01:00
LICENSE Refactor, added CLI, updated README, restructured project, improved CI 2025-08-31 14:24:17 +02:00
pyproject.toml update repos, renamed assets 2026-08-22 11:09:31 +02:00
pytest.ini Forgejo Migration (#2) 2026-01-28 05:06:12 +01:00
README.md update readme 2026-08-22 11:32:40 +02:00

RISify

release pypi develop master gitlab github

RISify logo

RISify is a Python library and CLI for working with Regional Indicator Symbols (RIS): the Unicode characters used to represent country and region flags.

It provides:

  • Encoding and decoding between RIS, ASCII, and HTML entities
  • Upper- and lowercase ASCII variants
  • Safe HTML output using markupsafe
  • Concatenation and comparison support

Licensed under the AGPLv3.0

The RISify logo uses the Faroese flag from the Twemoji project © 2017 Twitter, licensed under CC-BY 4.0.

Installation

RISify is available on PyPI:

pip install RISify

Or install directly from source:

git clone git@scm.parcifal.dev:parcifal/RISify.git
cd RISify
pip install .

Usage (API)

Basic Conversion

from ris import ris

# decode a country code to RIS
pt = ris("PT")
print(pt)  # 🇵🇹

HTML to RIS

de = ris("🇩🇪").encode("unicode")
print(de)  # 🇩🇪

RIS to ASCII (upper/lower)

nl = ris("🇳🇱").encode("ascii").upper()
print(nl)  # NL

eu = ris("🇪🇺").encode("ascii").lower()
print(eu)  # eu

RIS to HTML

fo = ris("🇫🇴").encode("html")
print(fo)  # 🇫🇴

Concatenation

print("spam " + pt + " bacon " + de + " sausage " + nl + " eggs " + eu + " ham " + fo)
# spam 🇵🇹 bacon 🇩🇪 sausage 🇳🇱 eggs 🇪🇺 ham 🇫🇴

Usage (CLI)

Installing RISify also provides a ris command-line tool:

ris NL  # 🇳🇱

Options

usage: ris [-h] [-a | -A | -u | -H] [-v] [-l OUTPUT_LOG] [-V] value

Convert a country code to a RIS code.

positional arguments:
  value                 input text (ascii, ris or html) to convert

optional arguments:
  -h, --help            show this help message and exit
  -a, --ascii           output as a country code in lowercase ascii
  -A, --ASCII           output as a country code in uppercase ascii
  -u, --unicode         output as a ris code in unicode (default)
  -H, --html            output as a ris code in html
  -v, --verbose         increase verbosity
  -l OUTPUT_LOG, --output-log OUTPUT_LOG
                        output log file (defaults to stdout)
  -V, --version         show program's version number and exit

Examples

# convert iso country code to ris
ris PT  # 🇵🇹

# convert ris to ascii uppercase
ris 🇳🇱 --ASCII  # NL

# convert ris to ascii lowercase
ris 🇪🇺 --ascii  # eu

# convert iso country code to html entities
ris FO --html  # 🇫🇴

# increase verbosity and log to file
ris PT -vvv -l ris.log

Contributing

Found a bug? Have a suggestion? Open an issue or submit a merge request at the Forgejo repository. All contributions are welcome.