fastai / nbdev

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

nbdev_new fails on calling the GitHub API without guidance #404

Closed aronchick closed 3 years ago

aronchick commented 3 years ago

I've created a template repo and then cloned it locally:

https://github.com/aronchick/temp_notebook_repo

I mistakenly set it to private - but when I did "nbdev_new", I got the below error.

Traceback (most recent call last):
  File "test_file.py", line 15, in <module>
    cli.nbdev_new()
  File "/home/daaronch/.local/lib/python3.8/site-packages/fastcore/script.py", line 105, in _f
    tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/home/daaronch/working_trash/nbdev/nbdev/cli.py", line 111, in nbdev_new
    branch = urljson(url_json)['default_branch']
  File "/home/daaronch/.local/lib/python3.8/site-packages/fastcore/net.py", line 122, in urljson
    res = urlread(url, data=data)
  File "/home/daaronch/.local/lib/python3.8/site-packages/fastcore/net.py", line 112, in urlread
    if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp) from None
fastcore.basics.HTTP404NotFoundError: HTTP Error 404: Not Found

Ideally, you would still be able to pick up my local auth, and not have this problem. Regardless, it doesn't feel "natural" - doing something locally shouldn't have any impact based on what I've decided to do in the cloud (e.g. private/public).

It would be nice if the error notification was a bit cleaner. Here's a simple line I wrote - I couldn't do a PR because I couldn't figure out how to make all the pre-commit stuff work for the nbdev library or how to debug properly.

hamelsmu commented 3 years ago

I just fixed this in master. You should get a clean error message now. I didn't actually see this issue, I started working on it serendipitously when I realized this could happen so it's interesting that you raised the issue!

cc: @jph00

Also there are new docs 😄 I just added

image

hamelsmu commented 3 years ago

You will need to upgrade by

  1. clone this repo
  2. pip install -e .
hamelsmu commented 3 years ago

f

hamelsmu commented 3 years ago

Correction: you will not get an error message, it will try to gracefully use a default and warn you about it. Also, support for private repos are now added. BTW they released private GitHub pages as well recently.

aronchick commented 3 years ago

😍 thank you for the unbelievably quick response!


From: Hamel Husain notifications@github.com Sent: Sunday, January 24, 2021 10:12:20 AM To: fastai/nbdev nbdev@noreply.github.com Cc: David Aronchick David.Aronchick@microsoft.com; Author author@noreply.github.com Subject: Re: [fastai/nbdev] nbdev_new fails on calling the GitHub API without guidance (#404)

Correction: you will not get an error message, it will try to gracefully use a default and warn you about it. Also, support for private repos are now added. BTW they released private GitHub pages as well recently.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffastai%2Fnbdev%2Fissues%2F404%23issuecomment-766405736&data=04%7C01%7Cdavid.aronchick%40microsoft.com%7Cf7842b0e390a430c1f3e08d8c09397b5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637471087429635829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4UBPBjqSI6nCb5zX5DiB8kgsQN%2BxqJ6P0eH4CdMlh%2Bw%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAAMQ5IH4ZLI6JHZQAPOZB3S3RPIJANCNFSM4WQBZQUQ&data=04%7C01%7Cdavid.aronchick%40microsoft.com%7Cf7842b0e390a430c1f3e08d8c09397b5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637471087429635829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QTjRGW7fUt8LUVBqc1dDB16uR2vBCxA9rz7C62gRmKU%3D&reserved=0.