Submitting Pull Request to fastai V2
I am a Wiki thread! You can edit me.
Creating a PR using gh - the official GitHub CLI
Create a conda environment with fastai2 requirements, include nbdev.
git clone https://github.com/fastai/fastai2
conda env create -f environment.yml
source activate fastai2
pip install -e ".[dev]"
f) Create an editable install of fastcore outside of fastai2 (see docs here)
nbdev_install_git_hooksinside the repo folder
Checkout to new feature branch (this is where new feature/bug-fix should be made)
git checkout -b <enter--relevant-feature-branch-name>
Make changes to Jupyter Notebook (ie., add tests, update feature, add new feature, add documentation etc.)
Save updated notebook
nbdev_build_lib(see Note2 below if this step produces a bug)
Run library tests
git commit -m "done with feature"
gh pr create -B master -b "enter body of PR here" -t "enter title"
This command will automatically create a fork for you if you’re in a repository that you don’t have permission to push to.
Note: Steps 1-3 need to be only performed once when you fork fastai2 for the first time. In subsequent PRs start from the step 4.
Note2: If you get an error like:
No such file or directory: '../fastai2/docs/_config.yml' then you need to clone the
fastai-docs repo into the same dir as you have
fastai2 in. This is because the
docs dir in
fastai2 is now a symlink to
Confirm PR created
You can confirm that your PR has been created by running
gh pr list inside fastai2 folder of your computer. You can also check the status of your PR by running
gh pr status. More detailed documentation can be found here.
Updating a PR
If you want to change your code after a PR has been created you can do it by sending more commits to the same remote branch. For example:
git commit -m "updated the feature"
git push origin <enter-branch-name-same-as-before>
It will automatically show up in the PR on the github page.
If these are small changes they can be squashed together at the merge time and appear as a single commit in the repository.
Merging a PR
This is done by the project maintainers so nothing more for you to do, you’ll see a notification on github when the PR gets merged and closed.
Workaround for authenticating on headless environments
The first time you submit a PR you’ll be asked to authroize
gh to work on your behalf (e.g., create forks as needed, submit PRs, etc…). If you are working on a remote server (a.k.a headless environment), as I suspect most will be, follow the instructions here to complete the steps required.