What can #Rust ๐ฆ teach us about security + building safer #AI agents?
Quite a bit, actually. ๐ก
Reading Astral's excellent article on securing against supply-chain attacks, I noticed how many of the #security principles align with Rust's design philosophy.
TIL that `httpx.Client` supports `event_hooks`
In the example below I refuse certain requests to make sure we only do GETs + a specific action: archiving tickets.
Pretty useful; reminds me of FSM design as well.
Have you used this?
#python
Announcing ty 1.0: an extremely fast type checker and language server for Python.
In deploying ty internally across many, many millions of LOC, we've seen a 24x speedup and a 73% reduction in memory use.
We're now ready to recommend it for production use, for all users.
Creating an AI agent isn't that hard.
Call an LLM API, parse the response, loop.
Building one for production? A different story.
And I think that's becoming one of the most important skills for developers working with AI.
Thinking in systems. Applying proven design patterns.
A Python script takes minutes to run.
Rewrite the critical part in #Rust and call it from #Python with PyO3. ๐ฆ
Now it runs in milliseconds. ๐
No need to rewrite the app. Just the hot path.
That's the approach Jim and I teach at https://t.co/YgcIZKgYYB.
Keep Python where it's productive. Move the slow 5% to Rust when you have the numbers to justify it.
Learning Rust isn't easy, but porting a real bottleneck makes it stick. And it makes it more fun.
What's one part of your Python codebase you'd love to make faster? ๐
Thanks ๐ @realpython for featuring my #Python + #Django design patterns article, where I walk through the design decisions behind my Commit Graph habit-tracking app. ๐
I really liked how you framed it as a โthis worked in this case, and here's why I did itโ kind of article.
Those are my favorite pieces to write. They help us move beyond โthis library does Xโ toward โhow should we think about software?โ
And I believe that kind of engineering judgment is becoming more of a moat these days as well.
๐ง Listen to the discussion here:
https://t.co/UFPh3jPmGy
I'm already working on Part IIโฆ ๐
Just published a new crate to https://t.co/uKAxMrAu4H: bob-json-parser ๐ฆ
It's a JSON parser written from scratch in #Rust: a hand-written tokenizer and a recursive-descent parser, with no serde.
PyO3 bindings let you call it from #Python as a native extension.
It's the 6-week capstone of our <Scripter to Rust> cohort, and I built it alongside last cohort.
I published it so I can use it in another tool I'm building that needs to parse JSON logs, simply: `cargo add bob-json-parser`
Check it out -> https://t.co/iAZVFQs7eV
Curious about leveling up with Rust?
DM me or join our community -> https://t.co/YgcIZKhwO9
LLMs can write syntax, but they canโt replace human engineering judgment.
As AI agents generate more of our codebases, live design sessions become *more* valuable, not less.
Juniors still need to learn how experienced engineers THINK, something async code reviews only partially answers.
Ensemble (mob) programming makes live architectural thinking, trade-offs, and micro-decisions visible in real time.
I co-hosted live ensemble sessions back before AI agents, and developers loved verbalizing *why* they chose specific patterns.
So I built a lightweight tool for it:
๐ Try the MVP: https://t.co/SXIrNT80z9 (zero installs and signup, Pyodide Python, driver/navigator timers)
๐ Help test drive it: https://t.co/cb7jXn3mX0
I'm curious to gauge interest: in an agentic world, do you feel the need for live, human-to-human design and coding sessions has grown? How would you use this? ๐
I just hand-coded a simple FSM (Finite State Machine) in #Python ๐ก
Some people might ask:
Itโs 2026. Why even code by hand?
Because the thinking, debugging, and deeper understanding that go into an exercise like this are still valuable.
I had to reason through the design, trace what was happening, debug it, and really understand the code.
It's slower, but now I own it.
And I can teach it better.
It was also one of my happier moments this week.
Only reading code and managing agents is not the same as being in touch with the code and understanding how something works at all levels.
(I also had to explain Rust ownership / the borrow checker this week ๐ช)
Now I'm going to do it again for my YouTube channel.
We'll see how much hand-coding remains in the industry, but I do think regularly writing code yourself is a great way to keep your technical skills and intuition sharp.
And judging by the feedback I get, this is also what people seem to value most in my videos: watching the thinking behind the code so the 'how' + 'why', not just the 'what'.
The best features come from listening to your people ๐ก
> my local Python users group wanted to know if the free tier included a leaderboard or not as they thought it might be a fun activity for one of their meetings.
Learning #Python ๐ syntax isn't the hard part.
Itโs everything around it where beginner devs typically get stuck:
- the terminal / SSH keys,
- git and the GitHub PR flow,
- virtual environments,
- dependencies and packaging,
- writing your first tests,
- linting,
- etc.
Overkill for a single script.
But all needed for shipping / sharing an app.
I'm building a free, self-paced 6-week course to help Pythonistas learn all this and more.
We do that by building a command line app from scratch using these tools + workflows.
Week 1 - Project Setup & Data Model - is live now ๐
https://t.co/vZctIPqEvD
Each Friday I'll launch the next week of content - more info in my launch post ->
https://t.co/BjQAlttBTW
Hope this helps more Python developers ship their projects with confidence. ๐
Enjoy and any feedback welcome, let's go! ๐ช ๐
My goto for a swappable backend in #python has been an abstract base class (ABC).
There is a flexible alternative though: Protocol (typing module).
Take LLM providers as an example.
An ABC comes with a requirement: every provider has to inherit from your base class.
Fine when you write every provider yourself, less so when they're third-party plugins.
`typing.Protocol` uses "structural typing" instead. Conformance lives in the method shape, not in a shared base class.
So a provider can evolve freely as long as the shape holds, and inherits no methods it doesn't use.
And the type checker still catches a missing method or wrong signature at lint time.
I still reach for ABCs when providers share concrete behavior, but protocols are the more flexible default.
So next time ask: shared contract, or shared implementation?
More in my new article: https://t.co/hOkZpfuzoz