con / tributors

Pay tribute to your contributors! A tool to automatically update contributor files.
https://con.github.io/tributors/
Apache License 2.0
13 stars 6 forks source link

hard to start going, crashes with not informative traceback #37

Closed yarikoptic closed 4 years ago

yarikoptic commented 4 years ago

why just not to assume the same whenever there is no ORCID_TOKEN? or that is not the reason for

$> ORCID_ID=0000-0003-3456-2493 ORCID_SECRET=wrong tributors update
INFO:allcontrib:Updating .all-contributorsrc
Traceback (most recent call last):
  File "/home/yoh/proj/tributors/venvs/dev3/bin/tributors", line 11, in <module>
    load_entry_point('tributors', 'console_scripts', 'tributors')()
  File "/home/yoh/proj/tributors/tributors/client/__init__.py", line 145, in main
    main(args, extra)
  File "/home/yoh/proj/tributors/tributors/client/update.py", line 53, in main
    client.update(parsers=parsers, repo=args.repo, params=extra, thresh=args.thresh)
  File "/home/yoh/proj/tributors/tributors/main/__init__.py", line 107, in update
    client.update(thresh=thresh)
  File "/home/yoh/proj/tributors/tributors/main/parsers/allcontrib.py", line 120, in update
    self.lookup = {x["login"]: x for x in self.data.get("contributors", [])}
  File "/home/yoh/proj/tributors/tributors/main/parsers/allcontrib.py", line 120, in <dictcomp>
    self.lookup = {x["login"]: x for x in self.data.get("contributors", [])}
KeyError: 'login'
yarikoptic commented 4 years ago

actually now I did get ID (btw ORCID_ID better be something different since first I assumed that it is my orcid id, e.g. ORCID_CLIENT_ID), exported both ID and SECRET but getting the same.... AH - that is because I decided to start anew so removed .tributors altogether. Why not to stop demanding init and just initiate it empty? if empty -- it would get slowly populated (in its "cache" functionality ;))

yarikoptic commented 4 years ago

I think it would be better if just generated empty than leave me stranded or direct to RTFM:

(git-annex)lena:~/proj/open-brain-consent[master]git
$> tributors init
INFO:github:Please specify one or more parsers, one of zenodo, codemeta
$> tributors init zenodo
Please provide the zenodo doi with --doi
# we do not have zenodo yet
$> tributors init codemeta
Codemeta provides several tools to generate this for you: https://codemeta.github.io/tools/
# sorry -- don't want to go somewhere to just start going
yarikoptic commented 4 years ago

I think smth like that worked in the past but no longer

$> echo '{}' > .zenodo.json                                        
$> tributors init         
INFO:github:Please specify one or more parsers, one of zenodo, codemeta
$> tributors init zenodo
Please provide the zenodo doi with --doi
yarikoptic commented 4 years ago

Please make it tolerate a silly yarik who just wants to talk to orcid and get his .all-contributorsrc used to populate .zenodo.json in OBC

NB will be offline for a bit -- family drags me away

yarikoptic commented 4 years ago

BTW it said that it wrong my secret but they seems to be not there:

(git-annex)lena:~/proj/open-brain-consent[master]git
$> python -m pdb `which tributors` update
> /home/yoh/proj/tributors/venvs/dev3/bin/tributors(3)<module>()
-> __requires__ = 'tributors'
(Pdb) c
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): orcid.org:443
DEBUG:urllib3.connectionpool:https://orcid.org:443 "POST /oauth/token HTTP/1.1" 200 None
Orcid token exports written to /home/yoh/.tmp/tributors-kc6pctlp. In the future export these variables for headless usage.
INFO:allcontrib:Updating .all-contributorsrc
Traceback (most recent call last):
  File "/usr/lib/python3.8/pdb.py", line 1703, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python3.8/pdb.py", line 1572, in _runscript
    self.run(statement)
  File "/usr/lib/python3.8/bdb.py", line 580, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/home/yoh/proj/tributors/venvs/dev3/bin/tributors", line 3, in <module>
    __requires__ = 'tributors'
  File "/home/yoh/proj/tributors/tributors/client/__init__.py", line 145, in main
    main(args, extra)
  File "/home/yoh/proj/tributors/tributors/client/update.py", line 53, in main
    client.update(parsers=parsers, repo=args.repo, params=extra, thresh=args.thresh)
  File "/home/yoh/proj/tributors/tributors/main/__init__.py", line 107, in update
    client.update(thresh=thresh)
  File "/home/yoh/proj/tributors/tributors/main/parsers/allcontrib.py", line 120, in update
    self.lookup = {x["login"]: x for x in self.data.get("contributors", [])}
  File "/home/yoh/proj/tributors/tributors/main/parsers/allcontrib.py", line 120, in <dictcomp>
    self.lookup = {x["login"]: x for x in self.data.get("contributors", [])}
KeyError: 'login'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/yoh/proj/tributors/tributors/main/parsers/allcontrib.py(120)<dictcomp>()
-> self.lookup = {x["login"]: x for x in self.data.get("contributors", [])}
(Pdb) 
Post mortem debugger finished. The /home/yoh/proj/tributors/venvs/dev3/bin/tributors will be restarted
> /home/yoh/proj/tributors/venvs/dev3/bin/tributors(3)<module>()
-> __requires__ = 'tributors'
(Pdb) 
$> cat /home/yoh/.tmp/tributors-kc6pctlp 
$>
vsoch commented 4 years ago

Ah I didn't know that wasn't required, we'll need to fix that.

vsoch commented 4 years ago

You are saying this file does not exist?

Orcid token exports written to /home/yoh/.tmp/tributors-kc6pctlp. In the future export these variables for headless usage.
yarikoptic commented 4 years ago

Seems to exist but empty

vsoch commented 4 years ago

okay so I'm removing the GitHub parsing of metadata to update tributors away from happening by default. It will still iterate through the repo contributors from the GitHub api, but the metadata won't be updated unless you ask for it. I've also removed the requirement of a doi, so for your use case you would probably want to do:

tributors init zenodo
tributors update-lookup github
tributors update zenodo
vsoch commented 4 years ago

This issue is not clear, so what needs to be addressed specifically is:

Also @yarikoptic an Orcid Client ID doesn't refer to an orcid id, it refers to the client that you register as a developer app. It also has a secret.

yarikoptic commented 4 years ago

I got that, and suggested in https://github.com/con/tributors/issues/37#issuecomment-653679768 to rename variable to make it clear

vsoch commented 4 years ago

Oh I fixed the bug for 3! Sorry to clarify, there was a bug and I found it and fixed it (hopefully!)