Python project for Beeminder

Hey!

I’m a newbie at python, and have just recently completed an introductory python course. I’m looking to pick up a project, and I thought nothing would be better than trying to manipulate some beeminder data.

My idea is simple: create a graph (on demand) for the past 7 days of my reading goal data, displaying the total minutes read of each book that week.

I’ve never used APIs before or created a graph using python, so I’m just looking for some pointers and places to get started.

Thank you if you contribute to this! :slight_smile:

4 Likes

Hi! I think this is a great idea!

When starting out in new things, one of the best meta-skills is being able to tailor project ideas and expectations to something that sustains motivation and leads to successes. It can be tricky to split a project into small enough pieces that each is achievable in an appropriate amount of time, while still being interesting enough to keep motivation when you hit the inevitable snags. When doing something like programming, there can be a large amount of “setup” to get started for new folks, and it can be a slog just get set up!

First, some questions:

Do you want to make your own graph of your own design, or tell the Beeminder API to make a graph and download and show that?

Do you already have a Beeminder goal that has your reading data?

If you want to make your own graph, do you have any ideas of how you want it to look? I would recommend drawing something out on paper even.

In terms of things to look at on the Python side…

  1. I don’t know where you’re starting from or what you already know, but I suggest a few things to Python beginners. There are a lot of Python resources, and almost all of them are “fine” but some are a step above. The Hitchhiker’s Guide to Python is pretty great (https://docs.python-guide.org/). It has a solid guide on getting a great beginner’s development environment set up, that will help you avoid some snags, but also let you grow into something bigger as you need it. Second, whenever I run into Real Python, I am impressed. I have only read their articles, because I am old and don’t watch videos for most things, but they also have courses and videos and things. Third, you should be using a virtual environment for your Python stuff, unless you have a clear reason not to :slight_smile: The number one cause of headache when I am helping junior folks with Python, they have a slew of different Python things all installed globally on their computer and everything acts haunted.

  2. the Requests library (https://requests.readthedocs.io/en/master/) is a good place to start for doing standard web API stuff unless there’s a good Python library already for the thing you’re doing. There are at least a few Python wrappers for Beeminder, like @narthur’s pyminder. https://github.com/narthur/pyminder I can’t suggest any particular wrapper because I simply haven’t looked into them more than a few minutes, but @narthur’s a good person and active on this forum. I suggest starting with pyminder and seeing where it gets you.

  3. Graphing in Python. There are many, many, many ways to graph things in Python, and many of them are even good :slight_smile: The “old faithful” library for graphing things in Python is matplotlib, and it’s even what Beeminder used to use! RealPython has an article on it aimed at “beginners to intermediate” so maybe take a look at https://realpython.com/python-matplotlib-guide/. Seaborn is a wrapper I’ve used once or twice around matplotlib. I think Plotly and Bokeh are also decent, but I have little experience with Plotly and none with Bokeh.

In terms of planning, I would break things down, and I would also start with independently getting data points from Beeminder, and being able to show made-up datapoints on your graph. I would then combine the two, and then add the road, if that’s something you want to show on your graph too.

Beeminder’s API is decent, and its documentation is here (https://api.beeminder.com/#beeminder-api-reference).

Good luck!

4 Likes

Thanks for the endorsement! :smiley:

I can’t promise that I’ll be quick to fix issues you find with Pyminder, but I’m always happy to accept pull requests and answer questions.

Also, if all you want is a bare minimum Beeminder wrapper and don’t care about all the bells and whistles, I’d suggest importing and using this class from Pyminder:

3 Likes

Hey :slight_smile:

Thanks for such an extensive reply @adamwolf, your advice on building that meta-skill is really valuable — as I am also fairly new to pursuing projects in general.

I think I want to create my own graph, and just a simple bar graph at this point, with the minutes read of each entry for the week.
I’ve also got a quick question, what would the Beeminder generated graph look like in this kind of context?

Yeah!

Thank you for all the resources too, I was looking for a general Python set-up guide, as I was having troubles with the default version on Mac being used rather than the latest version. I’m going to work on getting my Python environment set up first, and downloading @narthur’s beeminder wrapper (which I probably wouldn’t find issues in, I wouldn’t know what to look for!).

I might update here how I go with it, I’m excited to give it a try and get some experience with APIs and manipulating data.

2 Likes