David J Nevin+= Code

Last updated: Aug 27, 2022

RSS Python Search Hugo

Slack Community

So I’ve been hanging out in the PyBites Slack Community for a few weeks. I’m mostly lurking and adding a comment or emoji or a question. Nothing major. But it’s really nice to be in touch with other pythonistas. It certainly feels great to be doing this self-learning path with a few others within earshot.

I recently discovered and immediately signed up for the free The 6 Key Ingredients of a Successful Pythonista PyBites Training and on day two there’s an in-depth look at getting to terms with setting up a git repo, using poetry to setup your Python project and environment, adding, committing, branching and the like. It’s an excellent video.

Git repos and Main as defaultbranch

Creating a github repo is something I’ve done oodles of times, so that was easy. But when I got to initializing a git repo locally (something I’ve also done on may occasions) my primary branch was labeled master and not main. This bugged me. It wasn’t what I wanted. Queue rabbit hole.

Labeled it seems has a whole set of config files in the $HOME directory. Who knew? I certainly didn’t. By editing the ~/.gitconfig file, I was able to see that indeed my defaultbranch was set to main. Ok.

I exited my terminal, tried to init again and nope. Just having seen the setting didn’t convince my new init to do want I wanted. I trundled off to the browser. I found a git --global command to set the init.defaultbranch. Didn’t work. And what’s more my z shell autocomplete stopped working. I was cd’ing using full directory names. It was rough.

Z Shell plugins

So off I went back into my .zshrc file to see what was changed. Of course it was as I had left it a month ago when last I tweaked it. I was even able to remember some of the old tweaks I made.

Looking for a way to change my autocomplete plugin, I rediscovered I was using zplug. And looking for the autocomplete install with zplug I found a recommendation to update zplug. That seemed to do it, or at least it undid what git –global did. Or so I thought. My autocomplete was working, I could navigate with ease again, but my git init was still defaulting to master.

I found a git –global command to clear the default, no joy. I reread the instructions here and updated git. Tried again. No joy. I went back and forth a few times deleting the local repo, recreating it and then trying again. Eventually after re-re-reading the instructions I saw this little note. “remember to add a new line after the first line in the template/HEAD file”. Of course this worked immediately. So I could git init with main as the default branch and get it to push. Relief.

Python Blog Feed Searcher (Console App)

So the tutorial code that Bob of PyBites used to demo the add and commit was a basic RSS (Really Simple Syndication) console app written in python. It parsed an RSS feed and returns matches for terms inputted through the console. I though to myself well that sounds like fun.

So tweaking that code, I wrote a short script that allows me to search the RSS feed of this blog and return hits in the console. It took me down another rabbit hole of RSS setting in Hugo but thanks to [this digitaldrummerj article] (https://digitaldrummerj.me/hugo-create-rss-feed/) I got it up an running and limited to the blogs and not the static pages. Another win.

Test driven understanding

I’m off to see if I can get the search tool running and write the tests for it. But so far, it’s been an eventful trip into git, local repos, hugo, and generally learning the stuff that counts.


Next: Orange Belt
Previous: Summer of Code