Closed espadrine closed 10 years ago
Let's start with Travis-CI. It seems the fastest way to get to the information is through:
https://api.travis-ci.org/repositories/<USER/REPO>.json
eg, https://api.travis-ci.org/repositories/joyent/node.json
.
We can also do Coveralls with https://coveralls.io/repos/<USER/REPO>/badge.png?branch=master
. It's a bit trickier, because it redirects you to an Amazon S3 instance image, but the image URL contains the information we need: https://s3.amazonaws.com/assets.coveralls.io/badges/coveralls_73.png
.
Gittip is probably the nicest to play with: https://www.gittip.com/JSFiddle/public.json
.
I'll keep this issue around. Add suggestions here!
There's no obvious way to have built-in support for gemnasium (#19), short of parsing the HTML.
Yeah, probably not worth it for Gemnasium. Let’s just hope they’re willing to implement the SVG badges themselves :)
Packagist has a smooth albeit verbose JSON interface: https://packagist.org/packages/<USER/REPO>.json
.
Coming from Packagist, NPM's interface was rather bothersome. On one side, we have the rather verbose but elegant still NPM registry: https://registry.npmjs.org/<REPO>/latest
which includes the NPM version and the dependencies'.
However, if you want to see the download count, you have to parse this: http://isaacs.iriscouch.com/downloads/_design/app/_view/pkg?group_level=2&start_key=[%22<REPO>%22]&end_key=[%22<REPO>%22,{}]
. It's also the only one to forbid https.
The resulting JSON gives a list of daily downloads, which have to be added up to compute monthly downloads.
Ruby gems are the nicest so far: https://rubygems.org/api/v1/gems/<REPO>.json
Code climate has a Content-Disposition
HTTP header with the score in the file name. See eg curl -I https://codeclimate.com/github/kabisaict/flow.png
:
Content-Disposition: inline; filename="code_climate-4-0.png"
Happy days! Gemnasium follows the same pattern. Its Content-Disposition
looks like this, eg, https://gemnasium.com/gemnasium/gemnasium-gem.png
:
Content-Disposition: inline; filename="dev-yellow.png"
You could add support for PyPI info too, see: https://github.com/badges/pypipins/blob/master/pins/pins.py
It's a simple JSON.
@rasky Great idea! Thanks for linking to code!
So, PyPI has dethroned Gems as the nicest API: https://pypi.python.org/pypi/<EGG>/json
.
Thanks!
You put only downloads, what about other fields? pypins handle also latest, egg/wheel and license.
Actually, "license" is not very useful, since you don't change license often, so it can be a static badge.
I do it little by little. Right now, downloads and version (latest?). I'm not sure what Egg and Wheel are, so I'll need to learn.
Wheel is a new binary format (esp. useful for C extensions). Eggs are on the way out but still fairly prevalent? (afaik)
Is this exclusive? @rasky @kura Would a badge like [ format | wheel ]
vs. [ format | egg ]
(vs. [ format | none ]
) work?
Also, what should the color be?
You can copy what they do here: https://pypip.in
Sure, but I'm thinking in terms of which badge would be most interesting to display. [ wheel | yes ]
isn't immediately obvious, and we may be able to improve that. What do you think?
For the sake of continuity, here's how Hackage does their API: https://hackage.haskell.org/package/<REPO>/<REPO>.cabal
. Of course they have their own format! But acf16d61e77ac687ca96ddda9dd324fdf278d033 made it work anyway.
Sorry, what have I missed RE PyPI?
On the format question by @espadrine, having format | egg/wheel could work, I could make egg = red, wheel = green and none = red, might make more sense to do this now and have wheel being the first thing we look for.
@kura That sounds pretty good! Are you going to implement that in pypip? shields?
(Otherwise I'll do the shields one today…)
I'll put it in pypipins seeing as it's kind of the PyPI shield interface.
@espadrine done - https://pypip.in/format.html
Excellent!
When possible (when an API is available), we should have a way to provide a bridge to existing services.
eg,
gh-badges.herokuapp.com/travis/joyent/node.svg
.This issue is to discuss which APIs we can access, and what is the most efficient way to do so.