@@ -221,9 +221,13 @@ How to contribute
221
221
222
222
The preferred way to contribute to Matplotlib is to fork the `main
223
223
repository <https://github.com/matplotlib/matplotlib/> `__ on GitHub,
224
- then submit a "pull request" (PR).
224
+ then submit a "pull request" (PR). You can do this by cloning a copy of the
225
+ Maplotlib repository to your own computer, or alternatively using
226
+ `GitHub Codespaces <https://docs.github.com/codespaces >`_, a cloud-based
227
+ in-browser development environment that comes with the appropriated setup to
228
+ contribute to Matplotlib.
225
229
226
- A brief overview is:
230
+ A brief overview of the workflow is as follows.
227
231
228
232
1. `Create an account <https://github.com/join >`_ on GitHub if you do not
229
233
already have one.
@@ -232,35 +236,86 @@ A brief overview is:
232
236
click on the 'Fork' button near the top of the page. This creates a copy of
233
237
the code under your account on the GitHub server.
234
238
235
- 3. Clone this copy to your local disk ::
239
+ .. tab-set ::
236
240
237
- git clone https://github.com/<YOUR GITHUB USERNAME>/matplotlib.git
241
+ .. tab-item :: Local development
238
242
239
- 4. Enter the directory and install the local version of Matplotlib.
240
- See :ref: `installing_for_devs ` for instructions
243
+ 3. Clone this copy to your local disk::
244
+
245
+ git clone https://github.com/<YOUR GITHUB USERNAME>/matplotlib.git
246
+
247
+ .. tab-item :: Using GitHub Codespaces
248
+
249
+ 3. Check out the Matplotlib repository and activate your development
250
+ environment:
251
+
252
+ * Open codespaces on your fork by clicking on the green "Code" button
253
+ on the GitHub web interface and selecting the "Codespaces" tab.
254
+ * Next, click on "Open codespaces on <your branch name>". You will be
255
+ able to change branches later, so you can select the default
256
+ ``main `` branch.
257
+ * After the codespace is created, you will be taken to a new browser
258
+ tab where you can use the terminal to activate a pre-defined conda
259
+ environment called ``mpl-dev ``::
260
+
261
+ conda activate mpl-dev
262
+
263
+
264
+
265
+ 4. Install the local version of Matplotlib with::
266
+
267
+ python -m pip install -e .
268
+
269
+ See :ref:`installing_for_devs` for detailed instructions.
241
270
242
271
5. Create a branch to hold your changes::
243
272
244
- git checkout -b my-feature origin/main
273
+ git checkout -b my-feature origin/main
245
274
246
275
and start making changes. Never work in the ``main`` branch!
247
276
248
- 6. Work on this copy, on your computer, using Git to do the version control.
249
- When you're done editing e.g., ``lib/matplotlib/collections.py ``, do::
277
+ 6. Work on this task using Git to do the version control. Codespaces persist for
278
+ some time (check the `documentation for details
279
+ <https://docs.github.com/codespaces/getting-started/the-codespace-lifecycle> `_)
280
+ and can be managed on https://github.com/codespaces. When you're done editing
281
+ e.g., ``lib/matplotlib/collections.py ``, do::
250
282
251
- git add lib/matplotlib/collections.py
252
- git commit
283
+ git add lib/matplotlib/collections.py
284
+ git commit
253
285
254
- to record your changes in Git, then push them to GitHub with::
286
+ to record your changes in Git, then push them to your GitHub fork with::
255
287
256
- git push -u origin my-feature
288
+ git push -u origin my-feature
257
289
258
290
Finally, go to the web page of your fork of the Matplotlib repo, and click
259
291
'Pull request' to send your changes to the maintainers for review.
260
292
261
293
For more detailed instructions on how to set up Matplotlib for development and
262
294
best practices for contribution, see :ref: `installing_for_devs `.
263
295
296
+ GitHub Codespaces workflows
297
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
298
+
299
+ * If you need to open a GUI window with Matplotlib output on Codespaces, our
300
+ configuration includes a `light-weight Fluxbox-based desktop
301
+ <https://github.com/devcontainers/features/tree/main/src/desktop-lite> `_.
302
+ You can use it by connecting to this desktop via your web browser. To do this:
303
+
304
+ 1. Press ``F1 `` or ``Ctrl/Cmd+Shift+P `` and select
305
+ ``Ports: Focus on Ports View `` in the VSCode session to bring it into
306
+ focus. Open the ports view in your tool, select the ``noVNC `` port, and
307
+ click the Globe icon.
308
+ 2. In the browser that appears, click the Connect button and enter the desktop
309
+ password (``vscode `` by default).
310
+
311
+ Check the `GitHub instructions
312
+ <https://github.com/devcontainers/features/tree/main/src/desktop-lite#connecting-to-the-desktop> `_
313
+ for more details on connecting to the desktop.
314
+
315
+ * If you also built the documentation pages, you can view them using Codespaces.
316
+ Use the "Extensions" icon in the activity bar to install the "Live Server"
317
+ extension. Locate the ``doc/build/html `` folder in the Explorer, right click
318
+ the file you want to open and select "Open with Live Server."
264
319
265
320
.. _contributing_documentation :
266
321
0 commit comments