New release - utopian-cli 0.3.1

Words
590
Reading
3 min
9y
Listen to this post
~4 min

terminal.png

About five days ago I released utopian-cli 0.2.1, and today I'm back with the new and improved version 0.3.1! Use the following command to upgrade if you have already installed it

pip install utopian --upgrade

otherwise use the command to install it

pip install utopian

Features overview

Usage: utopian performance [OPTIONS] ACCOUNT

  Takes a given account and either shows the account's performance as a
  contributor or as a moderator (if applicable) in a given time period.

The "points" command has been renamed "performance", since that makes much more sense as a name. It also now prints everything in a pretty table, has a lot more options and can now also show a contributor's performance (instead of just a moderator's performance)! To see its documentation click here.

Options & arguments

As mentioned above the "performance" command has some new options. Its structure has also changed slightly, --date is now no longer an argument and has been changed to an option instead.

The first new option is the --days option

--days INTEGER   See performance for the last N days.

If you want to see your performance in the last 5 days, you can simply set that as the amount of days!

I also wanted a way to distinguish between the performance of a contributor and the performance of a moderator, since I'm both. To do this I added the --contributor (the default) and --moderator flags, which allows you to quickly switch between the two. The --contributor flag lets you see your performance in the last N days in all the categories you contributed in, as seen below

image.png

If you want to see a moderator's performance, simply change the flag to --moderator instead

image.png

I was also pretty interested in which moderators review my contributions the most and which authors I review the most, with the acceptance % for each. For this I added the --details flag, which shows your top --limit (default is 10) authors that you have reviewed / moderators that have reviewed you. For example, the top 10 authors I reviewed in the last 21 days

image.png

and the moderators that have reviewed my contributions in the last 21 days

image.png

How was it implemented?

The printing of the tables was done by using the Python package PrettyTables, the rest I implemented myself. It took quite a lot of code (went from 235 lines to 436 lines), so it took a while to implement and get everything working how I wanted to. I can definitely improve the quality in the future, as I think some functions can probably be combined together and changed to be more dynamic.

Currently the code creates two dictionaries, depending on the --contributor and --moderator flags. The first one stores all the information about the account's performance and the other one stores all the extra details that are printed when the --details flag is used. These dictionaries are then printed in a pretty table using the PrettyTable package, which I think looks much better than how it did in the previous version. The only "problem" I encountered was that getting a contributor's rejected posts requires another call to the API, but that's it really.

Roadmap

Just like last time, I will add things as they pop into my mind. I do want to see if it's possible to generate a pie chart (or something similar) of an account's performance and save it to a file, I think that would be cool! If anyone has any other ideas, please let me know!

How to contribute?

  1. Fork the repository
  2. Create a feature branch with git checkout -b your-feature
  3. Code and document your feature
  4. Commit your changes with git commit -m "add my features"
  5. Push to your branch with git push origin your-feature
  6. Create a new pull request

Anything you can add to the project is valuable to me, be it bug reports, suggestions etc. so please don't hesitate!



Posted on Utopian.io - Rewarding Open Source Contributors