iTranslated by AI
Attending Robust.py #1
Introduction
I attended an event called Kenro.py #1.
Since this was the "first time" it was held, I'll introduce the event's content, atmosphere, and my impressions of participating.
I also gave a presentation at this event about how to build highly reproducible Python development environments.
In this article, in addition to the event report, I will also discuss the background behind my presentation slides.
What is Kenro.py?
Quoting from the connpass event page.
Kenro.py is an event for engineers interested in techniques for handling Python safely.
15-minute short sessions will be presented. Please talk to your heart's content about the theme of this event, "Techniques for Creating Robust Python Programs"!!
Theme examples:
- Typing Module
- Package Manager, Lockfile
- Static Analysis, Runtime Type Analysis
- Asynchronous Processing
- Other insights contributing to the robustness of Python programs
Motivation for holding the event
The organizers noticed that there were no events specifically focused on the "robustness of Python software," and they wanted to create a place where people interested in that theme could gather to discuss and share knowledge.
The details regarding the background and context of the event have been shared extensively on their blogs.
Please take a look.
- Article by Shunsock-san (@shunsock)
- Article by Nikkie-san (@ftnext)
List of Sessions and Material Links
1. Introduction to Test-Driven Experimental Code for Researchers Who Don't Write Tests / Let's start your ML project by writing tests
- Speaker: Shunk-san
- Slides
- Sample Code
2. Pursuing Robustness in Monolithic Django
- Speaker: skokado-san
- Slides
- Sample Code
3. Recommendation for jaxtyping: Annotating dtype and shape to numpy and PyTorch arrays
- Speaker: colum2131-san
- Slides
- Sample Code
4. Building Highly Reproducible Python Development Environments - Pinning Python libraries with uv and other tools with Nix
- Speaker: ryu (the author of this article)
- Slides
Impressions
Venue
The venue was provided by Uzabase, Inc.
It was located just a few minutes' walk from Tokyo Station, and I was impressed by how easy it was to access.
Atmosphere on the Day
Nikkie-san, the organizer, has published an X thread summarizing the posts from the day.
Q&A time was provided after each session, and every session saw a lively exchange of questions.
It was impressive to see so many hands raised by participants, to the point where speakers couldn't answer all the questions.
Individual Sessions
1. Introduction to Test-Driven Experimental Code for Researchers Who Don't Write Tests / Let's start your ML project by writing tests
The message "Writing tests = explicitly defining experiment design" was clear and left a strong impression on me.
I had always perceived pytest as a "tool exclusively for unit testing," but this session introduced how to use it as a task runner, which was a new discovery for me.
As a topic outside of the session, the speaker introduced a column summarizing "idiomatic Python practices" in their intro.
It carefully explained things like type hints and was very easy to understand.
2. Pursuing Robustness in Monolithic Django
The message on the final slide, "Early code is copied and pasted and proliferates; the beginning is crucial," left a strong impression.
I had never worked with Django before, so I learned for the first time that settings are written in Python (settings.py).
In the session, an approach was introduced to achieve explicitly typed ≒ robust configuration management by not only adding type hints to individual setting values but also representing custom definitions using dataclasses.
Furthermore, a method for managing configuration files by splitting them for each purpose was proposed, and the concept of "Modular Monolith" appeared as the background for this.
I learned this term for the first time today, but apparently, it is a concept that has been attracting attention in recent years.
In IaC tools (Terraform) or program class design, separating by function or concern is a natural idea.
However, I felt that analyzing service architecture from the perspective of a Modular Monolith seemed interesting.
It was highly thought-provoking content for considering the robustness of the entire application.
3. Recommendation for jaxtyping: Annotating dtype and shape to numpy and PyTorch arrays
An overview of jaxtyping and how to use it was explained.
In the session, they used an example where torch.Tensor is used for function arguments and return values.
I found it attractive that you can clearly show the structure of arguments and return values with just type hints, without having to write documentation strings (the """ docstring """ part directly under the function).


Also, the speaker had prepared a Google Colab environment where you can actually try jaxtyping, and I thought the preparation was amazing.

4. Creating Highly Reproducible Python Development Environments - Pinning Python libraries with uv / Pinning other tools with Nix
I spoke about building development environments using Nix and uv.
My presentation time ran right to the limit, and I regret not being able to take any questions.
During the session, when I conducted a survey on uv usage, nearly 100% of the audience responded that they were using it, which surprised me.
Also, I surveyed Nix usage; while only a few people were actually using it, about 70–80% had heard of it, giving me the impression that its adoption is gradually spreading.
I hope the number of Nix users grows and that there will be more opportunities to share know-how in Japanese.
For those who want to know the background of why I arrived at the environment in the slides
I've put this in a toggle because it got a bit long.
Due to time constraints, I omitted the background explanation, but my past experiences with failure are what led me to care about "environmental robustness" in addition to "code robustness."
When I first started programming, I used to install Python libraries directly with pip install.
It didn't cause any particular problems at first, but when I tried to reuse the same project several months later, I struggled to reproduce the environment from that time.
Later, managing Python libraries became much easier after I started using uv.
However, there came a time when I had to migrate to a new PC.
Reproducing tools other than Python was extremely tedious (I didn't even remember what I had installed in the first place), and it was a very troublesome task.
Based on that experience, I began using Docker to build independent environments for each project, and ultimately, I found Nix appealing because it balances "ease of use" and "reproducibility."
On a side note, since switching to Nix, I was moved by how easily I could reproduce my environment when I bought a new PC.
Install Nix
→ Install home-manager
→ git clone
→ home-manager switch
With just this, a user environment equivalent to my main PC is reproduced.
For individual projects, I just git clone and run nix develop, then leave it alone until the setup is complete.
Social Gathering
It was at a curry restaurant called ASIAN RESTAURANT BASIL.
Since I didn't have any good photos, I'll take the liberty of quoting Nikkie-san's tweet.
In addition to curry, there were appetizers and salads, and everything was delicious.
There was a seat-shuffling time during the event, which was a great opportunity to interact with various people.
(I thought it might be good to have seat shuffling multiple times.)
I had the impression that many of the people I spoke with were from the machine learning field, but I heard there were also people from the application development side.
Some people came from outside the prefecture, and everyone's enthusiasm was amazing.
Conclusion
It seems there are plans for the next event, so I'm looking forward to it!
Discussion