----------------------------------------
Progress with Python
December 28th, 2020
----------------------------------------
Since summer, I've been trying to gain some programming
skills. Initially I was fooling around with Rust, and then
briefly with Go, but Python remained more accessible to me.
The syntax is easier to remember, and perhaps being
interpreted makes it feel akin to writing shell scripts.
Anyway, at some point I decided that I'd try to stick with
it to learn more about programming. The documentation is
fantastic, and it seems to be almost a lingua franca around
the tildeverse. Plus, I've noticed that the documentation
and tutorials that exist for Rust and Go tend to focus on
how they are distinct from other languages and assume
somewhat of a background in programming. There are A TON of
educational materials for Python targeted at all ages and
backgrounds. So I committed myself to becoming proficient in
Python.
I have started a handful of "projects." But especially for
the past month or so I have had almost no free time! The
other night I had a nice window to focus for a few hours, so
I put myself to completing a basic utility for managing the
indexes of my gemini capsule. It is a simple program that
could just as easily be achieved by a shell script, but I
learned a lot about Python in the process. I referenced a
lot of code from other folks on various pubnixes in order to
see how people do things in Python, which helped
tremendously. It is kind of a brittle program that makes a
lot of assumptions about how the capsule is structured. My
goal was to have it regenerate indexes after I add new
posts. Posts are saved to folder which represent specific
themes or "tags." These folders have an index of all the
posts under that tag, and there is a master gemlog index
that collects all posts from all tags. The result is a
master and tag-specific indexes that can be subscribed to
via the gmisub companion spec. My capsule was already setup
this way, but I wanted to make a tool to streamline the
process, that way I could add more tags without it getting
unweildy and also use it for other gemini capsules I
operate.
I have the code in a repo at rawtext.club:
https://git.rawtext.club/mieum/twindexer
As it is now, all the variables are hard-coded at the
beginning of the file. I want to eventually set it up to
where the program will read a config file, that way you
could use it to manage multiple capsule by supplying it with
an argument pointing it to the right config file. I have
been keeping all my capsules/gopherholes in git repos on my
workstation, editing them locally, then pushing changes to
the servers that host them. So reading variables from lists
in a config file would help make this tool more versatile. I
also want to have it handle atom feeds as well, and maybe
even include an option to source posts from remote gemlogs.
That way one could potentially have a MASTER GEMLOG
somewhere that aggregates all of their activity from across
geminispace.
Also, the code assumes files and folders are named certain
ways and have certain permissions. I need to refactor the
code to handle errors. But I am happy that it works in its
current state :) I had the idea in my head for so long that
now that it's out and functional I feel like I can take on
more ambitious projects. I want to continute to refine this
so I can use it for a few other capsules I'm running, but I
want to expand on what I've learned to build a site builder
for my booksin.space project. The principle is essentially
the same, but with a greater degree of complexity (and
scale). Another project is to build a feed aggregating
utility to use for The Treeblue Review. Currently I am using
Spacewalk, but I want to build something that lets me
aggregate feeds using multiple methods and present them in
different ways. There is a lot of great content on gemini
that is not easily subscribed to under a specific theme
(indeed that's the motivation behind twindexer's design, to
facilitate themed subscriptions!). I want to find a way to
1) subscribe to pages that serve themed content (like
spacewalk does), 2) subscribed to pages that post lots of
different content organized by tags (like my capsule) 3) and
also include content that is served on pages whose content
is unorganized. There is a great deal of quality content
that falls into the third category. I want to find a way to
include these in a feed somehow. It may turn out that I will
curate some kind of reading lists or themed bookmark
collections out of all this content. I guess the goal of The
Treeblue Review is not just to supply constant feeds of
content, but to organize channels for finding quality
content that exists out there.
In some sense it may become some sort of link archive, and
there may be a considerable amount of manual work that must
go into it (hand-picking feeds). This is especially true if
I end up having to organize individual posts under multiple
tags/themes. Maybe the utility I build should just be a
simple thing that lets me input and organize a bunch of
tagged bookmarks--the spacewalk-like feeds could just be a
way of scraping new content to be included here?
Anyway, I am glad to have made some progress with Python. It
still feels like a bit of a stranger to me in a way, but I
definitely feel better acquainted. Apart from Gemini things,
I think I'm going to build a simple tool for listing,
selecting, and playing various internet radio streams.
Well, I have a lot of housework to do now. Gotta hurry so I
can have a chance to play Python later :)