npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pythia

v1.0.2

Published

Outputs the emails for each person with >20% ownership of any file in your commit.

Downloads

492

Readme

pythia

Greenkeeper badge

formerly known as foresight

Outputs the emails for each person with >20% ownership of any file in your commit. Involving these owners in communication about changes to files they own has been shown to reduce the number of bugs in research done by microsoft.

For further reading see:

  • https://www.microsoft.com/en-us/research/publication/the-influence-of-organizational-structure-on-software-quality-an-empirical-case-study/
  • https://www.microsoft.com/en-us/research/publication/dont-touch-my-code-examining-the-effects-of-ownership-on-software-quality/

usage

npm i -g pythia

Then you will have pythia as a command that you can run from your console!

requesting reviewers

Adding -p or --publish to pythia will run the publish config and send the list of reviewers to your code review system. It does this by calling .pythia-publish passing it the email of the author, ownership percentage, and location of the file. You can write a .pythia-publish file to do whatever you need it to do for your review system.

Three arguments are passed in a call that looks like:

./.pythia-publish [email protected] 93.25 somefile-path.md

So in bash that means

$1 = author's email
$2 = percentage of ownership
$3 = the file that is owned

Just to reiterate: .pythia-publish will be called once per author and the first argument to it will be the author's email.

Also: the .pythia-publish file needs to be executable (chmod +x .pythia-publish) and located in the root of your project (which is where you should call pythia from).

Publish File Examples

Gerrit

For gerrit you might do something like this:

#! /bin/sh

ssh -p 29418 [email protected] gerrit set-reviewers -p my-project my-change-id-here -a $1

Github

For github you might do something like this:

#! /bin/sh

TEAM=(["[email protected]"]="designfrontier" ["[email protected]"]="githubusername")

curl "https://api.github.com/repos/$REPO_OWNER/$PROJECT_NAME/pulls/$PULL_REQUEST_NUMBER/requested_reviewers?access_token=$GITHUB_TOKEN" -H "Content-Type: application/json" -X POST -d "{\"reviewers\":[\"${TEAM[$1]}\"]}"

For github to work all of the variables there will need to be set in the env in a way that lets the .pithia.publish call access them. If you set them in your call to pythia they should be passed through to the call to the publish script.

config file

You can create a .pythia-config file in the root of your project in order to exclude users, directories, or files from being processed and reported. This is useful when people leave your team, or when you have files and directories that are auto-generated.

The config file also allows you to change the threshold of ownership that adds people to the review, and outputs their names. By default only users with 20% or greater ownership of a file are output, and sent to yhe publish script. Now you can change that to any number you would like (though >=20% is the number most supported by the research).

The .pythia-config file should be a JSON formatted file and its contents should look like this:

{
  "exclude": {
    "users": ["[email protected]", "[email protected]", "[email protected]"],
    "files": ["readme.md", "history.md", "AUTHORS"],
    "shas": ["1acdb7ea77d8afec3e5bc2cd021c914ca4302265", "e488831"]
    "directories": ["bin"],
    "comments": { ".rb": "#", ".js": "//" }
  },
  "threshold": 20
}

With exclude.comments, you can exclude lines starting with specific characters for the given file extensions.

command line argument

You may also pass the location of your config file ar runtime with the --config option. This allows you to store your config in whatever file you would like. It still needs to conform to the structure laid out above though.

As an example: pythia --config pythia.json where pythia.json is at the root of your project.