pkgstats version 3: lookup package statistics from your terminal

pkgstats is a tool that gathers and analyses installed packages of Arch Linux users. It started as a small shell script back in 2008 and helps us among other things to determine which packages are no longer used but also which packages from the AUR are popular candidates.

Previously I rewrote the server part and added historical statistics per package and the ability to compare the popularity of several packages over time. It also introduced a public API which is now used by the pkgstats client.

The new pkgstats client

Today I released the initial version of pkgstats v3, the client that can be installed via pacman. While in the past it was only used to send usage data to the server, the cli has now an interface to search for package statistics and compare different packages.

Search for packages

You can now search for packages by using pkgstats search <query>

~> pkgstats search firefox
firefox                             77.57
firefox-developer-edition           7.42
firefox-i18n-en-us                  3.76
firefox-i18n-de                     3.60
firefox-i18n-fr                     2.08
firefox-ublock-origin               1.93
firefox-i18n-en-gb                  1.90
firefox-nightly                     1.58
firefox-adblock-plus                1.51
firefox-extension-https-everywhere  1.32

10 of 288 results

See more results at https://pkgstats.archlinux.de/packages#query=firefox

Show and compare packages

You can lookup the popularity of a single package or compare a number of packags at once. Simply type pkgstats show <package> [<package>...]

~> pkgstats show nodejs go php python rust
python         99.73
nodejs         65.26
go             61.34
php            33.10
rust           20.49

See more results at https://pkgstats.archlinux.de/compare/packages#packages=go,nodejs,php,python,rust

Direct links to web graphs

As you saw in the examples above, pkgstats now also prints an URL representing your query. Following these link renders a visual representation of historical data.

Searching for packages

Comparing packages over time

Submit your package list

As with previous versions of pkgstats a list of your installed packages can be submitted to the server. This is done on a weekly basis triggered by a systemd timer. If you like to inspect what data would be transmitted you can print the JSON output via pkgstats submit --dump-json

~> pkgstats submit --dump-json 
{
  "version": "3",
  "system": {
    "architecture": "x86_64"
  },
  "os": {
    "architecture": "x86_64"
  },
  "pacman": {
    "mirror": "https://mirror.pkgbuild.com/",
    "packages": [
      "a52dec",
      "aalib",
      "accountsservice",
      "acl",
       ...
      "zsh",
      "zstd",
      "zvbi",
      "zxing-cpp"
    ]
  }
}

Integrated help and shell completion

The new client comes with an integrated help command for each sub command and flag. The package also ships with shell completions for Bash, Zsh and Fish.

Feedback welcome

I rewrote the initial shell script in Go and released it as version 2.5. Version 3 is a continuation of this effort and represents just the beginning. If you have any suggestions to improve pkgstats or ideas for interesting and useful features please let me know.

Further information

You’ll find more information on the pkgstats home page and GitHub.

Leave a Reply

Your email address will not be published.