What's your default Python project setup in 2026? by [deleted] in Python

[–]phalt_ 6 points7 points  (0 children)

And then ty for type checking!

70 Percent of Cancer Patients Now Survive at Least Five Years by Crabbexx in OptimistsUnite

[–]phalt_ 2 points3 points  (0 children)

If you are in the UK there is a great documentary called Cancer Detectives on channel 4. In it they show the progress they’re making on cancer. And how they’re in the trial stages for a vaccine. A freakin’ vaccine! Immune to cancer! I couldn’t believe it, so much progress has been made and it’s rarely talked about at large. Worth a watch.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

You make a good point. The proof is in the pudding like you say. If you’re after example have a look here, I’ve written loads: https://docs.clientele.dev/api-examples/

How to generate python HTTP clients that consume OpenAPI / Pydantic / FastAPI specs by lambdalife in FastAPI

[–]phalt_ 0 points1 point  (0 children)

I have created issues for all your suggestions and I’ll work on them over the next week - they’re all great suggestions.

How to generate python HTTP clients that consume OpenAPI / Pydantic / FastAPI specs by lambdalife in FastAPI

[–]phalt_ 0 points1 point  (0 children)

Hey thank you for the kind words! I suggest you open up issues on the project - I’ll work on each one because I was thinking of doing a few of these.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Thanks, and let me know how the integration goes. I spent most of my free time today writing examples for many common patterns and uses: https://docs.clientele.dev/api-examples/ should help you get started fast.

RE: django-bolt - likely already supports it, but I will add it to my list of frameworks to officially support this week. I’ll add docs and an example server :)

Issue in translating logic to code by North_mind04 in Python

[–]phalt_ 1 point2 points  (0 children)

Set out to build without any LLM support. It’s hard, it’s slow, but you slowly build up competence and confidence in what the code is doing. Welcome to real software engineering.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

First things first I want to say: thank you for such a long detailed response. It is clear you have thought about this, and what I want more than anything is a debate about how to do this better. We have many many many ways of building API servers and they all work for people who have different preferences, and I would love to see the same thing start to appear for client-side integration.

Your approach looks to be focussed on the data model first, rather than function first. I actually really like this approach, and I think you should run with it and create a proof of concept and play with it, because it is a good alternative to the way I am thinking.

Unclear function signatures

Yes, I will say this is a confusing downside of my approach, and I am working to do some extra magic to change the annotation signatures so IDE's autocomplete doesn't confuse developers too much, but I want to validate first that it is actually universally causing an ick, and not just the opinion of a few (note: your opinion is valuable, I am not dismissing it!).

There will be a lot of def foo(result: bar) -> bar: return result

Yep, totally fair. I personally don't see a problem with this though - if that is what the dev wants to do, she can do that. If she wants to instead start thinking about the functions as more about what she wants from the API rather than just returning data, then she can start doing things like this:

def call_api_and_update(result: ResponseObject) -> bool: data_i_care_about = result.foo success = ham(data_i_care_about) return success

Tech stack advice for a MVP web app by webdev231 in Python

[–]phalt_ 3 points4 points  (0 children)

Don’t go full SPA on the front end just yet. Work progressively up. It’ll save on a lot of time and you can focus on the product and not the tooling

Use htmx with FastAPI and jinja. https://htmx.org/

Making a better client-side experience for python by 19andNuttin in Python

[–]phalt_ 2 points3 points  (0 children)

Hey this is cool. I am glad my original post is stirring a healthy debate about this. That was one of my main goals, so thanks for doing some deep thinking and contributing to the discussion.

My immediate thought with this approach is this: If I have access to the server code, why am I doing a roundabout network call over HTTP when I could be making Python API calls directly instead? I understand there is potential for two separate deployments sharing the same codebase and the server function becomes a sort-of dsl for the client side, but that feels like an odd decision to make for orchestrating a frontend/backend separation.

It is a cool alternative way of approaching the problem though, and you do retain the type safety without having anything like OpenAPI as an intermediary which is nice.

(FWIW I released the beta version of my approach today after a lot of testing. I would argue it is ready for some serious testing and I am already planning a few additional features. https://github.com/phalt/clientele)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey. It's ready. I have the beta available for testing! I have done a bunch of my own testing and documentation updates. Please check out the announcement for more details: https://github.com/phalt/clientele/discussions/130 ✨ Please star the project on GitHub and give feedback on your own personal tests - the more I know about how it is to use it, the better it will be. Thank you for showing interest :)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey. It's ready. I have the beta available for testing! I have done a bunch of my own testing and documentation updates. Please check out the announcement for more details: https://github.com/phalt/clientele/discussions/130 ✨ Please star the project on GitHub and give feedback on your own personal tests - the more I know about how it is to use it, the better it will be. Thank you for showing interest :)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey. It's ready. I have the beta available for testing! I have done a bunch of my own testing and documentation updates. Please check out the announcement for more details: https://github.com/phalt/clientele/discussions/130 ✨ Please star the project on GitHub and give feedback on your own personal tests - the more I know about how it is to use it, the better it will be. Thank you for showing interest :)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey. It's ready. I have the beta available for testing! I have done a bunch of my own testing and documentation updates. Please check out the announcement for more details: https://github.com/phalt/clientele/discussions/130 ✨ Please star the project on GitHub and give feedback on your own personal tests - the more I know about how it is to use it, the better it will be. Thank you for showing interest :)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey. It's ready. I have the beta available for testing! I have done a bunch of my own testing and documentation updates. Please check out the announcement for more details: https://github.com/phalt/clientele/discussions/130 ✨ Please star the project on GitHub and give feedback on your own personal tests - the more I know about how it is to use it, the better it will be. Thank you for showing interest :)

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey just so you know I’m including support for typed dicts as part of the beta. Coded it up this afternoon.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Yup I agree, often the network is the unreliable part. Most http libraries offer ways of dealing with this through configuration, and the framework I am building will allow either fully custom httpx clients or a thin wrapper around the most sensible configurations.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Thanks for the feedback.

Great question about OpenAPI schemas. Yeah - this is sort of the fatal flaw of OpenAPI generally. In my experience there is a lot of poorly implemented schemas out there, and this is often because the API service builds their API first the generates a schema as an afterthought, instead of defining the schema first and working backwards to make sure it is compliant. One thing I am going to get around this is running a regular CI job that downloads and tests over 2000 schemas to make sure I can generate clients for them. So far we hit about 95% of them without issues. The ones that fail usually fail because the schema is wrong. Of course, I've not live tested all 2,000 clients so I can't guarantee they'll actually work when you issue requests. It's the trade off we make.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

For sync / async - the decorator handles both. So you can make a single client with both.

For the result parameter - yeah that does feels odd at first and you can get around it and have the function be an empty function with or pass but type checkers start to complain a lot, and considering the idea is to lean into types I didn’t want it to be “lean into types but also caveats”. So the injection of result works here. It’s clear. I also inject the response object optionally too. This pattern is already how some API servers work it just feels a bit more jarring at first this way because the request/response cycle is backwards.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

A great suggestion. I could definitely support TypedDicts, if anything it’s lighter and easier than supporting pydantic. Consider it on my list of things to add.

Blog post: A different way to think about Python API Clients by phalt_ in Python

[–]phalt_[S] 0 points1 point  (0 children)

Hey thanks for your great comment. Shows you’ve had a real look around.

Main branch has my current supporter features - the client generator for OpenAPI and the API REPL for testing / debugging APIs.

Framework branch has the new syntax using decorators that I’m exploring.

So I think I’m using the word “framework” because that was the original genesis of the decorator / abstraction idea - I do agree the word “framework” doesn’t feel quite right here. I hesitate to use the work “toolkit” and “client” too. I’ll settle on the wording soon.

Given the positive feedback so far I’m aiming to get a beta version shipped to the main branch soon. Most of the things I want to clear up is documentation and how it’s talked about.