Pull requests and nbdev

Hello every1,
I am building a library using nbdev with some collaborators, and it has been great!
Probably I am missing something, but how do you @jeremy and @sgugger deal with pull request on github to quickly see the differences? when I click the commit on github I see:

   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'trifactors'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-2-f278090a3846>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;31m#export\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mtrifactors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimports\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mtrifactors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mtrifactors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransforms\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'trifactors'"
     ]
    }
   ],
   "outputs": [],
   "source": [
    "#export\n",
    "from trifactors.imports import *\n",
@@ -128,7 +116,18 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Mesh([vertex, faces]=4,2)"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mesh = Mesh(vertices, faces); mesh"
   ]
@@ -137,7 +136,23 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "<h4 id=\"Mesh.get_polygon\" class=\"doc_header\"><code>Mesh.get_polygon</code><a href=\"__main__.py#L11\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n",
       "\n",
       "> <code>Mesh.get_polygon</code>(**`i`**:`int`)\n",
       "\n"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_doc(Mesh.get_polygon)"
   ]
@@ -153,7 +168,20 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[0., 0., 0.],\n",
       "        [0., 0., 1.],\n",
       "        [0., 1., 0.]])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mesh.get_polygon(0)"
   ]
@@ -169,7 +197,23 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "<h4 id=\"Mesh.get_polygons\" class=\"doc_header\"><code>Mesh.get_polygons</code><a href=\"__main__.py#L12\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n",
       "\n",
       "> <code>Mesh.get_polygons</code>()\n",
       "\n"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_doc(Mesh.get_polygons)"
   ]
@@ -192,7 +236,19 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[0, 1, 2],\n",
       "        [1, 3, 2]])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mesh.faces"
   ]
@@ -272,7 +328,26 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[0., 0., 0., 0.],\n",
       "         [1., 1., 1., 1.],\n",
       "         [2., 2., 2., 2.],\n",
       "         [3., 3., 3., 3.],\n",
       "         [4., 4., 4., 4.]]), tensor([[0., 1., 2., 3.],\n",
       "         [0., 1., 2., 3.],\n",
       "         [0., 1., 2., 3.],\n",
       "         [0., 1., 2., 3.],\n",
       "         [0., 1., 2., 3.]]))"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid = torch.meshgrid(x, y); grid"
   ]
@@ -288,7 +363,37 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[0., 0., 0.],\n",
       "        [0., 1., 0.],\n",
       "        [0., 2., 0.],\n",
       "        [0., 3., 0.],\n",
       "        [1., 0., 0.],\n",
       "        [1., 1., 0.],\n",
       "        [1., 2., 0.],\n",
       "        [1., 3., 0.],\n",
       "        [2., 0., 0.],\n",
       "        [2., 1., 0.],\n",
       "        [2., 2., 0.],\n",
       "        [2., 3., 0.],\n",
       "        [3., 0., 0.],\n",
       "        [3., 1., 0.],\n",
       "        [3., 2., 0.],\n",
       "        [3., 3., 0.],\n",
       "        [4., 0., 0.],\n",
       "        [4., 1., 0.],\n",
       "        [4., 2., 0.],\n",
       "        [4., 3., 0.]])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hgrid = homogenize_points(torch.stack(grid, -1))\n",
    "vertices = hgrid.view(-1,3); vertices"
@@ -298,7 +403,21 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0,  1,  2],\n",
       "        [ 3,  4,  5],\n",
       "        [ 6,  7,  8],\n",
       "        [ 9, 10, 11]])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indexes = torch.arange(0, 4*3).view(4,3); indexes"
   ]
@@ -314,7 +433,23 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0.,  3.,  4.,  1.],\n",
       "        [ 1.,  4.,  5.,  2.],\n",
       "        [ 3.,  6.,  7.,  4.],\n",
       "        [ 4.,  7.,  8.,  5.],\n",
       "        [ 6.,  9., 10.,  7.],\n",
       "        [ 7., 10., 11.,  8.]])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faces = []\n",
    "for i in range(4-1):\n",
@@ -328,7 +463,18 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Mesh([vertex, faces]=20,6)"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mesh = Mesh(vertices, faces); mesh"
   ]
@@ -425,7 +571,18 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([12, 4, 3])"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ground.get_polygons().shape"
   ]
@@ -434,7 +591,24 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "<h4 id=\"FlatMesh.get_polygons\" class=\"doc_header\"><code>FlatMesh.get_polygons</code><a href=\"__main__.py#L26\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n",
       "\n",
       "> <code>FlatMesh.get_polygons</code>(**`reshaped`**=*`False`*)\n",
       "\n",
       "Get polygons from the mesh"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_doc(FlatMesh.get_polygons)"
   ]
@@ -450,7 +624,18 @@
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": []

and it is very hard to identify the changes. Is there a way to tell github to preent this in a better way?
Other quick question, when you move the notebooks to a folder, and you put a simlink on the nbs folder, you have to do this manually each time?

Great question! Use this:

3 Likes

Yup! :slight_smile:

this is awesome!

Do you have any Continous Integration app installed on the repo?

But if the repo is cloned on windows, it does not work my simlink created on ubuntu, any tips?

Do you have any Continous Integration app installed on the rep

You might like to checkout treon for notebook CI.