fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.88k stars 488 forks source link

Make GitHub token use consistent within nbdev #1184

Open tylere opened 1 year ago

tylere commented 1 year ago

There are currently several ways to store and use GitHub tokens within nbdev:

  1. The release docs specify creating a token file in the root of your repo.
  2. Both config/_get_info and cli/_update_repo_meta use the environment variable GITHUB_TOKEN.
  3. nbdev_release looks for the token in 3 places. In order of preference: a. the environment variable NBDEV_TOKEN b. a token file in the root of your repo c. the environment variable GITHUB_TOKEN

This confused me earlier today, when the token in my 'token' file expired, and setting the GITHUB_TOKEN environment variable had no effect.

It would be beneficial to:

  1. decide on a single order of preference for where the token is obtained, use it consistently across all of nbdev, and describe it in the docs.
  2. if a method that looks for a token has a debug flag that is true, print out where the token was obtained from.
seeM commented 1 year ago

My preference would be to make the breaking change to only allow the GITHUB_TOKEN environment variable. @hamelsmu @jph00 what do you think?

jph00 commented 1 year ago

I think it's helpful to be able to override the env var by having a file in a repo. I'm happy to get rid of the nbdev specific one though, as long as we show a deprecation warning for a while first if we see it is set.