I wanted to analyze the gender distribution of my social profile, so I wrote some code. Introducing Mastodon Proportional.
During parental leave I ported a tool that can be used to analyze the gender distribution of your Mastodon feed. It was fun and I made some stupid mistakes along the way.

Important Links
Make babies, write 1000% more code
Mastodon is the best social network, we all know that, right? Right!? Yeah, yeah...I know you are all on BlueSky[1], I forgive you!
Anyway, last year in late August I became a father, which resulted in me going in full-time parental leave, which also resulted in me having a fair amount of spare time (I am not neglecting the baby, I promise).
While scrolling through my Mastodon feed, I remembered that some years ago - before M*sk shut down the Twitter API - someone had made a really cool tool to analyze your account and scan names and bios to guesstimate the gender distribution of your feed. Many tech leader follow mostly men[2] and my feed didn't look much better than that π₯. After a quick search I found the tool, which was understandably archived in June 2023. The author, A. Jesse Jiryu Davis, introduced it in a very well written blog post called π72% Of The People I Follow On Twitter Are Men.
I did the only sensible thing I could possibly do: I forked the repo and started porting it to Mastodon.
"This is gonna take me AT MOST 2-3 days. I just need to change the API calls and it's all gonna work."
Mastodon Proportional
Needless to say, the first commit dates back to the 20th of October and the last one was on the 15th of November so...not exactly in line with my silly prediction. Oh well, it's always like that! What's extra funny/sad is that since then I've been postponing sharing it with everyone else, and it took me another 2.5 months to get here.
I blame the child, obviously πΌ.
How it works
Mastodon Proportional asks you to login with your Mastodon handle and, after getting the necessary permissions, it scans through your followers, those you follow, as well as your own timeline and feed.
It first looks for explicit pronouns declared on the user's bio, otherwise it tries to guess the person's gender from their first name[3]. As the original author explained, "It's inaccurate and it undercounts nonbinary folk, but it's better than making no effort at all". I agree.
If you wanna use Mastodon Proportional, you can either test it here, you can deploy it yourself, or even just use it via terminal. All the info is more or less explained on the README.md file.
π Please keep in mind that I am currently deploying it on a Railway paid plan which will scale the costs based on traffic, so please be gentle with it and don't do 2000 tests! π
Why did it not take 2-3 days?
Well...there are a few reasons.
I dunno what I am doing
I have built multiple fun hobby projects in Python, but at the end of the day I am not a skilled Python programmer. If it's something simple, sure, but whenever I do a a bit ambitious I initially go all-in, but my brain fails to retain the accumulated knowledge; I quickly forget what I've learned so I often have to go back to the basics. I don't live this as a big issue but it definitely slows me down, especially in situations like this one where it's not just about writing Python code but also learning stuff like OAuth flows and other things I don't know anything about.
Multiple instances
This is quite embarrassing, but my idea of "let me hook up the APIs real quick" was really stupid because I didn't take into account the very core aspect of Mastodon: federation. Mastodon Proportional had to radically change flow to accommodate for authentication on any number of instances (unlike Twitter, where you connect to the one Twitter). This meant having a system that dynamically talks to the specific Mastodon instance requested by the user and eventually obtain the correct permissions to perform the analysis. After you log in, in fact, you shouldn't be able to run queries on other instances!
CLI and frontend changes
A direct consequence of the previous point is that in Mastodon Proportional I can't just ask the user to put their username. They also need to provide their instance name and, after that, there needs to be somewhat clear feedback that they are "locked" on the instance they logged in on.
APIs
The other thing that I did not consider was that - OBVIOUSLY - the APIs don't map 1:1 π . Some of them were rather easy to port, but others (especially the ones that required pagination) worked in very different ways, carrying JSON data that looked different and that needed to be processed differently.
Deployment
This was the very first time I tried to use PythonAnywhere and Railway to deploy a web app. I quickly hit a roadblock with the former because the basic free accounts are only allowed to interact with whitelisted websites and I would have needed all the Mastodon instances in the world to be whitelisted. Obviously not gonna happen.
Railway, on the other hand, didn't need a whitelist and I could try it for free (after the trial period it becomes a bit more expensive than PythonAnywhere). I prioritized the free trial, so I ended up going with Railway. In the process I even ended up learning about GitHub deployment webhooks so that when I push a fix to the repo, the web app redeploys automatically β¨. It's really nice but it definitelly took a while to understand how to handle all of this.
Was it worth it?
I would say so! I am terrified at the idea of people using it and discovering a stupid amount of issues, but that's also why I kept it open source, I don't wanna fully own the code and - if anything - Mastodon seems like the right place where people would be willing to help, if needed.
Looking at my own results, the data doesn't look very good, but I've been super busy and unable to act on it since December! It is still my goal to diversify my feed, Mastodon is a wonderful place and the only feed I can navigate without being infuriated every 5 seconds.
How you can help
So, with all this said, we now have a tool that I think works well, but I could still use some help:
- Give Mastodon Proportional a try!
- You can βStar the repo!
- Report any πbugs and issues you encounter when using Mastodon Proportional.
- Check the actual code, see all the things that I am doing in a stupid way, and help make the tool better!
- If you feel generous, sponsor the project on GitHub or on Ko-Fi so that I can cover some of the running costs!
- If you can run Mastodon Proportional on a solid environment that doesn't require intense monthly costs, feel free to reach out to me.
Future improvements
- Mobile friendly: Ideally I would like Mastodon Proportional to work well from mobile. Currently the result table gets all messed up, and I had no time or energy to look into it.
- Better guesstimates: I am completely unaware if there are ways to improve and get more accurate results, but it would be good to validate if the tool is spitting decent data.
- BlueSky: Yeah, why not, I am thinking we should get this to work on BlueSky too! It will probably be 2-3 days of work.
Special thanks
First and foremost, Mastodon Proportional wouldn't exist without the original Twitter Proporti.onl tool by A. Jesse Jiryu Davis.
I would also like to extend my gratitude to some kind users on the official Mastodon Discord server. Supporting Mastodon on Patreon grants people access to it, and some devs helped me navigate through the APIs and the best practices when it comes to interfacing with the Mastodon backend.
Finally, I'd like to thank some of my friends who were kind enough to give Mastodon Prortional a try and report issues along the way.
Yes, I also have an account there. β©οΈ
From Elon Musk to Tim Cook, tech leaders hardly follow women on Twitter β©οΈ
It uses a library called gender-guesser and I have no clue how good it is. β©οΈ