Communication & Formats ยท zero-dependency ยท MIT

larzphone

Parse, validate and format phone numbers to E.164.

A libphonenumber-style helper without the multi-megabyte metadata: parse a messy number into country and national parts, validate its length, and format it as E.164, international or national - all offline, from a compact built-in table.

larzscript pkg install phone
View on GitHub →Learn the stack

What you get

Try it

import "phone" as phone
let p = phone.parse("+14155552671")
print(p["country_code"], p["national_number"], p["valid"])
print(phone.format_e164(p))
print(phone.format_international(p))
Output
1 4155552671 true
+14155552671
+1 4155552671

Why it's in the Larz Stack

larzphone is a real Larzscript package (larzscript pkg install phone) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.