Squeaky retweeted
We are very exited to share with you PEP 768 🐍, which proposes a safe external debugger interface to Python. We think this is a really exciting change that will allow debuggers to safely attach to running Python processes without stopping them. 🐛🔨
peps.python.org/pep-0768/
Squeaky retweeted
I conducted an analysis of return-in-finally in real world Python code.
TL;DR:
- it is not used often
- when it is used, it's usually used incorrectly
- code authors find it easy to fix
Full Report: github.com/iritkatriel/final…
Squeaky retweeted
Is someone waiting for PDM to integrate UV? It is still experimental but it's here:
$ pdm config use_uv true
github.com/pdm-project/pdm/r…
Squeaky retweeted
Max @tekknolagi just gave his presentation "Dr Wenowdis: Specializing dynamic language C extensions using type information" at Soap at PLDI in Copenhagen. The talk is about how to add type information to C extensions to speed them up in PyPy. Slides: bernsteinbear.com/assets/img…
Squeaky retweeted
how I squeeze 60K RPS out of SQLite on a $5 VPS:
There are tons of tutorials on how to setup SQLite, and sometimes they contradict each other. Here is what worked for me.
1. Configuring PRAGMAs. We need to send the following PRAGMA commands right after opening the connection:
PRAGMA journal_mode = WAL;
- enables write-ahead log so that your reads do not block writes and vice-versa.
PRAGMA busy_timeout = 5000;
- sqlite will wait 5 seconds to obtain a lock before returning SQLITE_BUSY errors, which will significantly reduce them.
PRAGMA synchronous = NORMAL;
- sqlite will sync less frequently and be more performant, still safe to use because of the enabled WAL mode.
PRAGMA cache_size = -20000;
- negative number means kilobytes, in this case 20MB of memory for cache.
PRAGMA foreign_keys = true;
- because of historical reasons foreign keys are disabled by default, we should manually enable them.
PRAGMA temp_store = memory;
- moves temporary tables from disk into RAM, speeds up performance a lot.
Do NOT use cache=shared! Some tutorials recommend configuring it, but this is how you get nasty SQLITE_BUSY errors. It is disabled by default, so you don't have to do anything extra.
2. Use immediate transactions
If you know that transaction can possibly do a write, always use BEGIN IMMEDIATE or you can a get SQLITE_BUSY error. Check your framework, you should be able to set this at the connection level.
3. Open two connection pools
Another trick is to open 2 connection pools, one for reads only and another for reads/writes. Set the connection limit of write pool to 1, and the connection limit of the read pool to some reasonably high number, e.g. number of your CPU cores.
4. Bonus: how I configure sqlite with Go
Here is the code in go I use to configure the sqlite connections:
```go
func SQLiteDbString(file string, readonly bool) string {
connectionParams := make(url.Values)
connectionParams.Add("_journal_mode", "WAL")
connectionParams.Add("_busy_timeout", "5000")
connectionParams.Add("_synchronous", "NORMAL")
connectionParams.Add("_cache_size", "-20000")
connectionParams.Add("_foreign_keys", "true")
if readonly {
connectionParams.Add("mode", "ro")
} else {
connectionParams.Add("_txlock", "IMMEDIATE")
connectionParams.Add("mode", "rwc")
}
return "file:" + file + "?" + connectionParams.Encode()
}
func OpenSqliteDatabase(file string, readonly bool) (*sql.DB, error) {
dbString := SQLiteDbString(file, readonly)
db, err := sql .Open("sqlite3", dbString)
pragmasToSet := []string{
"temp_store=memory",
}
for _, pragma := range pragmasToSet {
_, err = db.Exec("PRAGMA " + pragma + ";")
if err != nil {
return nil, err
}
}
if readonly {
db.SetMaxOpenConns(max(4, runtime.NumCPU()))
} else {
db.SetMaxOpenConns(1)
}
return db, nil
}
```
Squeaky retweeted
Just published a new blog post, talking about our real-life shenanigans with PostgreSQL statistics, indexes, and pareto data distributions: making.close.com/posts/diale…
Discuss it here: news.ycombinator.com/item?id…
Squeaky retweeted
im ashamed nobody in 2022 said to me
"wake up babe new SI prefixes dropped"
ronna and quetta now exist and im 2 years late to it
Squeaky retweeted
Stick the following in your ~/.gitconfig to make `git branch` sort by most recently committed (thanks to @andywingo for this one!):
[branch]
sort = -committerdate
Squeaky retweeted
Guide to setup free-threading CPython in an easy way.
dev.to/hugovk/help-us-test-f…
Squeaky retweeted
> Google has announced that starting in June 2024, ad blockers such as uBlock Origin will be disabled in Chrome 127 and later with the rollout of Manifest V3
Ah.
Squeaky retweeted
New blog post: The Return of the Frame Pointers (Fedora, Ubuntu) brendangregg.com/blog/2024-0…
Squeaky retweeted
Why did Apple and Google make it hard to switch default browsers for so many years?
Because it's a powerful way to block competitors.
Just look at what happened to Brave installs on iPhone in the EU when Apple rolled out a new default browser choice screen on March 6th:
Squeaky retweeted
ways to stay humble:
- code
- feel like god when something works
- find bug
- realize bug was your fault
- repeat until you die
Squeaky retweeted
Open source AI foundation models will wipe out closed and proprietary AI models for the same reason Wikipedia wiped out generalist commercial encyclopedia: crowd-sourced human contributions to open platforms can cater to a high diversity of interests, cultures, and languages.
Squeaky retweeted
the problem is not dynamic typing - it's the obscene amounts of code that people write to do simplest things.
if you keep simple things simple and avoid proliferating complexity then you would not need to create solutions for managing this complexity.
Squeaky retweeted
In the Cpython core dev sprint we have started a project to improve the CPython REPL for Python 3.13+ 🎉
The first achievement is showing proper exceptions with source, error messages and locations in the REPL tracebacks. You can compare the before and after in these images:
Squeaky retweeted
WOW! IT'S HAPPENING: the Steering Council posted their "intent to accept PEP 703", in other words to allow for a version of #Python without the #GIL.
@colesbury's heroic effort to prove nogil is feasible will be paying off.
Now the real work begins!
discuss.python.org/t/a-steer… – at Poznan, Poland

























