Hacker News new | past | comments | ask | show | jobs | submit | bbmario's comments login

I know this is unrelated, but probably a lot of Pythonistas here and I've been wondering: what is the async web framework of choice for you guys today? As for DBs, still SQLAlchemy? What about a prettier (js) alternative?


I've been using FastAPI https://github.com/tiangolo/fastapi which is built on top of Starlette as my main async framework and Uvicorn as my primary web server.

Starlette and Uvicorn are both made by Encode https://github.com/encode and in my experience they consistently put out quality stuff.


I used aiohttp and it is quite good and solid (I also like that it comes with type annotations, which enables autocomplete in PyCharm), I did not have chance to compare it to FastAPI.

Regarding database access, my recommendation might not be popular, but I really like asyncpg[1]. They basically dropped DBAPI and instead created their own API that functionally matches PostgreSQL, giving you full control and increasing performance.

As a result of that you probably won't be able to use ORMs (there's SQLAlchemy driver, but as I understand it is hacky and you are losing the performance benefits).

Personally I compared my code with and without ORM and there's no change in number of lines. If you use PyCharm and configure it to connect to your database (I think that might be a pro feature) it will then automatically detect SQL in your strings provide autocomplete (including table and column names) and provide highlighting, removing all the advantages that ORM provided.

[1] https://github.com/MagicStack/asyncpg


Went from Flask + FlaskRESTPlus to FastAPI. Can't recommend FastAPI enough.

https://github.com/tiangolo/fastapi



Starlette, by the same author as httpx.

https://www.starlette.io/


> async web framework

Not enough experience with async to comment.

> DB

peewee is good enough and more ergonomic compared to SQLA for a lot of use cases.

> formatter

black. To be clear it often produces truly horrendous code, but at least there’s no arguing and no fussing over options or details.


Yeah, it's weird that I find code formatted by black much less aesthetically pleasing than js code from prettier. But we're still using it.


fwiw:

I've moved to Trio over asyncio (I did plain old async for a couple years and Trio makes a ton of sense)

Quart-trio over Flask (just to get a Trio-friendly flask-a-like server) - plain old aiohttp worked really well too. It takes a bit more roll-your-own work, but you get exactly what you want.

peewee over SQLAlchemy (less committed to this change, but peewee has been fine so far and is much more streamlined) I'm mostly just using SQLite. the async version of the ORM looks pretty new, i'm not using it yet.


In the process of porting a Pyramid app to Starlette and very impressed. It's lightweight, well-documented, and a breeze to use.


Honestly I'm not so into async and more into Lambda with Flask. Here's what I'm using right now for that: https://spiegelmock.com/2020/01/04/python-2020-modern-best-p...


sanic seems nice.

also, sqlalchemy is an over-engineered system imo. i only go for it when i have no other choices. otherwise i use a database client directly.


I’ve been a very happy Tornado user for years.


Aiohttp + Aiopg which uses sqlalchemy


Aiohttp + sqlalchemy


Django + Channels


Flash left a huge void in the indie community that has yet to be filled by something. Remember Newgrounds.


Also remember Kongregate (in its early days at least, before every game was a MMORPG clone or tried to sell you something).

Flash was a huge boon for indie games.


Newgrounds is still around, and there are probably some great HTML5 games out there; I don't really play games anymore so I don't go on there much now.

A friend of mine recommended just Scirra Construct if I want something similar to Flash that exports to HTML5.


Same here. New machine? Add a remote, checkout master.


Given that our monitors have outrageous resolutions today, I miss pixel-perfect fonts with good size. I'm getting older and the eyes are not getting any better.


I miss them too. On a 1920x1080 laptop display I can see the grayscale font smoothing as a blur which my eyes try to correct for. In order to make it tolerable I've turned off font smoothing globally. Ugly and jagged text gives me less eyestrain than the built in blurriness of Windows font smoothing.


But normal fonts are easier to read.

Introducing pixel "jaggies" on angled and curved lines makes letterforms harder to distinguish, not easier.

Why do you think pixellated fonts would be better on your eyes?

Perhaps you just need bolder fonts, if it's an eyesight issue?


It's pretty well known that anti-aliasing (and macOS' font rendering) add blur to fonts. A lot of bitmap fonts are "pixel perfect", i.e. there's no blur.

I have great eyesight, because I wear contacts, and I prefer to disable anti-aliasing when I can.


Is the final code readable/maintainable?


We added the transpiled code in a new branch at https://github.com/immunant/ioq3/tree/transpiled/quake3-rs and also a more cleaned up refactored code base at https://github.com/immunant/ioq3/tree/refactored/quake3-rs


There's an example of the output and a discussion of this elsewhere in this thread. TL;DR: not as much as it could be, yet. This is a work in progress.


No.


Certainly safer for the animals.


And probably less likely to include pathogens that come from animals.

I think all people need an occasional look at where their food comes from. The amount of animal shit (rodents and the slaughtered animals themselves) in commercially sourced meat has increased in the last decade. If you stood a person in front of a meat grinder and said, "Here, now we throw in the appropriate legally-allowed amount of poop into the mix", fewer people would be in line to buy the end product.

Or if they were allowed to go visit the factory chicken farms and see the sick, diseased chickens that end up on their dinner plates, I think they would be unable to eat it.

Do people not realize that the recent laws aimed at preventing information gathering from factory farms is designed to prevent them from learning what they are really eating?


Pathogens reduction yes. Animal biological matter, no. Harvesting entails inclusion of many small animals and insects which get processed.

That said, it may not be a bad thing to be exposed to those byproducts of farming. Too sterile an environment (and food) can result in other problems. Obviously we don’t want to overwhelm our immune systems with pathogens but they need to be exposed to them to be ready and also to not attack our own system.


I don't think we are at any risk of living in too sterile an environment. If anything, the knowledge that at least 1/3 of people don't wash their hands after they poop... is just one of the lovely ways we get exposed to a lot of interesting "biological matter".

Practically everything we touch in public has someone else's complex human fecal matter on it, plus stuff from other sources.


If that kind of thing worries you, then stick with plant-based whole foods and wild fish.

Plenty of humans have had low, or no, animal products in their diet "forever." You don't need a fancy new food from Silicon Valley to avoid meat.


I never suggested that a manufactured meat replacement was a solution :).

Personally I think the fake meats are a needless crutch. Yes, creating an interesting vegetarian dish requires more effort than just throwing a fatty steak on a grill (the magic of heat, fat, and animal protein), but with just a bit of effort a vegetarian dish can be very satisfying and healthy at the same time.


> Personally I think the fake meats are a needless crutch.

More then that, they're a hype-driven fad where a good concept gets ruined by people letting their imaginations run away, like cryptocurrency and driverless cars.

Honestly, I think test tube meat is where the real revolution will come from. (Animal flesh grown without the animal.) "I can't believe it's not meat" will join the ranks of Jello salads and other foods that we no longer eat.

(That, and I think that vegetarian dishes will slowly become more and more popular as people realize that they taste good and eating meat everyday is boring.)


Remove plant-based foods from the list. There is a "120%" guarantee of previous contact with animal poo and animal urine in your vegetables.


And humankind. The amount of antibiotics countries like US use for farm-animal optimized growth certainly has a much much higher long term risk than "processed food". Once an antibiotic resistant superbug jumps from pig to people we'll pay a much higher price.


How is this different from draw.io?


See the thread above (currently), I responded there on this question.


Do you even need stuff like this when we have CSS Grid now?


Fabien's blog is a pot of gold. I love this "archeological" approach to programming. He also makes the articles feel like documentaries. It's just unique.


Couldn't agree more. His two books are also phenomenal [1]. If anything, worth getting a copy just to support his amazing work.

[1] https://www.amazon.com/Fabien-Sanglard/e/B075Q5W35H


I wonder how much latency that adds up.


I don't know about the latency that's intentionally inserted. But I'm using Karabiner for the past years, and I haven't noticed any. It probably helps that it's implemented as a kernel module.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: