Registry / serialization / ufoLib2

ufoLib2

JSON →
library0.18.1pypypi✓ verified 85d ago

ufoLib2 is a UFO font processing library for reading, writing, and manipulating Unified Font Object (UFO) files. It provides Python objects for font, layer, glyph, and other UFO structures with lazy loading and efficient serialization. Current version: 0.18.1. Requires Python >=3.9. Maintained by the fonttools project; release cadence is irregular with several minor releases per year.

pip install ufoLib2
INSTALL
IMPORT
SIG · UFOLIB2
U
ufoLib2
serializationpythonv0.18.1
Install
3.0s avg
Import
384ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.915 runs
installs and imports cleanly · install 0.0s · import 0.404s · 43.3MB
glibc
py 3.103.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)
Debug
Known issues
breakingPython 3.8 support dropped in v0.18.0. Use Python >=3.9.
fix
Upgrade Python to 3.9 or later.
affects: >=0.18.0
deprecatedThe 'fs' module (import fs) will be removed; replaced with tempfile.TemporaryDirectory. Do not rely on fs internals.
fix
Replace usage of tempfs with tempfile.TemporaryDirectory.
affects: >=0.18.0
gotchaFont objects are lazily loaded by default. Modifying glyphs or layers may require explicit loading.
fix
Access properties or call .load() to trigger loading. Use Font.open(ufo, lazy=False) to disable lazy loading.
affects: all
gotchaSaving a UFO creates a directory (UFO format) not a single file. Ensure the save path ends with .ufo and the parent directory exists.
fix
Use font.save('/path/to/MyFont.ufo') which creates a directory.
affects: all
breakingcattrs minimum version upped to 1.10.0 as of v0.13.1. Older cattrs may cause errors with converters.
fix
Ensure cattrs >=1.10.0 is installed if using converters extra.
affects: >=0.14.0
deprecatedUse of 'from ufoLib2.objects import Font' is discouraged; prefer 'from ufoLib2 import Font'.
fix
Change import to 'from ufoLib2 import Font'.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ufoLib2'
Library not installed.
fix
pip install ufoLib2
AttributeError: module 'ufoLib2' has no attribute 'Glyph'
Glyph is not exported at package level.
fix
from 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.
fix
font.save('/path/to/font.ufo')
ufoLib2.errors.UFOError: Invalid UFO version: 3
UFO file has format spec version that is not supported or malformed.
fix
Ensure 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.
fix
Use '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)
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
ufoLib2 — pip install ufoLib2 · libregistry