-
Notifications
You must be signed in to change notification settings - Fork 511
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
Authenticate nbdev-template github API call #940
Comments
I've switched it over to using ghapi, so if you set Please reopen this if it turns out there's still an issue. |
I don't know if its related but trying with my existing repos to do nbdev_new
Traceback (most recent call last):
File "/home/gonluisr/miniconda3/envs/conda_dev/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/nbdev/cli.py", line 101, in nbdev_new
nbdev_create_config.__wrapped__(**kwargs)
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/nbdev/config.py", line 168, in nbdev_create_config
inf = _fetch_from_git()
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/nbdev/config.py", line 103, in _fetch_from_git
res['branch'],res['keywords'],desc = _get_info(owner=res['user'], repo=res['repo'])
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/nbdev/config.py", line 94, in _get_info
return r.default_branch, default_kw if not r.topics else ' '.join(r.topics), r.description
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/basics.py", line 247, in __getattr__
def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/basics.py", line 216, in stop
raise e
AttributeError: topics nbdev_new
/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/ghapi/core.py:99: UserWarning: Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated
else: warn('Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated')
Could not access repo: enterprise/the_repo to find your default branch - `main` assumed.
Edit `settings.ini` if this is incorrect.
In the future, you can allow nbdev to see private repos by setting the environment variable GITHUB_TOKEN as described here:
https://nbdev.fast.ai/cli.html#Using-nbdev_new-with-private-repos
repo = the_repo # Automatically inferred from git
user = enterprise # Automatically inferred from git
author = Luis Rolando Gonzalez # Automatically inferred from git
author_email = luis.gs@enterprise.com # Automatically inferred from git
# Please enter a value for description
description = Dask get_file demo
settings.ini created.
/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/ghapi/core.py:99: UserWarning: Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated
else: warn('Neither GITHUB_TOKEN nor GITHUB_JWT_TOKEN found: running as unauthenticated')
Traceback (most recent call last):
File "/home/gonluisr/miniconda3/envs/conda_dev/bin/nbdev_new", line 8, in <module>
sys.exit(nbdev_new())
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/nbdev/cli.py", line 106, in nbdev_new
tag = GhApi().repos.get_latest_release('fastai', 'nbdev-template').tag_name
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/ghapi/core.py", line 61, in __call__
return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/ghapi/core.py", line 118, in __call__
res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/net.py", line 214, in urlsend
return urlread(req, return_json=return_json, return_headers=return_headers)
File "/home/gonluisr/miniconda3/envs/conda_dev/lib/python3.10/site-packages/fastcore/net.py", line 115, in urlread
if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp) from None I am using: conda list | grep "fastai"
execnb 0.1.2 py_0 fastai
fastcore 1.5.24 py_0 fastai
ghapi 1.0.2 py_0 fastai
nbdev 2.2.10 py_0 fastai PS: Seems https://nbdev.fast.ai/cli.html#Using-nbdev_new-with-private-repos is broken link returned in the latest traceback |
@lgonzalezsa can you please create a new issue? |
Done. |
nbdev_new fails for me getting the latest release tag using the github API. Someone at my organization keeps exceeding the rate limit, so github is in the right here. The particular failure is
I think I can get around this by modifying the editing the file, but in a perfect world I'd be able to run the command offline, without any internet access at all. Could the templates be installed for offline use? If not, could the API call be authenticated?
The text was updated successfully, but these errors were encountered: