RISify
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.
Metadata
Release files for RISify 1.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| risify-1.2.7.tar.gz | 17.5 kB | Without provenance | Details for risify-1.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| risify-1.2.7-py3-none-any.whl | Python 3 | none | any | Details for risify-1.2.7-py3-none-any.whl |
Total release size: 35.1 kB
Release files / risify-1.2.7.tar.gz
| Download URL | risify-1.2.7.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11f0d2dfe5f7be823459a74ec568a9360133263f39f4af63de2cf21d44e89d08
|
|
BLAKE2b-256 checksum How to use checksums |
6243ed0cbb80671b163ad52190aca18b48b9c4af8f328b1da89ea5e541291772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / risify-1.2.7-py3-none-any.whl
| Download URL | risify-1.2.7-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfafc054e841fb279e564d7db794b288c6367dad43a0d6ff6061da23d6e309db
|
|
BLAKE2b-256 checksum How to use checksums |
4c5e37faa0b547b205d29328d874a3c43d0274c5e46ca1557c6fadc3f83413d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for RISify 1.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.