How to contribute to the fast.ai docs?

I am trying to create a notebook that will help new coders like me get more comfortable with cli/bash/git/etc. I think that one of the biggest reasons the new coders don’t use the command line and prefer GUI like Github desktop, Jupiter, etc is that I/we feel that we cant mess as much up. To me using the command line to make a PR is terrifying. That is why I am thinking that it would be very helpful for new users to have a notebook(s) that do all the steps that you would do in a cli, but in the comfort of a notebook. (the notebook(s) would be creating a pull request to a library that they create, not the fast.ai library, this way the notebook could take them through the git process while teaching them cli, git, bash, all from the comfort of notebooks). In my quest for this, I have learned a ton, but it seems like I have found “100 way not to make a PR request from a notebook.”

Issues

1. github want you to paste ssh code

I am thinking it would be better to use ssh vs https, but I ran into a dead end when I try to use notebook/bash to assign the ssh key to GitHub, I was able to get the notebook to print and copy the SSH key but not pass it to GitHub, it seems like GitHub forces you to just copy and paste your ssh code manually, I didn’t want the students to have to leave the notebook. I also tried to figure out how to use OAuth and the GitHub API but ran into issues. I tried using
!curl -u “Daniel-R-Armstrong” --data ‘{“title”:“test-key”,“key”:“ssh-rsa AAA…”}’ https://api.github.com/user/keys"

2. Dealing with different systems & aliases

I also tried to use hub, but I am not sure how to set up a notebook that would allow for the different ways that this has to be installed, mac/windows/Linux/binary. In my googling, it seems like the %%bash magic also doesn’t always work as expected, but this might have been solved https://stackoverflow.com/questions/43103750/use-bash-profile-aliases-in-jupyter-notebook

3. Assignments using subprocess

I see that the PR process has been improved with the new “fastai-make-pr-branch” and other tools. but I have been having issues with getting notebooks to run these different bash scripts. I am thinking that a solution is using the popen from the subprocess library but I am stuck on assigning variables. I am thinking that the helper function, fastai-make-pr-branch has four arguments I need to pass in, (auth="$1" user_name="$2" repo_name="$3" new_branch_name="$4") but I can’t figure out how to assigns from the searching I have done. @stas do you have any tips? thoughts on using subprocess.popen with “fastai-make-pr-branch

Thoughts?

Does anyone think that this projects would be beneficial?

Does anyone have any tips?

3 Likes

This sounds like an interesting project!

Since that only has to be done once per person, perhaps it’s OK to just have them copy/paste here?

Yeah installing hub isn’t always as easy as it should be. You can always simply copy a release binary from their github repo. Or you could write git stuff directly in python:

https://gitpython.readthedocs.io/en/stable/

There’s probably a lot of good reasons to rewrite this in python - including that we could then avoid having to deal with subprocesses.

1 Like

what jeremy said.

until then if you can invoke it from python through a sub-process, you should be able to run it directly from bash.

2 Likes

Thank you so much i was planning to contribute and did not know where to start …know i know how to start things

1 Like