|
| 1 | +# UConn NumPy tutorial development |
| 2 | +## Prof. Ryan C. Cooper |
| 3 | + |
| 4 | +This semester we are developing Jupyter notebooks for the [NumPy |
| 5 | +tutorials repository](https://github.com/numpy/numpy-tutorials.git). We |
| 6 | +are going to use a few tools to build tutorials, share code, and review |
| 7 | +code: |
| 8 | + |
| 9 | +## Building tutorials |
| 10 | + |
| 11 | +__Python, Jupyter, and the SciPy stack__: You can install Python and NumPy with the [miniconda |
| 12 | +installer](https://docs.conda.io/en/latest/miniconda.html). Once its |
| 13 | +installed, you can run use the conda terminal to install NumPy, Jupyter, |
| 14 | +SciPy, and Matplotlib |
| 15 | + |
| 16 | +`$ conda install numpy jupyterlab scipy matplotlib` |
| 17 | + |
| 18 | +If you're new to NumPy, get started with the [Absolute Beginner's |
| 19 | +Tutorial to NumPy](https://numpy.org/devdocs/user/absolute_beginners.html). |
| 20 | + |
| 21 | +In your conda terminal, run |
| 22 | + |
| 23 | +`$ jupyter-lab` |
| 24 | + |
| 25 | +to get Jupyter running in a web browser (I prefer Firefox or Chrome). |
| 26 | +Now, you can run some Python commands and make some progress. |
| 27 | + |
| 28 | +## Sharing code |
| 29 | + |
| 30 | +__GitHub and Git__: NumPy is a free open source software. The code is |
| 31 | +updated using a version control software called |
| 32 | +[git](https://git-scm.com/downloads). NumPy is shared and reviewed by a |
| 33 | +worldwide community of developers on the website <www.github.com>. You |
| 34 | +can download, share, and suggest changes to software using git and |
| 35 | +GitHub. Start by installing [git](https://git-scm.com/downloads), then |
| 36 | +use a terminal to clone this repository |
| 37 | + |
| 38 | +$ git clone https://github.com/cooperrc/uconn_numpy_tutorials |
| 39 | + |
| 40 | +Once you have run this command, you now have a copy of this repository |
| 41 | +on your computer. Try opening the practice_notebook.ipynb in the |
| 42 | +notebooks folder and running the commands. You can play around with the |
| 43 | +inputs and even write your own code. |
| 44 | + |
| 45 | +## Reviewing code |
| 46 | + |
| 47 | +__GitHub Pull Requests__: We will get code reviewed by creating a pull |
| 48 | +request (PR) on an existing GitHub repository. Practice creating a PR |
| 49 | +with these steps: |
| 50 | + |
| 51 | +1. Create a |
| 52 | +[fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) |
| 53 | +of the repository |
| 54 | +[uconn_numpy_tutorials](https://github.com/cooperrc/uconn_numpy_tutorials) |
| 55 | + |
| 56 | +2. Clone your fork to your computer with the `git clone ...` |
| 57 | + |
| 58 | +3. Create a new "remote" for the upstream repo with the command |
| 59 | + |
| 60 | +`git remote add upstream https://github.com/cooperrc/uconn_numpy_tutorials` |
| 61 | + |
| 62 | +4. Use the `git` command to create a "branch" called my-notebook |
| 63 | + |
| 64 | +`git branch my-notebook` |
| 65 | + |
| 66 | +5. Use the `git` command to "checkout the branch" |
| 67 | + |
| 68 | +`git checkout my-notebook` |
| 69 | + |
| 70 | +6. Create your own Jupyter notebook in the notebooks folder, use your |
| 71 | +username to make it unique e.g. I would name the notebook, |
| 72 | +cooperrc_notebook.ipynb |
| 73 | + |
| 74 | + a. In your notebook include a NumPy example that you think is |
| 75 | + interesting |
| 76 | + |
| 77 | + b. Save your work and close the notebook |
| 78 | + |
| 79 | +7. Use the `git` command to (i) add your file, (ii) commit your work, |
| 80 | +and (iii) push your changes to your fork |
| 81 | + |
| 82 | + i. `git add notebooks/cooperrc_notebook.ipynb` |
| 83 | + ii. `git commit -m "my first branch commit for my notebook"` |
| 84 | + iii. `git push -u origin my-notebook` |
| 85 | + |
| 86 | +8. Now, you can [create a |
| 87 | +PR](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request#creating-the-pull-request) |
| 88 | +with this repository and I will merge your work. |
0 commit comments