5 ms·
Show HN: Robyn – “Batman Inspired” Python Web Framework Built with Rust
- glutamate 2y agoWhat is Batman? My Google skills are failing
- yedpodtrzitko 2y agomy guess would be batman.js
- glutamate 2y agoThe CoffeeScript rails clone? Seems an unlikely inspiration for this
- card_zero 2y agoI think it means actual Batman. The web dev who uses this framework is encouraged to roleplay Batman. https://robyn.tech/documentation/en/api_reference/advanced_features https://robyn.tech/documentation/en/api_reference/advanced_f...
- blitzar 2y agoBatman is the secret identity of Bruce Wayne
- Comma2976 2y agoThanks for the spoiler, I was just about to start
- blitzar 2y agoWhile I am at it, did not see it coming, but towards the end the twist is that Joker is the bad guy. Once you know and rewatch it you see all these subtle clues along the way.
- pavlov 2y agoCareful now. That kind of provocative black-and-white claim will only alienate the 50.1% of American voters who appreciate Mr Joker’s anti-government and anti-woke agenda.
- Swinx43 2y agoThe comic book hero
- letthegamesbegn 2y ago[dead]
- benrutter 2y agoIt looks like a nice design! I'd love to hear a bit more about what it offers over Django/Flask/FastAPI though! The examples look very similar to Fast API and the requests per second comparisons make Robyn look very speedy![0] I'm sure the developer has more of a vision than just "faster fast api" though - would love to hear more! [0] https://github.com/sparckles/robyn https://github.com/sparckles/robyn
- vednig 2y agoEspecially over Flask and Django, Robyn additionally offers integrated websocket support along with many existing features like templating, logging etc.[1] Developer has been working on this project for a few years now, here is the updated roadmap, shared by the developer and maintainer of the project.[2] [1] https://robyn.tech/documentation/en https://robyn.tech/documentation/en [2] https://github.com/sparckles/Robyn/issues/1001 https://github.com/sparckles/Robyn/issues/1001
- eterps 2y agoSo it's intended to be a "faster fast api"?
- vednig 2y agoit's much faster for development and prototyping to production, because: - doesn't require any external ASGI in Prod - has in-built CORS - Rust runtime in my opinion
- odie5533 2y ago- FastAPI doesn't require any external ASGI in prod either ever since they added the fastapi cli. - FastAPI has built-in CORS. Has for years. I don't remember it ever not having. I don't see how Robyn is faster for development and prototyping.
- solarkraft 2y agoSince I do not program in Rust, I do not see how it brings any advantage for development.
- ddanieltan 2y agowhich part of this framework is Batman inspired?
- xandrius 2y agoIt having types makes me accept the Python bit. I'd still rather go for something in golang though, hard to beat it for web servers.
- vednig 2y agogolang has frameworks like gin that are faster and simpler when building barebones apps, the more features you need the more modules increase. Robyn brings all the features out of the box, I know it's a compromise but a good one over eventual complexity of the application in the long term.
- linwangg 2y agoThe biggest differentiator between Robyn and frameworks like FastAPI or Sanic seems to be the Rust runtime. But is Python's async actually the bottleneck that Rust is solving here?
- vednig 2y agoGlobal Interpreter Lock (GIL) limits how effectively multiple threads can be used in Python. Hence the event loop in Rust runtime for async makes more sense here.
- Kwpolska 2y agoThe GIL which is currently being removed from CPython?
- vednig 2y agoYeah, in newer versions
- mont_tag 2y agoAn async event loop doesn't have anything to do with the GIL or threads. Async is all about cooperative concurrency where a task yields in places that it would normally block. The tasks can all run in a single thread.
- bvrmn 2y agoActual bottleneck in examples is sqlalchemy, like 10x overhead easily. I find it quite funny. There is no real difference in web frameworks for real apps in terms of overhead.
- michaelcampbell 2y agoI've often wondered about this; are there studies/tests to this effect anywhere that you can link?
- 2y ago
- wesselbindt 2y agoI'm confused, in the example application I see all these async endpoints interacting with the database, but the function bodies are entirely sync. Wouldn't this block the event loop?
- vednig 2y agoBased on my experience. At some places where there were no better alternatives, framework utilizes sync functions under the hood, such as some databases. Overall there are also places where functions are async running in sync bodies, but they're not running on main thread.
- whilenot-dev 2y agoTo GP: yes, it would block the event loop and that's pretty bad. But... asyncio.to_thread[0] as a quick workaround, just keep track of your thread count. Obviously frameworks and libraries with asyncio support should be chosen whenever possible. > Overall there are also places where functions are async running in sync bodies, but they're not running on main thread. That would be a design mistake, as functions have colors[1] with async/await. That's currently my biggest gripe in the python ecosystem, apart from modules maintaining their own hidden state. [0]: https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread https://docs.python.org/3/library/asyncio-task.html#asyncio.... [1]: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
- deleted 2y ago[deleted]
- Retr0id 2y agoPresumably, they would - hopefully, the work they're doing is quick enough that it doesn't really matter that they're blocking (this is usually true when interacting with sqlite, for example). Async request handlers are nice to have for when you do want to do something genuinely async (like firing off another HTTP request to somewhere else)
- odie5533 2y ago
- EfficientDude 2y agoUgh we already have BATMAN and ROBIN as meshnet. Can't you go with... sea man or some other thing that's not taken?
- vednig 2y agoone word VENGEANCE
- scosman 2y agoCan someone explain how it works under the hood. A Rust server for python obviously needs to still run the python interpreter. Is it running many instances to get around the GIL, and doing the request management / reverse proxy / runtime management in rust?
- gdcbe 2y agohttps://pyo3.rs/ https://pyo3.rs/
- Kwpolska 2y agoIf you hate Python so much you need to replace the linters, package managers, and now Web frameworks with Rust, why not just go all the way and write everything in Rust?
- robmsmt 2y agoPython's success is partly because it is easy to do things. It has a huge market share. Combining the speed advantage of one programming language, with another seems like a great idea.
- Kwpolska 2y agoIs it really going to be faster? In the benchmark they cited in the README [0], they are in 10th place among Python frameworks. This is not a real-life benchmark, as it merely expects a hardcoded response. In fact, Robyn’s 10th place is thanks to a feature designed for benchmarks like this, i.e. marking responses as constant [1]. Three more frameworks beat Robyn if you disable this benchmark optimization. [0] https://www.techempower.com/benchmarks/#hw=ph&test=plaintext§ion=data-r22&l=zijzen-cn3 https://www.techempower.com/benchmarks/#hw=ph&test=plaintext... [1] https://robyn.tech/documentation/en/api_reference/const_requests https://robyn.tech/documentation/en/api_reference/const_requ...
- robmsmt 2y agoCan't speak for Robyn since that is competing in an already aggressively competitive landscape (webserving). Whereas introduction of RUFF/UV by astral has been exceptional.
- skeledrew 2y agoThe problem with all this combining is that it's making apps less portable. Like I want to make apps that work on desktop+mobile with flet[0], but now I have to specifically seek out more "traditional" alternate packages and hope they stayed in reasonable feature parity with these Rustified Frankensteins. Not a fan at all. [0] https://flet.dev https://flet.dev
- BiteCode_dev 2y agoWhy do all those micro framework copy the worst aspects of flask? The global request object, the bad integration with sqlalchemy, the strong coupling with an application object that forced the indirection of blueprints... If you start again from scratch, forcing people to migrate their stack and therefor leave their ecosystem behind, at least fix the glaring API problems.
- yntkts 2y agoBy looking at the “File Upload” example: https://robyn.tech/documentation/en/api_reference/file-uploads https://robyn.tech/documentation/en/api_reference/file-uploa.... Robyn is subject to DoS. While it may be fast but it seems poorly designed. This day and age should use a "reader" concept like Go.