Install & Compatibility
Where this runs
tested against v0.18.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 0.404s · 43.3MB
glibcpy 3.10–3.915 runs
installs and imports cleanly · install 3.0s · import 0.364s · 47MB
44MB installed
● package 44MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Font
✓ from ufoLib2 import Font
✗ from ufoLib2.objects import Font
Font is exported at package level since v0.10.0; direct import from objects works but is not recommended.
Glyph
✓ from ufoLib2.objects import Glyph
✗ from ufoLib2 import Glyph
Glyph is not exported at package level; must import from ufoLib2.objects.
Layer
✓ from ufoLib2.objects import Layer
✗ from ufoLib2 import Layer
Layer is not exported at package level; must import from ufoLib2.objects.
Create a new UFO font, set unitsPerEm, save to a temporary directory, then reopen it.
from ufoLib2 import Font
# Create a new font
font = Font()
font.info.unitsPerEm = 1000
# Save to a temporary path (will create .ufo directory)
import tempfile
with tempfile.TemporaryDirectory() as tmpdir:
ufo_path = f"{tmpdir}/MyFont.ufo"
font.save(ufo_path)
print(f"Saved to {ufo_path}")
# Open an existing UFO
font2 = Font.open(ufo_path)
print(font2.info.unitsPerEm)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ufoLib2'
Library not installed.
AttributeError: module 'ufoLib2' has no attribute 'Glyph'
Glyph is not exported at package level.
fixfrom ufoLib2.objects import Glyph
TypeError: save() takes 1 positional argument but 2 were given
Trying to save with a file path as argument without keyword? Actually save only takes the path as positional.
fixfont.save('/path/to/font.ufo') ufoLib2.errors.UFOError: Invalid UFO version: 3
UFO file has format spec version that is not supported or malformed.
fixEnsure the UFO is valid; check ufo/lib/formatversion.txt. ufoLib2 supports UFO v3 and v2.
ImportError: cannot import name 'Font' from 'ufoLib2.objects' (unknown location)
Wrong import path or outdated version.
fixUse 'from ufoLib2 import Font' instead.
Upgrade
Version history
0.18.1latest on PyPI · released Jul 10, 2025
Audit
Dependencies
fonttoolsrequiredRequired for UFO data structures and glyph drawing
fsrequiredUsed internally for filesystem abstraction (deprecated as of 0.18.0, replaced by tempfile.TemporaryDirectory)