Rain started in the Bay Area yesterday.
Following from my post from 2022 about testing Rails application with a static server, I wanted to mock an API during a test. The reason for this is that I like to keep the external dependencies to a minimum.
Happy 4th of July from San Francisco!
I made my first bread today from scratch. The recipe is very simple:
I am currently working on a small Python project with a relatively large memory footprint. I wanted to analyze the usage in detail and realized that I wasn’t aware of any good Python memory profiler. After some searching I found the builtin package tracemalloc (Trace memory allocation). Especially interesting to me is the capability to take snapshots at different points in time and then compare the delta between those snaphots. The following snippet illustrates this. This is fine for smaller code bases where I have full control over the source. It requires however a lot of editing and manual filtering of frames and taking snapshots at the right time. Another interesting solution is Bloombergs memray. This allows to run a whole Python application and save the snapshots into a file. From there memray can either create a table or a flamegraph to see the memory consumption over time. Memray can be used like this: This generates a HTML file which can be opened in any browser.