Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can now pass urls to commandline fairtally with progressbar #24

Merged
merged 19 commits into from
Mar 3, 2021

Conversation

jspaaks
Copy link
Member

@jspaaks jspaaks commented Feb 26, 2021

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

fairtally/__version__.py Outdated Show resolved Hide resolved
fairtally/cli.py Outdated

@click.command()
@click.argument("urls", nargs=-1)
@click.option("-o", "--output-filename", "output_file", help="Where to write the results of the analysis.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention output formats in the help text

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split this up into a --html and a --json, each with separate help text; this also avoids having to run the tool twice if you happen to want both json and html output.

fairtally/cli.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@jspaaks
Copy link
Member Author

jspaaks commented Mar 1, 2021

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.

setup.py Outdated Show resolved Hide resolved
fairtally/cli.py Outdated Show resolved Hide resolved
Copy link
Member

@sverhoeven sverhoeven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests commands and pre-commit script ran correctly.
Spawned of some issues and left some inline comments for things that would otherwise never be done.

Great work.

jspaaks and others added 2 commits March 1, 2021 17:30
Co-authored-by: Stefan Verhoeven <[email protected]>
Co-authored-by: Stefan Verhoeven <[email protected]>
@jspaaks
Copy link
Member Author

jspaaks commented Mar 1, 2021

committed the suggestions

@jspaaks jspaaks requested a review from sverhoeven March 1, 2021 16:36
@jspaaks jspaaks added the standup label Mar 3, 2021
@fdiblen fdiblen removed the standup label Mar 3, 2021
@sverhoeven sverhoeven mentioned this pull request Mar 3, 2021
Copy link
Member

@eriktks eriktks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

@jspaaks
Copy link
Member Author

jspaaks commented Mar 3, 2021

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 #26. Do you want me to fix it here as well? My guess is we're eventually going to merge #25 anyway right?

@jspaaks jspaaks requested a review from eriktks March 3, 2021 11:45
Copy link
Member

@eriktks eriktks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the missing file issue does not need to be fixed here if it is already fixed in another issue. Thanks!

Copy link
Member

@fdiblen fdiblen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely. Thanks @jspaaks

@sverhoeven
Copy link
Member

Thanks for reviewing, merged on behalve of @jspaaks

@sverhoeven sverhoeven merged commit c99587c into main Mar 3, 2021
@sverhoeven sverhoeven deleted the 3-5-15-23-bootstrapping-fairtally branch March 3, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants