Things from my week
Yet again answering the question no one asked, “What did Nathaniel find interesting this week?”
New Stuff
Doom Emacs
With thanks to Peter, I’m now trying out Doom Emacs for blog writing and note taking (with org mode, more on that later). Getting it setup made me aware of a few other tools that replace a few of the GNU basics, ripgrep
and fd
. They’re written in Rust and claim to be a bit faster than the more familiar grep
and find
. So far I haven’t noticed a huge differnce, but I haven’t used them heavily yet.
I’m a Vim user, so Doom ended up being a good fit as it’s geared towards Vim-style navigation, but I’m also debating if I want to keep up with two different editor configurations. Or I guess technically three; I’ll use VS Code when doing data science stuff (the jupyter plugin is pretty nice) but the overhead is comparatively low for that.
Org mode
A little bit of a continuation, but I’ve been learning the basics of org mode. One notable feature is the ability to insert code snippets into documents and then execute them. There seems to be some variety of options in this, but I’m of course most interested in the Python possibilities.
This is similar to Jupyter, but isn’t quite as friendly to environment management, so it’s unlikely to be a replacement. However it does look like a good blogging option as org
docs can convert to markdown, and actually writing out code snippets seems more convenient and flexible to me.
Python super
In a follow on to my section on self
from last week, I have another gotcha error in Python class declarations that I found easy to glaze over. When inheriting from other classes, correct initialization is super().__init__()
not super().__init__(self)
. Again, the first argument to __init__
is the object instantiated by super()
, adding self in the calling parens for __init__
is actually passing two arguments.
Notably if the parent class initialization does take other arguments, you may need to pass them as in super().__init__(**kwargs)
, the point here is that the child object should not be passed to the parent. This blog post is from a while ago, but it’s a good dive into using super()
.
Finally trying Polars
Polars has been gaining popularity as a faster alternative to Pandas. I ended up having to install the version for old machines as the CPU on my laptop does not support the extended instruction set they normally use, which I hope also gives some insight into why I haven’t looked into Polars until now. So while I won’t be getting much of the speed benefits just yet, I have still been appreciating it more than I anticipated.
Polars is more column focused than Pandas. Part of that is a result of the lack of index conferring a speed boost, but there’s also been a stylistic choice of “contexts” and expressions in the api design. This makes Polars feel a little closer to SQL to me, but it also makes it feel more functional in style. This lines up with how I prefer to think about dataframe operations, setting rules for extraction based on value, not grabbing specific indices. Another good blog post here that has a nice comparison.
Follow ups from last time
WING IDE
I did try out Wing a bit, though most of my fun new editor time was spent on Doom emacs. On the whole it seems to be a fairly standard editor, with features you’d expect like debug and terminal panes, though I only had access to the free “personal” edition. The paid tier of course probably has more bells and whistles. One notable thing I did appreciate was a button to check and modify your python environment. Not that this is revolutionary, but having a dedicated and prominent button was a nice convenience. I’d be willing to bet that anyone who’s setup Python themselves (rather than in a browser repl, such as the ones introductory courses love to start with) has dealt with environment issues. I will say that as soon as you really get a handle on venv
or conda
it becomes less of a concern, and without anything else particularly exciting, I’m not likely to continue with Wing.
Vim Ale
I haven’t gotten super deep into ale at this point. It seems to support quite a lot of linters, which is nice. I’ve been having a harder time getting the config right, as I had ruff
installed with pipx and it took a moment before figuring out the setting to change. This has mostly been a “me finding a new setting” issue and not a problem with Ale, as the documentation seems quite extensive. It hasn’t been immediately clear to me what features would need to be turned on to get the same behavior as their snappy video on
github.
Additionally my plan of just using ruff
to cut back on configuration and making all the linters play nice together has not come to fruition. Again, I just need to trawl through documentation to figure this out, but I also kind of want to just install all of the linters with pipx
, so they’ll be isolated and hopefully play nice, and then hope that ale will pick the correct sources now that I’ve got it set to look in virtual envs.
For Next Time
I still have a few agenda items for the future that aren’t just talking about learning org
mode:
- Knitting row counter display with Textual
- Finally putting together a portfolio website
- Data Science at the Command Line is available for free and looks interesting
- Learn some more Jekyll to make this blog look a bit better
These are admittedly a little more general than what I’ve been working on so far (except for the Textual project!). I’m still trying to get a post out a week since I do better if I have a deadline, but I also want to start doing posts that aren’t just activity updates. As usual, if you have any suggestions or corrections, please let me know!