WritePyly Client

I'm excited that I've hit a bit of a milestone with my WriteFreely client. I basically have the package to a point where I'm content with it and feel like I can actually start using it on the regular. The code is available on GitHub; I know I referenced the repo on GitLab in my original blog post, but that changed a few weeks ago for reasons that will be another post for another time.

This has been a few months in the making, as I spent a not insignificant amount of time working on it each weekend since July. I also feel like I'm starting to put a bow on it at a good time since I've had some other personal project ideas crop up that I'd like to start working on that also offer the benefit of helping me learn a new language, C#, which I'm looking to learn for work.

What's also kind of special to me is that this is really the first “bigger” personal project that I've actually completed. I've written plenty of code in my free time, but nothing that really amounted to more than a basic script for something. I can also see why projects like this die so frequently; there were plenty of times where, after not looking at the code for a week, I just really didn't want to spend any time diving back into it in order to figure out where I left off, what I needed to change, or what design decisions I needed to fix.

The Client

The client is accessible in 2 different ways:

  1. A CLI client executed from the command line with a plethora of sub-commands, similar to something like kubectl.
  2. An interactive TUI client, made significantly less bland-looking via rich.

I struggled initially to think of a good reason why the TUI client would exist, especially since I was never going to create a text editor in my client better than what people would already be using. As is so often the case, though, I was really overthinking the situation, and I ultimately realized I could just use whatever was already set as the $EDITOR for the content itself and just have my code act as a wrapper to manage that content. Win-win. I honestly now use the TUI version more than anything else!


Probably the best thing that I learned from this experience, along with updating my Python skills, was around design. I'm often very guilty of immediately diving into writing code without really thinking through the bigger picture of what I'd like to accomplish and how my decisions will impact that. A great example is the fact that I wanted to have both a CLI and TUI option for the application, but I initially worked on only the CLI side. While that's probably for the best to save me from juggling too many items at once, I made decisions that often only worked for the CLI version of the application, such as assuming that if I ran into an error I could just exit the application with a non-zero code. Obviously that then didn't work for the TUI version where I wouldn't want the user to be kicked out due to an error; I'd just want to note what went wrong and offer some options for what should be done while keeping the application active. This resulted in my having to change the behavior for a lot of my classes. While it wasn't a big deal in the end, I still could've saved myself from a lot of work with better planning.

Wrap Up

I'm really happy with where the client is now, though if I happen to think of anything which I'd like to add I'll certainly continue working on it in the future. By the same token, if anyone other than me actually ends up using this and has a feature request, it's certainly something I'll consider. I'm just excited now to have what I feel is a solid option for posting to WriteFreely from the CLI, something I'm actually doing right now since this post is being made via my client. 🙂