RISify (1.2.4)

Published 2026-01-30 17:20:49 +01:00 by michael in parcifal/ris-py

Installation

pip install --index-url  RISify

About this package

Simplifies the encoding and decoding of Regional Indicator Symbols

RISify

develop master test.pypi.org pypi.org

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 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@forgejo.van-de-weerd.net:parcifal/ris-py.git
cd ris-py
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.

Details
PyPI
2026-01-30 17:20:49 +01:00
2
34 KiB
Assets (2)
Versions (1) View all
1.2.4 2026-01-30