Would you consider immichpy for the Immich client layer?
Hi Ivamic,
I like how immich-steward suggests locations on a map and writes nothing to Immich until you confirm. I maintain immichpy, a typed async Immich client generated from the OpenAPI spec and re-released for every Immich version.
Your immich/ package keeps its own Pydantic models and error mapping. immichpy ships both, generated: UnauthorizedException, ForbiddenException and one model for each Immich DTO. That would keep client.py in sync with Immich without hand edits. smart_search:
from immichpy.client.generated import SmartSearchDto
res = await client.search.search_smart(SmartSearchDto(query=query, size=size, page=1, language=language))
return [a.id for a in res.assets.items] # already UUIDs
immichpy uses aiohttp under the hood rather than httpx.
Versioning: each immichpy major covers a range of Immich versions (mapping), so the pin would replace the hand-kept check in compat.py. You'd pin the one matching the Immich you target, e.g. immichpy>=10,<11 for 3.4. Bumping the major in one of your releases raises your minimum.
immich-folder-album-creator migrated recently. Happy to do the PR if you think it fits.
Timon
Hi Timon,
thanks for looking at the code so closely, and for the concrete example.
I'll keep the hand-written client for now, for a few reasons:
- Thumbnails and videos are streamed through httpx, so immichpy would add aiohttp next to it rather than replace anything.
- The client is small (about 25 calls), and its models only hold the fields Steward reads, so new or changed fields in Immich responses don't break it.
- Steward currently accepts any Immich 3.x. Pinning an immichpy major per Immich range would tie Steward releases to Immich releases and raise the minimum more often.
If the client grows a lot or the hand-kept models become a burden, I'll gladly look at immichpy again. Good luck with the project!
Thanks for the thoughtful reply, makes total sense for a client of that size. Your point about tolerant models inspired me to loosen and dedupe the strictness on immichpy's side: since v10.2.0, unknown enum values from newer Immich servers no longer break parsing, and the redundant UUID/date regexes are gone (v7 UUIDs now parse too).
For versioning this means an immichpy release keeps working against newer Immich servers until Immich makes an actual breaking API change, and only those bump immichpy's major. Additive changes like new fields or enum values don't.
On deps, I also slimmed the runtime dependencies in #210, though aiohttp stays as it's what the generator builds on.
Good luck with Steward!