I was wondering what client side code generator is available equivalent to the server side koxudaxi/fastapi-code-generator. I don’t like what the OpenAPITools/openapi-generator generates. I need something which makes use of pydantic models? Other generators I’ve found so far on GitHub (sorry, I’m not allowed to post a lot of links yet):
sennder/python-client-generator
DamianSop/pydantic_rest_client
essembeh/rapid-api-client
mom1/api-client-pydantic
(mom1/apiclient-pydantic-generator > deprecated)
(MikeWooster/api-client > ?)
Has someone already used one/some of them and provide some experience?
Thx for the hint. Do you know some open source repo which makes use of/is generated with open-api-client? Would be interesting ohw the code looks like (support for pagination, …).
Note that since PDM and uv both use standard pyproject.toml metadata, you can use the PDM output type and then adapt it with very minor changes to work with uv. That is what we do.
For direct uv support, you can vote for and follow
I’ve been slowly tinkering away in this space. I always find open api client generators suck - they’re obtuse, not ver pythonic, hard to maintain and generally more annoying that useful. The last time I built a whole client lib from scratch I realised to myself - “if this is how I want a client lib to look, can I build a generator to produce this?” So working backwards I came up with https://github.com/phalt/clientele
I’ve been slowly extending it out to have more features. The goal is a “run once” or “run when this change” lib that offers readable, extendable generated code with modern things like httpx, pydantic etc.
It already supports:
Pydantic
Async through httpx (optionally)
Fully typed on output
Fully formatted on output with ruff
Configuration that never gets overwritten
Server’s schema changed? Run the generator again and you now are up to date. The git diff will show you what has changed.
Lemme know if you see feedback on what I can do to improve it. Alway felt like open api had potential but the last mile for client generators really let it down.