Communication & Formats — Talking to the World
Real apps email people, send calendar invites, handle phone numbers, and exchange XML. The stack covers each — correctly, and safely.
Beyond money, data and security, applications have to talk to the outside world: send email and calendar invites, handle phone numbers from anywhere, exchange XML with partners, and print codes. Each of these has fiddly, easy-to-get-wrong details — and the Larz Stack has a zero-dependency library that gets them right.
The communication & formats family
Six libraries cover the ways apps reach people and exchange data.
| Library | What it does |
|---|---|
| larzemail | Build, parse and send MIME email (attachments, HTML+text) |
| larzical | iCalendar (RFC 5545) invites and feeds Google/Apple/Outlook accept |
| larzphone | Parse/validate/format phone numbers to E.164, offline |
| larzxml | Ergonomic XML builder + an XXE-safe parser |
| larzbarcode | EAN-13 and Code 128 barcodes as SVG |
| larztui | Pretty terminal UI — panels, tables, rules |
The theme repeats: each replaces a fiddly task (or an unsafe default) with a small, correct, zero-dependency library.
Correct where it's easy to be wrong
These formats bite you in the details. A calendar invite silently fails if the line folding is wrong; an XML parser is a security hole if it trusts DTDs. The stack handles both.
from larzical import Calendar, Event
from larzemail import Email
from datetime import datetime
cal = Calendar()
cal.add(Event(summary='Kickoff', start=datetime(2026,8,1,15,0)))
# attach the invite to an email, in a few lines:
(Email(subject='Invite', from_addr='me@acme.com', to=['you@x.com'])
.body(text='See attached.')
.attach('event.ics', cal.to_ical(), 'text/calendar'))Phone numbers and codes
Two more everyday needs: normalising phone numbers and printing scannable codes.
from larzphone import parse
parse('0803 123 4567', region='NG').e164() # '+2348031234567' — store this
from larzbarcode import ean13
ean13('400638133393').to_svg('product.svg') # check digit added automatically🎯 Key takeaways
- Apps must talk to the world: email, calendars, phone numbers, XML and codes — the stack covers each.
- larzemail + larzical compose (attach an .ics invite to an email in a few lines).
- larzxml is XXE-safe by construction; larzphone normalises any number to storable E.164.
- larzbarcode prints retail/label codes as SVG; larztui makes CLI output readable.
Frequently asked
Why not use Python's built-in email and XML modules?
You can, and the stack builds on them where it makes sense (larzemail wraps the stdlib email package). The value is ergonomics and safety: larzemail turns a multi-step MIME dance into one object, and larzxml's parser is safe against XXE and billion-laughs by default — where the stdlib's is not unless you harden it yourself. Each library removes a common footgun.
Do these have external dependencies?
No — like everything in the Larz Stack, all six are pure Python depending only on the standard library. larzical implements RFC 5545 line-folding itself, larzphone ships its own compact region metadata, larzbarcode carries the standard barcode pattern tables. Nothing is pulled in behind them.
Related lessons
Putting It Together with the Larz Framework
The libraries shine alone — but they were also designed to click into the Larz web framewo…
Building with the Larz StackSecurity & Identity — Crypto You Can Trust
Security code is where 'roll your own' is scariest — so this family sticks to standard, RF…
Building with the Larz StackWhat the Larz Stack Is (and Why Zero-Dependency)
Modern software drowns in dependencies — hundreds of packages you never read, each a risk.…