|
| 1 | +.. _contributing-gitpod: |
| 2 | + |
| 3 | +Using Gitpod for pandas development |
| 4 | +=================================== |
| 5 | + |
| 6 | +This section of the documentation will guide you through: |
| 7 | + |
| 8 | +* using Gitpod for your pandas development environment |
| 9 | +* creating a personal fork of the pandas repository on GitHub |
| 10 | +* a quick tour of pandas and VSCode |
| 11 | +* working on the pandas documentation in Gitpod |
| 12 | + |
| 13 | +Gitpod |
| 14 | +------ |
| 15 | + |
| 16 | +`Gitpod`_ is an open-source platform for automated and ready-to-code |
| 17 | +development environments. It enables developers to describe their dev |
| 18 | +environment as code and start instant and fresh development environments for |
| 19 | +each new task directly from your browser. This reduces the need to install local |
| 20 | +development environments and deal with incompatible dependencies. |
| 21 | + |
| 22 | + |
| 23 | +Gitpod GitHub integration |
| 24 | +------------------------- |
| 25 | + |
| 26 | +To be able to use Gitpod, you will need to have the Gitpod app installed on your |
| 27 | +GitHub account, so if |
| 28 | +you do not have an account yet, you will need to create one first. |
| 29 | + |
| 30 | +To get started just login at `Gitpod`_, and grant the appropriate permissions to GitHub. |
| 31 | + |
| 32 | +We have built a python 3.8 environment and all development dependencies will |
| 33 | +install when the environment starts. |
| 34 | + |
| 35 | + |
| 36 | +Forking the pandas repository |
| 37 | +----------------------------- |
| 38 | + |
| 39 | +The best way to work on pandas as a contributor is by making a fork of the |
| 40 | +repository first. |
| 41 | + |
| 42 | +#. Browse to the `pandas repository on GitHub`_ and `create your own fork`_. |
| 43 | + |
| 44 | +#. Browse to your fork. Your fork will have a URL like |
| 45 | + https://github.com/noatamir/pandas-dev, except with your GitHub username in place of |
| 46 | + ``noatamir``. |
| 47 | + |
| 48 | +Starting Gitpod |
| 49 | +--------------- |
| 50 | +Once you have authenticated to Gitpod through GitHub, you can install the |
| 51 | +`Gitpod Chromium or Firefox browser extension <https://www.gitpod.io/docs/browser-extension>`_ |
| 52 | +which will add a **Gitpod** button next to the **Code** button in the |
| 53 | +repository: |
| 54 | + |
| 55 | +.. image:: ./gitpod-imgs/pandas-github.png |
| 56 | + :alt: pandas repository with Gitpod button screenshot |
| 57 | + |
| 58 | +#. If you install the extension - you can click the **Gitpod** button to start |
| 59 | + a new workspace. |
| 60 | + |
| 61 | +#. Alternatively, if you do not want to install the browser extension, you can |
| 62 | + visit https://gitpod.io/#https://github.com/USERNAME/pandas replacing |
| 63 | + ``USERNAME`` with your GitHub username. |
| 64 | + |
| 65 | +#. In both cases, this will open a new tab on your web browser and start |
| 66 | + building your development environment. Please note this can take a few |
| 67 | + minutes. |
| 68 | + |
| 69 | +#. Once the build is complete, you will be directed to your workspace, |
| 70 | + including the VSCode editor and all the dependencies you need to work on |
| 71 | + pandas. The first time you start your workspace, you will notice that there |
| 72 | + might be some actions running. This will ensure that you have a development |
| 73 | + version of pandas installed. |
| 74 | + |
| 75 | +#. When your workspace is ready, you can :ref:`test the build<contributing.running_tests>` by |
| 76 | + entering:: |
| 77 | + |
| 78 | + $ python -m pytest pandas |
| 79 | + |
| 80 | + |
| 81 | +Quick workspace tour |
| 82 | +-------------------- |
| 83 | +Gitpod uses VSCode as the editor. If you have not used this editor before, you |
| 84 | +can check the Getting started `VSCode docs`_ to familiarize yourself with it. |
| 85 | + |
| 86 | +Your workspace will look similar to the image below: |
| 87 | + |
| 88 | +.. image:: ./gitpod-imgs/gitpod-workspace.png |
| 89 | + :alt: Gitpod workspace screenshot |
| 90 | + |
| 91 | +We have marked some important sections in the editor: |
| 92 | + |
| 93 | +#. Your current Python interpreter - by default, this is ``pandas-dev`` and |
| 94 | + should be displayed in the status bar and on your terminal. You do not need |
| 95 | + to activate the conda environment as this will always be activated for you. |
| 96 | +#. Your current branch is always displayed in the status bar. You can also use |
| 97 | + this button to change or create branches. |
| 98 | +#. GitHub Pull Requests extension - you can use this to work with Pull Requests |
| 99 | + from your workspace. |
| 100 | +#. Marketplace extensions - we have added some essential extensions to the pandas |
| 101 | + Gitpod. Still, you can also install other extensions or syntax highlighting |
| 102 | + themes for your user, and these will be preserved for you. |
| 103 | +#. Your workspace directory - by default, it is ``/workspace/pandas-dev``. **Do not |
| 104 | + change this** as this is the only directory preserved in Gitpod. |
| 105 | + |
| 106 | +We have also pre-installed a few tools and VSCode extensions to help with the |
| 107 | +development experience: |
| 108 | + |
| 109 | +* `VSCode rst extension <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext>`_ |
| 110 | +* `Markdown All in One <https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one>`_ |
| 111 | +* `VSCode Gitlens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_ |
| 112 | +* `VSCode Git Graph extension <https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph>`_ |
| 113 | + |
| 114 | +Development workflow with Gitpod |
| 115 | +-------------------------------- |
| 116 | +The :ref:`contributing` section of this documentation contains |
| 117 | +information regarding the pandas development workflow. Make sure to check this |
| 118 | +before working on your contributions. |
| 119 | + |
| 120 | +When using Gitpod, git is pre configured for you: |
| 121 | + |
| 122 | +#. You do not need to configure your git username, and email as this should be |
| 123 | + done for you as you authenticated through GitHub. Unless you are using GitHub |
| 124 | + feature to keep email address private. You can check the git |
| 125 | + configuration with the command ``git config --list`` in your terminal. Use |
| 126 | + `` git config --global user.email “[email protected]”`` |
| 127 | + to set your email address to the one you use to make commits with your github |
| 128 | + profile. |
| 129 | +#. As you started your workspace from your own pandas fork, you will by default |
| 130 | + have both ``upstream`` and ``origin`` added as remotes. You can verify this by |
| 131 | + typing ``git remote`` on your terminal or by clicking on the **branch name** |
| 132 | + on the status bar (see image below). |
| 133 | + |
| 134 | + .. image:: ./gitpod-imgs/pandas-gitpod-branches.png |
| 135 | + :alt: Gitpod workspace branches plugin screenshot |
| 136 | + |
| 137 | +Rendering the pandas documentation |
| 138 | +---------------------------------- |
| 139 | +You can find the detailed documentation on how rendering the documentation with |
| 140 | +Sphinx works in the :ref:`contributing.howto-build-docs` section. To build the full |
| 141 | +docs you need to run the following command in the docs directory:: |
| 142 | + |
| 143 | + $ cd docs |
| 144 | + $ python make.py html |
| 145 | + |
| 146 | +Alternatively you can build a single page with:: |
| 147 | + |
| 148 | + python make.py html python make.py --single development/contributing_gitpod.rst |
| 149 | + |
| 150 | +You have two main options to render the documentation in Gitpod. |
| 151 | + |
| 152 | +Option 1: using Liveserve |
| 153 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 154 | + |
| 155 | +#. View the documentation in ``pandas/doc/build/html``. |
| 156 | +#. To see the rendered version of a page, you can right-click on the ``.html`` |
| 157 | + file and click on **Open with Live Serve**. Alternatively, you can open the |
| 158 | + file in the editor and click on the **Go live** button on the status bar. |
| 159 | + |
| 160 | + .. image:: ./gitpod-imgs/vscode-statusbar.png |
| 161 | + :alt: Gitpod workspace VSCode start live serve screenshot |
| 162 | + |
| 163 | +#. A simple browser will open to the right-hand side of the editor. We recommend |
| 164 | + closing it and click on the **Open in browser** button in the pop-up. |
| 165 | +#. To stop the server click on the **Port: 5500** button on the status bar. |
| 166 | + |
| 167 | +Option 2: using the rst extension |
| 168 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 169 | + |
| 170 | +A quick and easy way to see live changes in a ``.rst`` file as you work on it |
| 171 | +uses the rst extension with docutils. |
| 172 | + |
| 173 | +.. note:: This will generate a simple live preview of the document without the |
| 174 | + ``html`` theme, and some backlinks might not be added correctly. But it is an |
| 175 | + easy and lightweight way to get instant feedback on your work, without |
| 176 | + building the html files. |
| 177 | + |
| 178 | +#. Open any of the source documentation files located in ``doc/source`` in the |
| 179 | + editor. |
| 180 | +#. Open VSCode Command Palette with :kbd:`Cmd-Shift-P` in Mac or |
| 181 | + :kbd:`Ctrl-Shift-P` in Linux and Windows. Start typing "restructured" |
| 182 | + and choose either "Open preview" or "Open preview to the Side". |
| 183 | + |
| 184 | + .. image:: ./gitpod-imgs/vscode-rst.png |
| 185 | + :alt: Gitpod workspace VSCode open rst screenshot |
| 186 | + |
| 187 | +#. As you work on the document, you will see a live rendering of it on the editor. |
| 188 | + |
| 189 | + .. image:: ./gitpod-imgs/rst-rendering.png |
| 190 | + :alt: Gitpod workspace VSCode rst rendering screenshot |
| 191 | + |
| 192 | +If you want to see the final output with the ``html`` theme you will need to |
| 193 | +rebuild the docs with ``make html`` and use Live Serve as described in option 1. |
| 194 | + |
| 195 | +FAQ's and troubleshooting |
| 196 | +------------------------- |
| 197 | + |
| 198 | +How long is my Gitpod workspace kept for? |
| 199 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 200 | + |
| 201 | +Your stopped workspace will be kept for 14 days and deleted afterwards if you do |
| 202 | +not use them. |
| 203 | + |
| 204 | +Can I come back to a previous workspace? |
| 205 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 206 | + |
| 207 | +Yes, let's say you stepped away for a while and you want to carry on working on |
| 208 | +your pandas contributions. You need to visit https://gitpod.io/workspaces and |
| 209 | +click on the workspace you want to spin up again. All your changes will be there |
| 210 | +as you last left them. |
| 211 | + |
| 212 | +Can I install additional VSCode extensions? |
| 213 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 214 | + |
| 215 | +Absolutely! Any extensions you installed will be installed in your own workspace |
| 216 | +and preserved. |
| 217 | + |
| 218 | +I registered on Gitpod but I still cannot see a ``Gitpod`` button in my repositories. |
| 219 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 220 | + |
| 221 | +Head to https://gitpod.io/integrations and make sure you are logged in. |
| 222 | +Hover over GitHub and click on the three buttons that appear on the right. |
| 223 | +Click on edit permissions and make sure you have ``user:email``, |
| 224 | +``read:user``, and ``public_repo`` checked. Click on **Update Permissions** |
| 225 | +and confirm the changes in the GitHub application page. |
| 226 | + |
| 227 | +.. image:: ./gitpod-imgs/gitpod-edit-permissions-gh.png |
| 228 | + :alt: Gitpod integrations - edit GH permissions screenshot |
| 229 | + |
| 230 | +How long does my workspace stay active if I'm not using it? |
| 231 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 232 | + |
| 233 | +If you keep your workspace open in a browser tab but don't interact with it, |
| 234 | +it will shut down after 30 minutes. If you close the browser tab, it will |
| 235 | +shut down after 3 minutes. |
| 236 | + |
| 237 | +My terminal is blank - there is no cursor and it's completely unresponsive |
| 238 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 239 | + |
| 240 | +Unfortunately this is a known-issue on Gitpod's side. You can sort this |
| 241 | +issue in two ways: |
| 242 | + |
| 243 | +#. Create a new Gitpod workspace altogether. |
| 244 | +#. Head to your `Gitpod dashboard <https://gitpod.io/workspaces>`_ and locate |
| 245 | + the running workspace. Hover on it and click on the **three dots menu** |
| 246 | + and then click on **Stop**. When the workspace is completely stopped you |
| 247 | + can click on its name to restart it again. |
| 248 | + |
| 249 | +.. image:: ./gitpod-imgs/gitpod-dashboard-stop.png |
| 250 | + :alt: Gitpod dashboard and workspace menu screenshot |
| 251 | + |
| 252 | +I authenticated through GitHub but I still cannot commit to the repository through Gitpod. |
| 253 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 254 | + |
| 255 | +Head to https://gitpod.io/integrations and make sure you are logged in. |
| 256 | +Hover over GitHub and click on the three buttons that appear on the right. |
| 257 | +Click on edit permissions and make sure you have ``public_repo`` checked. |
| 258 | +Click on **Update Permissions** and confirm the changes in the |
| 259 | +GitHub application page. |
| 260 | + |
| 261 | +.. image:: ./gitpod-imgs/gitpod-edit-permissions-repo.png |
| 262 | + :alt: Gitpod integrations - edit GH repository permissions screenshot |
| 263 | + |
| 264 | +Acknowledgments |
| 265 | +--------------- |
| 266 | + |
| 267 | +This page is lightly adapted from the `NumPy`_ project . |
| 268 | + |
| 269 | +.. _Gitpod: https://www.gitpod.io/ |
| 270 | +.. _pandas repository on GitHub: https://github.com/pandas-dev/pandas |
| 271 | +.. _create your own fork: https://help.github.com/en/articles/fork-a-repo |
| 272 | +.. _VSCode docs: https://code.visualstudio.com/docs/getstarted/tips-and-tricks |
| 273 | +.. _NumPy: https://www.numpy.org/ |
0 commit comments