Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

risify-1.2.7.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

risify-1.2.7-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file risify-1.2.7.tar.gz.

File metadata

  • Download URL: risify-1.2.7.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.5

File hashes

Hashes for risify-1.2.7.tar.gz
Algorithm Hash digest
SHA256 11f0d2dfe5f7be823459a74ec568a9360133263f39f4af63de2cf21d44e89d08
MD5 3dc5fe0751e0a9560fa20a5895ae43d0
BLAKE2b-256 6243ed0cbb80671b163ad52190aca18b48b9c4af8f328b1da89ea5e541291772

See more details on using hashes here.

File details

Details for the file risify-1.2.7-py3-none-any.whl.

File metadata

  • Download URL: risify-1.2.7-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.5

File hashes

Hashes for risify-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 dfafc054e841fb279e564d7db794b288c6367dad43a0d6ff6061da23d6e309db
MD5 40b5659eedcc4a9428e4ca77b946e4da
BLAKE2b-256 4c5e37faa0b547b205d29328d874a3c43d0274c5e46ca1557c6fadc3f83413d0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.7 This release

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page