Nbdev with Google Colaboratory: A Tutorial

Thanks for your help @pete88b. Unfortunately, I am still having problems with colab_helper.ipynb. Trying to run setup_project, I encounter the following error:

        project_name = 'nextai'
        config, project_config = setup_project(project_name)

    Error: [nextai] section not found in /content/drive/My Drive/nbdev_colab_projects.ini    
    Please add a section for [nextai] and run `setup_project` again
    See https://pete88b.github.io/nbdev_colab_helper/core.html for details

However, I have the nbdev_colab_projects.ini file in the proper place and filled according to instructions:

[DEFAULT]
project_parent = /content/drive/My Drive/Colab Notebooks/github

git_user_name = jav0927
git_user_email = XXXXXXXX@gmail.com
git_user_password = XXXXXXX

[nextai]
git_url = https://github.com/jav0927/nextai.git
git_branch = main

Looking forward to your comments. I have found using nbdev_colab_helper immensely helpful.

Morning @joseadolfo

This works for me, if I copy your [nextai] section and run setup_project, i see:

git clone https://github.com/jav0927/nextai.git "/content/drive/My Drive/Colab Notebooks/github/nextai"
/content/drive/My Drive/Colab Notebooks/github/nextai
pip install fastscript==1.0.0 fastcore==1.0.8 nbdev==1.0.14
   ...

Sometimes after saving file changes in google drive it takes some time for a notebook to see the change - maybe you got hit with this delay?

Do you have any other project sections that work in your ini file?

@muellerzr Thanks for this great tutorial. Although I haven’t gotten it to the point where I want just yet, I really appreciate the work and explanation. I’m getting an error for the git_push function. I ran !git add * without a problem so I’m not sure why this is happening exactly. Any help would be appreciated.

Here is a copy of the error:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-12-661d9ae48718> in <module>()
  1 #colab
----> 2 git_push('.', 'update_ReadMe')

2 frames
/content/drive/My Drive/nbdev_colab/nbdev_colab/core.py in git_push(path, message)
 44   commands.append('git push origin master')
 45   for cmd in commands:
---> 46     process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
 47     output, err = process.communicate()
 48   os.chdir(start)

/usr/lib/python3.6/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
727                                 c2pread, c2pwrite,
728                                 errread, errwrite,
--> 729                                 restore_signals, start_new_session)
730         except:
731             # Cleanup if the child failed starting.

/usr/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1362                         if errno_num == errno.ENOENT:
   1363                             err_msg += ': ' + repr(err_filename)
-> 1364                     raise child_exception_type(errno_num, err_msg, err_filename)
   1365                 raise child_exception_type(err_msg)
   1366 

FileNotFoundError: [Errno 2] No such file or directory: 'git add *': 'git add *'