fair-software / fairtally

Make a report based on howfairis results
Apache License 2.0
5 stars 3 forks source link

Can now pass urls to commandline fairtally with progressbar #24

Closed jspaaks closed 3 years ago

jspaaks commented 3 years ago

In this PR:

For testing, you can put in your own URLs, but for convenience, the snippet below gives you the 10 URLs from the Research Software Directory which were changed most recently:

// Example to get a list of 10 most recently changed software items from Research Software Directory:
fetch("https://research-software.nl/api/software?limit=10&sort=updatedAt&direction=desc")
   .then((response) => {return response.json()})
   .then((data) => {
      console.log(data.map((x) => {
         return x.repositoryURLs.github[0]
      }))
   })

To test:

fairtally https://github.com/fair-software/howfairis https://gitlab.com/jspaaks/howfairis-livetest

Should show a progress bar and print results at the end

$ fairtally https://github.com/fair-software/howfairis https://gitlab.com/jspaaks/howfairis-livetest
fairtally progress: |██████████████████████                      | 1/2
currently checking https://gitlab.com/jspaaks/howfairis-livetest

If you have jq installed, you can pipe the results into it, like so:

fairtally <URL1> <URL2> <URL3> | jq '.'

or write to a json file:

fairtally --json results.json <URL1> <URL2> <URL3>

or write to an html file:

fairtally --html results.html <URL1> <URL2> <URL3>

Here's what that looks like in the browser:

image

jspaaks commented 3 years ago

The pep8 linting check fails but that's because those rules aren't helping me write clean code. E.g. the linelength of 79, how function calls break over multiple lines, the fact that you cannot have an empty line after a function signature.

jspaaks commented 3 years ago

committed the suggestions

jspaaks commented 3 years ago

Testing html output results in an error message:

$ pip install .
...
$ fairtally --html results.html https://github.com/fair-software/howfairis https://gitlab.com/jspaaks/howfairis-livetest
...
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/erikt/anaconda3/envs/python37/lib/python3.7/site-packages/fairtally/data/index.html.template'

True, but will be fixed by #25. See also https://github.com/fair-software/fairtally/issues/26. Do you want me to fix it here as well? My guess is we're eventually going to merge #25 anyway right?

sverhoeven commented 3 years ago

Thanks for reviewing, merged on behalve of @jspaaks