v0.4.0
Richer data objects, a typed exception hierarchy, and a fix for the audio pull
Breaking Changes
-
JSON Output Shape→ The CLI--jsonoutput now followsPydantic's
model_dump_json. Field names are unchanged and Japanese text stays verbatim,
but the exact shape may differ from0.3.0, which0.xSemVer allows -
DTO Serialization→ TheSerializablemixin and itsto_dict/
to_jsonhelpers are removed, serialize thePydanticDTOswith
model_dump/model_dump_jsoninstead -
Bad-Argument Errors→ TheAPInow raisesAPIErrorfrom the new
hierarchy on invalid arguments instead ofValueError
Added
-
Data-Facing DTO Methods→ The data objects gained pure helpers such as
JMDictEntryDTO.all_pos/common_kanji,SenseDTO.all_tags/
expand_tags,KanjiDTO.skip_codes/is_joyo, andLookupResult.has_* -
Exception Hierarchy→ A newkotobase.exceptionsmodule rooted atKotobaseError
(DatabaseError,SourceExtractionError,DownloadError,APIErrorand
their leaves), re-exported from the top-level package -
New API Methods→words_with_kanji,sentences_with_kanjiand
resolve_references(each accepting aDTOor a string), plus amatch
argument onby_radicalsto find kanji containing any of a set of radicals
as well as all of them -
DTO Arguments→ The key-taking methods now accept aDTOas well as a
string, reading the lookup key off the object, so a result from one call can
be passed straight into another (e.g.sentences(entry),stroke_svg(kanji)) -
Test Suite→ Apytestsuite run against a tiny fixture database, with
coverage reported toCodecovacrossPython3.10 to 3.13
Changed
-
Pydantic DTOs→ The data objects are nowPydanticmodels that carry
data-facing behaviour and are built withmodel_validatestraight from the
ORMrows -
Typed Errors→ Repositories wrap unexpected database failures as
DatabaseError, and the build pipeline raisesDownloadError/
SourceExtractionError. TheCLIrenders anyKotobaseErroras a friendly
message instead of a traceback
Fixed
Audio Pull→kotobase db pullpreviously rebuilt the audio database
locally from theKanji Alivesources instead of pulling the pre-built
kotobase-audio.db.zstrelease asset