Submitting PR to fastai V2

@tcapelle @arora_aman there’s a new gh official github CLI that’s replacing hub - probably best to show how to use that instead.

1 Like

Thanks Jeremy, good point. I was reading about on hacker news just yesterday. I’ll update forum post by tomorrow. :slight_smile:

2 Likes

Done :slight_smile:

1 Like

Great job @arora_aman. Thank you for the update.

1 Like

I am trying to make a PR, but I can’t find nbdev_install_git_hooks anywhere in the repo… Also not sure where to find nbdev_build_lib to convert the notebooks to code.

pip install nbdev

1 Like

After cloning the repo, for contributing to the framework … do we need to do an editable install? Or run all the notebooks first?

If you’re able to run the notebooks, then you can update them, run nbdev and submit PR.:slight_smile:

If you have trouble running the notebook, do editable install of fastai2 so you don’t get “module not found” error.

so after activating the conda environment, what is the command to run nbdev (so that it runs all the notebooks creates the lib, etc…)?

Cuz I get ModuleNotFoundError: No module named 'fastai2' whenever I attempt to run the notebook

Seems like you have to do an editable install else the notebooks will throw ModuleNotFoundError exceptions when they encounter, in the nbs, anything related to importing a fastai2 module

1 Like

You must have a folder named fastai2. Go to that folder and run pip install -e .[dev]. This will do an editable install of fastai2 so you no longer get a module not found error.

Next, you can simply go to the nbs folder and you should be able to run the notebooks.

nbdev is the library released by fastai that converts notebooks to python modules and you can read more about it here.

Note: You might also need to do an editable install of fastcore.

1 Like

I’ll add this to your wiki once I make sure everything is running right on my box. Thanks!

1 Like

Using gh

I’m on a headless server and when I try to do the PR it gives me a URL to authorize my account. I do but then it redirects me to: http://localhost:34503/callback?.

I got nothing running on port 34503.

Again, this is all being done on a remote server.

SOLVED:

What a nightmare figuring this out … but here is the solution.

Any of you folks know how to update your local git repo with the latest using gh?

I have another PR to submit but I need to merge what I have locally with other changes pushed to master … don’t know if there is a gh way to do this since it seems to be managing everything w/r/t the fork it created for me to do this.

@jeremy
I am trying to generate a gh pr but the Authentication failed so I guess I am not a commiter I am trying to fix issue 190 I raised earlier.

Sorry to bother you.

@RogerS49 you need to make a fork of the repository, do you work on this fork, then submit a PR to merge this fork with the library.

2 Likes

Is your “local git repo” a clone or a fork from github.com/fastai/fastai2 ?

If it’s a clone, git pull + verify your change works + then gh instruction at the top of this thread should do, I guess?

But if your repo is a fork, it might be easier to use traditional git cli or web interface, to sync-up your fork from the latest, verify & commit changes to your own fork, then generate a PR by comparing across forks etc. etc., from the web interface. I personally use this approach when working on fastai v1, and had not needed to use gh.

May I suggest the following, to make it easier for new users:

  1. Do you mean “clone” instead of “fork”, because the instruction says git clone? As you know, fork is an entirely different git operation.

  2. Move “Steps 1-3 need to be only performed once when you clone fastai2 for the first time.” to immediately above the step 1, so new users will know right away what to do only once, instead of waiting till the end of the instructions to realize “oh wait, let me scroll back and see what it’s talking about.”

  3. Similarly, place “Note: In subsequent PRs start from the step 4.” right above step 4 in the instruction.

Thanks.

Fork

Say you want to start contributing to a project on github. The first thing to do is to fork it on github. Forking is the preferred way of collaboration on github and it works quite well with git. Just follow the instructions on github. Now you should have your own public repository which contains exactly the same history as the main repository at the time you forked. You will later push your contributions into this repository and the maintainers of the main repository will pull your commits into the main branch.

Clone

By cloning your fork on github you create your private local repository on your box. You will mostly work with it and only publish changes to github when you feel they should be merged into the main repository.

git clone git@github.com:YOURNAME/GitSharp.git

Of course this only works if you managed to create an SSH key and successfully uploaded it to github. I will not go into details on this, because it is already documented very well on github itself. If you experienced any problems with this step tell me and I will put them here.

Now you got a git repository called GitSharp and are ready to start coding!

Sourced from this site

This is the solution to my problem

Even though I forked fastai2 it still fails so I have to follow the advice in the link above. Thanks for the tip about the fork that makes total sense.

This worked for me so I have created a PR not sure what you guys at the other end will make of it. Even if it’s not accepted I have sort of gone end to end, but perhaps not concise enough.