Skip to main content

Tiny Roman↔Decimal converter in ~1KB (zero deps)

Project description

nano-roman

PyPI License Size CI

World’s tiniest Roman ↔ Decimal number converter — ~1 KB, zero deps. Single-file, CLI included. Perfect for code-golf, minimal containers, or just for fun.


✨ Features

  • int → ROMAN and ROMAN → int (case-insensitive)
  • ✅ Standard subtractive forms: IV, IX, XL, XC, CD, CM
  • ✅ Classic 1–3999 supported; >3999 continues with repeated M
  • ✅ Zero dependencies, single tiny file
  • ✅ CLI: nano-roman

🚀 Usage

# Local (from repo)
python app_min.py 3999   # MMMCMXCIX
python app_min.py XL     # 40

After installing:

# CLI
pip install nano-roman
nano-roman 1984   # -> MCMLXXXIV
nano-roman XLII   # -> 42
nano-roman mmxxv  # -> 2025

🤓 Why so small?

  • Minimal token table (S and V) + greedy subtractive matching
  • No heavy parsing/regex trees, no dependencies
  • Single module + tiny CLI wrapper

🎉 Fun Ideas

  • Convert the current year
(Get-Date -Format yyyy) | % { nano-roman $_ }   # 2025 -> MMXXV
date +%Y | xargs nano-roman                     # 2025 -> MMXXV
  • “Roman clock” (hour only)
  (Get-Date -Format HH) | % { nano-roman $_ }     # 14 -> XIV
date +%I | xargs nano-roman                     # 07 -> VII
  • Git tag in Roman
git tag "v$(nano-roman 2025)" && git push origin "v$(nano-roman 2025)"
  • Batch convert a list
printf "4\n9\n42\n1999\n" | while read n; do nano-roman "$n"; done
# IV, IX, XLII, MCMXCIX
  • Quick Windows alias
Set-Alias r nano-roman
r 3999   # -> MMMCMXCIX

Note: Classical Roman numerals have no zero and no negative values.


📜 License

MIT © 2025

Project details


Download files

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

Source Distribution

nano_roman-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

nano_roman-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file nano_roman-0.1.1.tar.gz.

File metadata

  • Download URL: nano_roman-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for nano_roman-0.1.1.tar.gz
Algorithm Hash digest
SHA256 144fe8070b98f9a828c53c6c955496b0b48069ce4004c7bc81636d9cb3e03993
MD5 d5296e1994bdb8c44012b4e4c5052cb4
BLAKE2b-256 9238c1fe45cee409cb10afddbc49a9a3979250b99a33eb66372bf41e94b25582

See more details on using hashes here.

File details

Details for the file nano_roman-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nano_roman-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for nano_roman-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5de8eafbf1583368a20419a6e9cd0d99f22c21e6fa3e623e3bec48e7e3840a0
MD5 05a6a86efa0db9e0e575eaa4fa108830
BLAKE2b-256 d8035eacc23113231213b1cf776c8d22b9fd439c37e43021fb981ee1938cb16e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page