Readit News logoReadit News
sebra commented on Happy 20th Birthday, Django   djangoproject.com/weblog/... · Posted by u/davepeck
calpaterson · 2 months ago
What is missing? The ORM works with asyncio, you can have async views, you can have long running connection-oriented async stuff for websockets etc (via django channels). Maybe there is something important that I'm missing but that seems more complete than most async-only frameworks.
sebra · 2 months ago
There are numerous things still missing in terms of async support. Most notably for me is DB transaction support which leads to most non-safe endpoints running on the shared sync_to_async thread and me having to separate my code into one async function calling another sync function wrapped in sync_to_async.

In fact if you look at the source there is a lot of async methods in the framework itself which just straight up calls sync_to_async e.g. caching. This doesn't matter as much as hopefully it will get added proper async eventually. But I think believing your requests wont block just because you're using async is a bit naive at this point in Django and the async implementation has been going for years.

Not to mention that the majority of third party libraries lack support for async so you'll probably have to write your own wrappers for e.g. middleware.

sebra commented on Whatever happened to cheap eReaders?   shkspr.mobi/blog/2025/05/... · Posted by u/blenderob
sebra · 3 months ago
I think one reason for the eReader market not being big is that they're so good and sustainable. I bought my Sony PRS-T2 in 2012 and am still using it to this day. It has battery life for weeks, storage space for 100+ books and works just as well as when I bought it. It's really hard for me to motivate buying a new one when the only interesting "new" tech is backlight and I guess it's the same for most eReader owners.

The ~90e I paid for it back in 2012 was for sure good value!

sebra commented on Show HN: Real-time AI Voice Chat at ~500ms Latency   github.com/KoljaB/Realtim... · Posted by u/koljab
krick · 4 months ago
Cool for a weekend project, but honestly ChatGPT is still kinda shit at dialogues. I wonder if that's the issue with technology or OpenAI's fine-tuning (and suspect the latter), but it cannot talk like normal people do: shut up if it has nothing to add of value, ask reasonable follow-up questions if user doesn't understand something or there's ambiguity in the question. Also, on topic of follow-up questions: I don't remember which update introduced that attempt to increase engagement by finishing every post with stupid irrelevant follow-up question, but it's really annoying. It also works on me, despite hating ChatGPT it's kinda an instinct to treat humanly something that speaks vaguely like a human.
sebra · 4 months ago
I added this to personal instructions to make it less annoying:

• No compliments, flattery, or emotional rapport. • Focus on clear reasoning and evidence. • Be critical of users assumptions when needed. • Ask follow-up questions only when essential for accuracy.

However, I'm kinda concerned with crippling it by adding custom prompts. It's kinda hard to know how to use AI efficiently. But the glazing and random follow-up questions feel more like a result of some A/B testing UX-research rather than improving the results of the model.

sebra commented on Apple courier may have stolen 2 MacBooks, ... Apple is not going to help   forums.macrumors.com/thre... · Posted by u/Toutouxc
sebra · 10 months ago
Apples only delivery choice in Sweden is UPS which is notorious for messing up deliveries here. I ordered a MacBook and the delivery is supposed to be hand over with signature required. The UPS guy left it outside my apartment door in the stairwell in the morning. I was lucky it was still there when I got home from work. Apparently I signed that delivery (the UPS guy probably signed it himself...)
sebra commented on Show HN: Allocate poker chips optimally with mixed-integer nonlinear programming   github.com/jstrieb/poker-... · Posted by u/jstrieb
sebra · a year ago
Nice one! Had this problem last time we ran a tournament.

I also did some constraint programming to solve my poker problems. We play mostly cash games so I did a MiniZinc model for computing the least amount of transactions after the game: https://github.com/SRautila/poker-home-game-calculator

sebra commented on Django REST framework 3.15.0   django-rest-framework.org... · Posted by u/cosmosgenius
stavros · a year ago
Is django-ninja maintained? I've always disliked DRF and liked FastAPI, so Ninja was a natural choice, but my team ended up moving away from it because of it being less popular than DRF.
sebra · a year ago
It is very much maintained and got it's 1.0 release not long ago. Sadly there is a single guy doing all the work for Ninja so the tempo of releases varies. I also think there is quite a way to the stability of DRF and DRF's ecosystem. If you want permissions and throttling for example you'll have to use django-ninja-extra which is pretty much "DRF but its Ninja".

For me personally I think the micro approach of Ninja / FastAPI is at odds with what I want out of DRF. I just want to make my crud stuff and not worry about implementing e.g. throttling, etc, on my own.

sebra commented on Django REST framework 3.15.0   django-rest-framework.org... · Posted by u/cosmosgenius
sebra · a year ago
As a long time Django and DRF user I'm really happy this release finally got out. If you look at the PRs being released some of them are years old. It's true that DRF is a mature and feature-complete framework but Django is still evolving slowly and DRF must keep up with that at the very minimum. Big thanks to the maintainers for getting it out!

Here are some of my hilights from this relase:

* Default on model gets sent to API docs

* Orderedict replaced by plain dicts everywhere - plain dicts are ordered in python since 3.6 so this is a welcome simplification

* Automatic support for UniqueConstraints in ModelSerializers - this is one of the places where DRF were lagging behind. I found myself using the deprecated unique_together just to not bother with writing validators on all my serializers

* There is a new router supporting path converters instead of regexp - Looking forward to trying this out! Also long overdue IMO as this came to Django in 2017 :)

sebra commented on Boring Python: dependency management (2022)   b-list.org/weblog/2022/ma... · Posted by u/bruh2
sebra · 2 years ago
For me it feels like people have always been over-engineering dependency management where the practical issues from not doing it are pretty much non-existent.

My approach is to just use Docker, no virtualenvs. I get that you might run into the multiple interpreters issue in theory but across multiple projects in the past 5 years I haven't seen that. Also, this might no longer be true but avoid using Alpine. If you're deploying Django there is no reason to optimize image size and Alpine has a lot of things which are missing (i.e. at least a couple of years ago, wheels where not supported leading very slow build times).

I only do a single requirements.txt. Anything which makes your prod and local environment differ is a bad thing in my opinion. Fine black might make my image a couple of mbs larger but why would it matter? On the other hand attempting to figure out why something which works on my machine does not work on prod is always a nightmare.

Setting requirements as a range in requirements.txt allows me to automatically get bugfixes without spending time on it (e.g. django>=4.2.3,<4.2.99 django-ninja>=1.0.1,<1.0.99) Again, I might have run into 1-2 issues over the past couple of years from this and I've saved a lot of time.

Getting a project running locally should not take more than 1 minute (a couple of .env vars + docker-compose up -d should be enough).

The biggest practical issue in dependency management in python is dependencies not pinning their dependencies correctly.

sebra commented on Improving sleep   vincelwt.com/sleep... · Posted by u/vincelt
tinyhouse · 2 years ago
Can you provide a link to Valerian? pills?
sebra · 2 years ago
Yeah, pills. I'm a Swede so you'll probably need to look for a different brand if you're in the US. Here is the ones I buy: "Valerina Forte" https://www.fass.se/LIF/product?nplId=20090224000447&userTyp...
sebra commented on Improving sleep   vincelwt.com/sleep... · Posted by u/vincelt
sebra · 2 years ago
My tactic for falling asleep just about anywhere is over-ear headphones (QC35) and a sleeping mask.

Sleeping slightly on your side is no problem with QC35 and if the noise around you is low enough you don't even need white noise. The battery lasts a couple of nights too (esp with no white noise on).

I've tried doing the same with Sonys over-ear but they make a loud noise when I move my head so they don't work for me at all. AirPods Pro work in a pinch but the battery runs out and my ears start hurting.

Another thing which I find mildy helpful which wasn't mentioned here is Valerian. If my lack of sleep is stress-related Valerian works sometimes for calming. If my lack of sleep is due to bad routine / off schedule Melatonin works very well but if I'm stressed it does not work at all and leaves me groggy in the morning.

u/sebra

KarmaCake day43July 11, 2018View Original