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.0.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.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nano_roman-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 ef7bca95211cec0870a1042e7353b754177dd54c1a134eba2e34afd3051daff2
MD5 8b91e32f6b1334a5195f8b7f8f3e163c
BLAKE2b-256 c4cdba7728c5154d00b22b7f22872c9a396f2b62db2b4b27cc1cc47823a365b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nano_roman-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ee989ff6fe4bd26399e24af677b5086b3a75df0ec70a556c42c9a52db778265
MD5 8d16d7d29a14b14212b747c591a0321a
BLAKE2b-256 84c8f6e772a7f2811433f05d2eb4c2d1b05e9b682105b95152b504cd999c6388

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