Hacker News new | ask | show | jobs
by avolcano 1974 days ago
I'm excited about Python's typing potential. I recently rewrote an API from TypeScript to Kotlin since I am fairly unhappy with the server-side TS ecosystem, but ran across https://github.com/tiangolo/fastapi when exploring options and really dig it - seems to be by _far_ the lowest-ceremony way to make an HTTP API with static types that integrate with parsing/validation (something TypeScript is still really bad at, unless you bring your own runtime typing libraries...).
2 comments

More specifically, Pydantic. It's great!
FastAPI got me turned onto Pydantic, both are awesome!
I use pydantic all over the place now. FastAPI was what introduced it to me. Its really nice to be able to take advantage of the autocompletion when utilizing pydantic models rather than a straight dictionary. Now, in a lot of instances I use the pydantic models instead of dictionaries as it feels more explicit
Ah, thanks, I hadn't realized that's the underlying library! Runtime validation of types is absolutely the largest missing feature from TypeScript, IMO, so Pydantic is really impressive to me.
Yes, I have been using Pydantic with my Django projects, and it is great!
Have you taken a look at https://rocket.rs?
Rocket is nice but I had a much, much better experience with Warp[0]. I ran into a lot of roadblocks with Rocket, especially with stuff like JWT and working with databases. No such issues with Warp.

0: https://github.com/seanmonstar/warp

I'm curious about both, and Rust for APIs in general. While I'm excited by the expressiveness of the language (compared to e.g. Go) and how robust the type system is. Right now, though it feels like a bit too much of a barrier both in terms of learning the language and the smaller ecosystem right now (this article covers a lot of my concerns: https://macwright.com/2021/01/15/rust.html). Still keeping an eye on it and would gravitate towards it if I had a smaller service that needed particularly high performance.