-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdevelopment_workflow.html
More file actions
1199 lines (996 loc) · 76.1 KB
/
Copy pathdevelopment_workflow.html
File metadata and controls
1199 lines (996 loc) · 76.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-content_root="../" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Development workflow — NumPy v2.6.dev0 Manual</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "light";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
</script>
<!--
this give us a css class that will be invisible only if js is disabled
-->
<noscript>
<style>
.pst-js-only { display: none !important; }
</style>
</noscript>
<!-- Loaded before other Sphinx assets -->
<link href="../_static/styles/theme.css?digest=90905a2f556bf617f1a9" rel="stylesheet" />
<link href="../_static/styles/pydata-sphinx-theme.css?digest=90905a2f556bf617f1a9" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=8f2a1f02" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css?v=4ae1632d" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Vibur" />
<link rel="stylesheet" type="text/css" href="../_static/jupyterlite_sphinx.css?v=8ee2c72c" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" />
<link rel="stylesheet" type="text/css" href="../_static/numpy.css?v=7e165a8b" />
<!-- So that users can add custom icons -->
<script defer src="../_static/scripts/fontawesome.js?digest=90905a2f556bf617f1a9"></script>
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=90905a2f556bf617f1a9" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=90905a2f556bf617f1a9" />
<script src="../_static/documentation_options.js?v=520afa83"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=30646c52"></script>
<script src="../_static/jupyterlite_sphinx.js?v=96e329c5"></script>
<script src="../_static/design-tabs.js?v=f930bc37"></script>
<script data-domain="numpy.org/doc/stable/" defer="defer" src="https://views.scientific-python.org/js/script.js"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'dev/development_workflow';</script>
<script>
DOCUMENTATION_OPTIONS.theme_version = '0.20.0';
DOCUMENTATION_OPTIONS.theme_switcher_json_url = 'https://numpy.org/doc/_static/versions.json';
DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'devdocs';
DOCUMENTATION_OPTIONS.show_version_warning_banner =
true;
</script>
<script>DOCUMENTATION_OPTIONS.search_as_you_type = false;</script>
<link rel="icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Advanced debugging tools" href="development_advanced_debugging.html" />
<link rel="prev" title="Building the NumPy API and reference docs" href="howto_build_docs.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
<meta name="docsearch:version" content="2.6.dev0" />
<meta name="docbuild:last-update" content="Jul 23, 2026"/>
<script src="../_static/searchtools.js"></script>
<script src="../_static/language_data.js"></script>
<script src="../searchindex.js"></script>
</head>
<body data-default-mode="light">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<dialog id="pst-search-dialog">
<form class="bd-search d-flex align-items-center"
action="../search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
placeholder="Search the docs ..."
aria-label="Search the docs ..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form>
</dialog>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header id="pst-header" class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
<div class="bd-header__inner bd-page-width">
<button class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation">
<span class="fa-solid fa-bars"></span>
</button>
<div class="col-lg-3 navbar-header-items__start">
<div class="navbar-item">
<a class="navbar-brand logo" href="../index.html">
<img src="../_static/numpylogo.svg" class="logo__image only-light" alt="NumPy v2.6.dev0 Manual - Home"/>
<img src="../_static/numpylogo_dark.svg" class="logo__image only-dark pst-js-only" alt="NumPy v2.6.dev0 Manual - Home"/>
</a></div>
</div>
<div class="col-lg-9 navbar-header-items">
<div class="me-auto navbar-header-items__center">
<div class="navbar-item">
<nav>
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item ">
<a class="nav-link nav-internal" href="../user/index.html">
User Guide
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../reference/index.html">
API reference
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../building/index.html">
Building from source
</a>
</li>
<li class="nav-item current active">
<a class="nav-link nav-internal" href="index.html">
Development
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../release.html">
Release notes
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-external" href="https://numpy.org/numpy-tutorials/">
Learn
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-external" href="https://numpy.org/neps">
NEPs
</a>
</li>
</ul>
</nav></div>
</div>
<div class="navbar-header-items__end">
<div class="navbar-item">
<button class="btn btn-sm pst-navbar-icon search-button search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button></div>
<div class="navbar-item">
<div class="theme-switch-container dropdown pst-js-only" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Color mode">
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button dropdown-toggle" aria-label="Color mode" data-bs-toggle="dropdown">
<i class="theme-switch fa-solid fa-sun fa-lg fa-fw" data-mode="light" title="Light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg fa-fw" data-mode="dark" title="Dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg fa-fw" data-mode="auto" title="System Settings"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg fa-fw me-1"></i>System Settings</button></li>
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="light"><i class="fa-solid fa-sun fa-lg fa-fw me-1"></i>Light</button></li>
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="dark"><i class="fa-solid fa-moon fa-lg fa-fw me-1"></i>Dark</button></li>
</ul>
</div></div>
<div class="navbar-item">
<div class="version-switcher__container dropdown pst-js-only">
<button id="pst-version-switcher-button-2"
type="button"
class="version-switcher__button btn btn-sm dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-2"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-2"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-2">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/numpy/numpy" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i><span class="visually-hidden">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<button class="pst-navbar-icon sidebar-toggle secondary-toggle" aria-label="On this page">
<span class="fa-solid fa-outdent"></span>
</button>
</div>
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<dialog id="pst-primary-sidebar-modal"></dialog>
<div id="pst-primary-sidebar" class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
<div class="sidebar-header-items__center">
<div class="navbar-item">
<nav>
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item ">
<a class="nav-link nav-internal" href="../user/index.html">
User Guide
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../reference/index.html">
API reference
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../building/index.html">
Building from source
</a>
</li>
<li class="nav-item current active">
<a class="nav-link nav-internal" href="index.html">
Development
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="../release.html">
Release notes
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-external" href="https://numpy.org/numpy-tutorials/">
Learn
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-external" href="https://numpy.org/neps">
NEPs
</a>
</li>
</ul>
</nav></div>
</div>
<div class="sidebar-header-items__end">
<div class="navbar-item">
<button class="btn btn-sm pst-navbar-icon search-button search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
</button></div>
<div class="navbar-item">
<div class="theme-switch-container dropdown pst-js-only" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Color mode">
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button dropdown-toggle" aria-label="Color mode" data-bs-toggle="dropdown">
<i class="theme-switch fa-solid fa-sun fa-lg fa-fw" data-mode="light" title="Light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg fa-fw" data-mode="dark" title="Dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg fa-fw" data-mode="auto" title="System Settings"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg fa-fw me-1"></i>System Settings</button></li>
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="light"><i class="fa-solid fa-sun fa-lg fa-fw me-1"></i>Light</button></li>
<li><button class="dropdown-item d-flex align-items-center theme-change-button" data-mode="dark"><i class="fa-solid fa-moon fa-lg fa-fw me-1"></i>Dark</button></li>
</ul>
</div></div>
<div class="navbar-item">
<div class="version-switcher__container dropdown pst-js-only">
<button id="pst-version-switcher-button-3"
type="button"
class="version-switcher__button btn btn-sm dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="pst-version-switcher-list-3"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="pst-version-switcher-list-3"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="pst-version-switcher-button-3">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/numpy/numpy" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i><span class="visually-hidden">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item pst-sidebar-collapse"><button id="pst-collapse-sidebar-button" aria-expanded="true" aria-controls="pst-primary-sidebar">
<svg class="pst-icon" role="img" aria-hidden="true" focusable="false" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor" d="M3 15.5C2.36232 15.5 1.74874 15.2564 1.28478 14.8189C0.820828 14.3815 0.541576 13.7832 0.504167 13.1467L0.5 13L0.5 3C0.499965 2.36232 0.743605 1.74874 1.18107 1.28478C1.61854 0.820828 2.21676 0.541576 2.85333 0.504167L3 0.5L13 0.5C13.6377 0.499965 14.2513 0.743605 14.7152 1.18107C15.1792 1.61854 15.4584 2.21676 15.4958 2.85333L15.5 3L15.5 13C15.5 13.6377 15.2564 14.2513 14.8189 14.7152C14.3815 15.1792 13.7832 15.4584 13.1467 15.4958L13 15.5L3 15.5ZM3 13.8333L10.5 13.8333L10.5 2.16667L3 2.16667C2.79589 2.16669 2.59889 2.24163 2.44636 2.37726C2.29383 2.5129 2.19638 2.69979 2.1725 2.9025L2.16667 3L2.16667 13C2.16669 13.2041 2.24163 13.4011 2.37726 13.5536C2.5129 13.7062 2.69979 13.8036 2.9025 13.8275L3 13.8333ZM6.65583 10.325L6.5775 10.2558L4.91083 8.58917C4.76735 8.44567 4.68116 8.25476 4.66843 8.05223C4.65569 7.84971 4.71729 7.6495 4.84167 7.48917L4.91083 7.41083L6.5775 5.74417C6.72747 5.59471 6.9287 5.50794 7.14032 5.50148C7.35194 5.49502 7.55809 5.56935 7.7169 5.70937C7.8757 5.8494 7.97525 6.04463 7.99533 6.25539C8.01541 6.46616 7.95451 6.67667 7.825 6.84417L7.75583 6.9225L6.67917 8L7.75583 9.0775C7.89931 9.22099 7.98551 9.41191 7.99824 9.61443C8.01097 9.81695 7.94938 10.0172 7.825 10.1775L7.75583 10.2558C7.61234 10.3993 7.42142 10.4855 7.2189 10.4982C7.01638 10.511 6.81617 10.4494 6.65583 10.325Z"/>
</svg>
<span class="pst-collapse-sidebar-label">Collapse Sidebar</span>
<span class="pst-expand-sidebar-label">Expand Sidebar</span>
</button></div>
<div class="sidebar-primary-item">
<nav class="bd-docs-nav bd-links"
aria-label="Section Navigation">
<p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p>
<div class="bd-toc-item navbar-nav"><ul class="current nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="ai_policy.html">AI Policy</a></li>
<li class="toctree-l1"><a class="reference internal" href="development_environment.html">Setting up and using your development environment</a></li>
<li class="toctree-l1"><a class="reference internal" href="spin.html">Spin: NumPy’s developer tool</a></li>
<li class="toctree-l1"><a class="reference internal" href="howto_build_docs.html">Building the NumPy API and reference docs</a></li>
<li class="toctree-l1 current active"><a class="current reference internal" href="#">Development workflow</a></li>
<li class="toctree-l1"><a class="reference internal" href="development_advanced_debugging.html">Advanced debugging tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="development_ghcodespaces.html">Using GitHub Codespaces for NumPy development</a></li>
<li class="toctree-l1"><a class="reference internal" href="reviewer_guidelines.html">Reviewer guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="../benchmarking.html">NumPy benchmarks</a></li>
<li class="toctree-l1"><a class="reference external" href="https://numpy.org/neps/nep-0045-c_style_guide.html">NumPy C style guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="depending_on_numpy.html">For downstream package authors</a></li>
<li class="toctree-l1"><a class="reference internal" href="releasing.html">Releasing a version</a></li>
<li class="toctree-l1"><a class="reference internal" href="governance/index.html">NumPy governance</a></li>
<li class="toctree-l1"><a class="reference internal" href="howto-docs.html">How to contribute to the NumPy documentation</a></li>
</ul>
</div>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
<div class="sidebar-primary-item">
<div id="ethical-ad-placement"
class="flat"
data-ea-publisher="readthedocs"
data-ea-type="readthedocs-sidebar"
data-ea-manual="true">
</div></div>
</div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item">
<nav aria-label="Breadcrumb" class="d-print-none">
<ul class="bd-breadcrumbs">
<li class="breadcrumb-item breadcrumb-home">
<a href="../index.html" class="nav-link" aria-label="Home">
<i class="fa-solid fa-home"></i>
</a>
</li>
<li class="breadcrumb-item"><a href="index.html" class="nav-link">Contributing to NumPy</a></li>
<li class="breadcrumb-item active" aria-current="page"><span class="ellipsis">Development workflow</span></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section id="development-workflow">
<span id="id1"></span><h1>Development workflow<a class="headerlink" href="#development-workflow" title="Link to this heading">#</a></h1>
<p>You already have your own forked copy of the NumPy repository, have configured
Git, and have linked the upstream repository as explained in
<a class="reference external" href="https://scikit-image.org/docs/stable/gitwash/set_up_fork.html#linking-to-upstream" title="(in skimage v0.26.0)"><span>Linking your repository to the upstream repo</span></a>. What is described below is a recommended workflow
with Git.</p>
<section id="basic-workflow">
<h2>Basic workflow<a class="headerlink" href="#basic-workflow" title="Link to this heading">#</a></h2>
<p>In short:</p>
<ol class="arabic simple">
<li><p>Start a new <em>feature branch</em> for each set of edits that you do.
See <a class="reference internal" href="#making-a-new-feature-branch"><span class="std std-ref">below</span></a>.</p></li>
<li><p>Hack away! See <a class="reference internal" href="#editing-workflow"><span class="std std-ref">below</span></a></p></li>
<li><p>When finished:</p>
<ul class="simple">
<li><p><em>Contributors</em>: push your feature branch to your own Github repo, and
<a class="reference internal" href="#asking-for-merging"><span class="std std-ref">create a pull request</span></a>.</p></li>
<li><p><em>Core developers</em>: If you want to push changes without
further review, see the notes <a class="reference internal" href="#pushing-to-main"><span class="std std-ref">below</span></a>.</p></li>
</ul>
</li>
</ol>
<p>This way of working helps to keep work well organized and the history
as clear as possible.</p>
<section id="making-a-new-feature-branch">
<span id="id2"></span><h3>Making a new feature branch<a class="headerlink" href="#making-a-new-feature-branch" title="Link to this heading">#</a></h3>
<p>First, fetch new commits from the <code class="docutils literal notranslate"><span class="pre">upstream</span></code> repository:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">fetch</span> <span class="n">upstream</span>
</pre></div>
</div>
<p>Then, create a new branch based on the main branch of the upstream
repository:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span> <span class="n">upstream</span><span class="o">/</span><span class="n">main</span>
</pre></div>
</div>
</section>
<section id="the-editing-workflow">
<span id="editing-workflow"></span><h3>The editing workflow<a class="headerlink" href="#the-editing-workflow" title="Link to this heading">#</a></h3>
<section id="overview">
<h4>Overview<a class="headerlink" href="#overview" title="Link to this heading">#</a></h4>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># hack hack</span>
<span class="n">git</span> <span class="n">status</span> <span class="c1"># Optional</span>
<span class="n">git</span> <span class="n">diff</span> <span class="c1"># Optional</span>
<span class="n">git</span> <span class="n">add</span> <span class="n">modified_file</span>
<span class="n">git</span> <span class="n">commit</span>
<span class="c1"># push the branch to your own Github repo</span>
<span class="n">git</span> <span class="n">push</span> <span class="n">origin</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span>
</pre></div>
</div>
</section>
<section id="in-more-detail">
<h4>In more detail<a class="headerlink" href="#in-more-detail" title="Link to this heading">#</a></h4>
<ol class="arabic">
<li><p>Make some changes. When you feel that you’ve made a complete, working set
of related changes, move on to the next steps.</p></li>
<li><p>Optional: Check which files have changed with <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">status</span></code>. You’ll see a
listing like this one:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># On branch my-new-feature</span>
<span class="c1"># Changed but not updated:</span>
<span class="c1"># (use "git add <file>..." to update what will be committed)</span>
<span class="c1"># (use "git checkout -- <file>..." to discard changes in working directory)</span>
<span class="c1">#</span>
<span class="c1"># modified: README</span>
<span class="c1">#</span>
<span class="c1"># Untracked files:</span>
<span class="c1"># (use "git add <file>..." to include in what will be committed)</span>
<span class="c1">#</span>
<span class="c1"># INSTALL</span>
<span class="n">no</span> <span class="n">changes</span> <span class="n">added</span> <span class="n">to</span> <span class="n">commit</span> <span class="p">(</span><span class="n">use</span> <span class="s2">"git add"</span> <span class="ow">and</span><span class="o">/</span><span class="ow">or</span> <span class="s2">"git commit -a"</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p>Optional: Compare the changes with the previous version using with <code class="docutils literal notranslate"><span class="pre">git</span>
<span class="pre">diff</span></code>. This brings up a simple text browser interface that
highlights the difference between your files and the previous version.</p></li>
<li><p>Add any relevant modified or new files using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">add</span> <span class="pre">modified_file</span></code>.
This puts the files into a staging area, which is a queue
of files that will be added to your next commit. Only add files that have
related, complete changes. Leave files with unfinished changes for later
commits.</p></li>
<li><p>To commit the staged files into the local copy of your repo, do <code class="docutils literal notranslate"><span class="pre">git</span>
<span class="pre">commit</span></code>. At this point, a text editor will open up to allow you to write a
commit message. Read the <a class="reference internal" href="#writing-the-commit-message"><span class="std std-ref">commit message
section</span></a> to be sure that you are writing a
properly formatted and sufficiently detailed commit message. After saving
your message and closing the editor, your commit will be saved. For trivial
commits, a short commit message can be passed in through the command line
using the <code class="docutils literal notranslate"><span class="pre">-m</span></code> flag. For example, <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span> <span class="pre">-am</span> <span class="pre">"ENH:</span> <span class="pre">Some</span> <span class="pre">message"</span></code>.</p>
<p>In some cases, you will see this form of the commit command: <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">commit</span>
<span class="pre">-a</span></code>. The extra <code class="docutils literal notranslate"><span class="pre">-a</span></code> flag automatically commits all modified files and
removes all deleted files. This can save you some typing of numerous <code class="docutils literal notranslate"><span class="pre">git</span>
<span class="pre">add</span></code> commands; however, it can add unwanted changes to a commit if you’re
not careful.</p>
</li>
<li><p>Push the changes to your fork on GitHub:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">push</span> <span class="n">origin</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span>
</pre></div>
</div>
</li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Assuming you have followed the instructions in these pages, git will create
a default link to your GitHb repo called <code class="docutils literal notranslate"><span class="pre">origin</span></code>. You
can ensure that the link to origin is permanently set by using the
<code class="docutils literal notranslate"><span class="pre">--set-upstream</span></code> option:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">push</span> <span class="o">--</span><span class="nb">set</span><span class="o">-</span><span class="n">upstream</span> <span class="n">origin</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span>
</pre></div>
</div>
<p>From now on, <code class="docutils literal notranslate"><span class="pre">git</span></code> will know that <code class="docutils literal notranslate"><span class="pre">my-new-feature</span></code> is related to the
<code class="docutils literal notranslate"><span class="pre">my-new-feature</span></code> branch in your own GitHub repo. Subsequent push calls
are then simplified to the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">push</span>
</pre></div>
</div>
<p>You have to use <code class="docutils literal notranslate"><span class="pre">--set-upstream</span></code> for each new branch that you create.</p>
</div>
<p>It may be the case that while you were working on your edits, new commits have
been added to <code class="docutils literal notranslate"><span class="pre">upstream</span></code> that affect your work. In this case, follow the
<a class="reference internal" href="#rebasing-on-main"><span class="std std-ref">Rebasing on main</span></a> section of this document to apply those changes to
your branch.</p>
</section>
<section id="writing-the-commit-message">
<span id="id3"></span><h4>Writing the commit message<a class="headerlink" href="#writing-the-commit-message" title="Link to this heading">#</a></h4>
<p>Commit messages should be clear and follow a few basic rules. Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ENH</span><span class="p">:</span> <span class="n">add</span> <span class="n">functionality</span> <span class="n">X</span> <span class="n">to</span> <span class="n">numpy</span><span class="o">.<</span><span class="n">submodule</span><span class="o">>.</span>
<span class="n">The</span> <span class="n">first</span> <span class="n">line</span> <span class="n">of</span> <span class="n">the</span> <span class="n">commit</span> <span class="n">message</span> <span class="n">starts</span> <span class="k">with</span> <span class="n">a</span> <span class="n">capitalized</span> <span class="n">acronym</span>
<span class="p">(</span><span class="n">options</span> <span class="n">listed</span> <span class="n">below</span><span class="p">)</span> <span class="n">indicating</span> <span class="n">what</span> <span class="nb">type</span> <span class="n">of</span> <span class="n">commit</span> <span class="n">this</span> <span class="ow">is</span><span class="o">.</span> <span class="n">Then</span> <span class="n">a</span> <span class="n">blank</span>
<span class="n">line</span><span class="p">,</span> <span class="n">then</span> <span class="n">more</span> <span class="n">text</span> <span class="k">if</span> <span class="n">needed</span><span class="o">.</span> <span class="n">Lines</span> <span class="n">shouldn</span><span class="s1">'t be longer than 72</span>
<span class="n">characters</span><span class="o">.</span> <span class="n">If</span> <span class="n">the</span> <span class="n">commit</span> <span class="ow">is</span> <span class="n">related</span> <span class="n">to</span> <span class="n">a</span> <span class="n">ticket</span><span class="p">,</span> <span class="n">indicate</span> <span class="n">that</span> <span class="k">with</span>
<span class="s2">"See #3456"</span><span class="p">,</span> <span class="s2">"See ticket 3456"</span><span class="p">,</span> <span class="s2">"Closes #3456"</span> <span class="ow">or</span> <span class="n">similar</span><span class="o">.</span>
</pre></div>
</div>
<p>Describing the motivation for a change, the nature of a bug for bug fixes or
some details on what an enhancement does are also good to include in a commit
message. Messages should be understandable without looking at the code
changes. A commit message like <code class="docutils literal notranslate"><span class="pre">MAINT:</span> <span class="pre">fixed</span> <span class="pre">another</span> <span class="pre">one</span></code> is an example of
what not to do; the reader has to go look for context elsewhere.</p>
<p>Standard acronyms to start the commit message with are:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">API</span><span class="p">:</span> <span class="n">an</span> <span class="p">(</span><span class="n">incompatible</span><span class="p">)</span> <span class="n">API</span> <span class="n">change</span>
<span class="n">BENCH</span><span class="p">:</span> <span class="n">changes</span> <span class="n">to</span> <span class="n">the</span> <span class="n">benchmark</span> <span class="n">suite</span>
<span class="n">BLD</span><span class="p">:</span> <span class="n">change</span> <span class="n">related</span> <span class="n">to</span> <span class="n">building</span> <span class="n">numpy</span>
<span class="n">BUG</span><span class="p">:</span> <span class="n">bug</span> <span class="n">fix</span>
<span class="n">CI</span><span class="p">:</span> <span class="n">continuous</span> <span class="n">integration</span>
<span class="n">DEP</span><span class="p">:</span> <span class="n">deprecate</span> <span class="n">something</span><span class="p">,</span> <span class="ow">or</span> <span class="n">remove</span> <span class="n">a</span> <span class="n">deprecated</span> <span class="nb">object</span>
<span class="n">DEV</span><span class="p">:</span> <span class="n">development</span> <span class="n">tool</span> <span class="ow">or</span> <span class="n">utility</span>
<span class="n">DOC</span><span class="p">:</span> <span class="n">documentation</span>
<span class="n">ENH</span><span class="p">:</span> <span class="n">enhancement</span>
<span class="n">MAINT</span><span class="p">:</span> <span class="n">maintenance</span> <span class="n">commit</span> <span class="p">(</span><span class="n">refactoring</span><span class="p">,</span> <span class="n">typos</span><span class="p">,</span> <span class="n">etc</span><span class="o">.</span><span class="p">)</span>
<span class="n">MNT</span><span class="p">:</span> <span class="n">alias</span> <span class="k">for</span> <span class="n">MAINT</span>
<span class="n">NEP</span><span class="p">:</span> <span class="n">NumPy</span> <span class="n">enhancement</span> <span class="n">proposals</span>
<span class="n">REL</span><span class="p">:</span> <span class="n">related</span> <span class="n">to</span> <span class="n">releasing</span> <span class="n">numpy</span>
<span class="n">REV</span><span class="p">:</span> <span class="n">revert</span> <span class="n">an</span> <span class="n">earlier</span> <span class="n">commit</span>
<span class="n">STY</span><span class="p">:</span> <span class="n">style</span> <span class="n">fix</span> <span class="p">(</span><span class="n">whitespace</span><span class="p">,</span> <span class="n">PEP8</span><span class="p">)</span>
<span class="n">TST</span><span class="p">:</span> <span class="n">addition</span> <span class="ow">or</span> <span class="n">modification</span> <span class="n">of</span> <span class="n">tests</span>
<span class="n">TYP</span><span class="p">:</span> <span class="n">static</span> <span class="n">typing</span>
<span class="n">WIP</span><span class="p">:</span> <span class="n">work</span> <span class="ow">in</span> <span class="n">progress</span><span class="p">,</span> <span class="n">do</span> <span class="ow">not</span> <span class="n">merge</span>
</pre></div>
</div>
<section id="commands-to-skip-continuous-integration">
<h5>Commands to skip continuous integration<a class="headerlink" href="#commands-to-skip-continuous-integration" title="Link to this heading">#</a></h5>
<p>By default a lot of continuous integration (CI) jobs are run for every PR,
from running the test suite on different operating systems and hardware
platforms to building the docs. In some cases you already know that CI isn’t
needed (or not all of it), for example if you work on CI config files, text in
the README, or other files that aren’t involved in regular build, test or docs
sequences. In such cases you may explicitly skip CI by including one or more of
these fragments in each commit message of a PR:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">[skip</span> <span class="pre">ci]</span></code>: skip all CI</p>
<p>Only recommended if you are still not ready for the checks to run on your PR
(for example, if this is only a draft.)</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">[skip</span> <span class="pre">actions]</span></code>: skip GitHub Actions jobs</p>
<p><a class="reference external" href="https://docs.github.com/actions">GitHub Actions</a> is where most of the CI
checks are run, including the linter, benchmarking, running basic tests for
most architectures and OSs, and several compiler and CPU optimization
settings.
<a class="reference external" href="https://github.com/numpy/numpy/tree/main/.github/workflows">See the configuration files for these checks.</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">[skip</span> <span class="pre">circle]</span></code>: skip CircleCI jobs</p>
<p><a class="reference external" href="https://circleci.com/">CircleCI</a> is where we build the documentation and
store the generated artifact for preview in each PR. This check will also run
all the docstrings examples and verify their results. If you don’t make
documentation changes, but you make changes to a function’s API, for example,
you may need to run these tests to verify that the doctests are still valid.
<a class="reference external" href="https://github.com/numpy/numpy/blob/main/.circleci/config.yml">See the configuration file for these checks.</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">[skip</span> <span class="pre">cirrus]</span></code>: skip Cirrus jobs</p>
<p><a class="reference external" href="https://cirrus-ci.org/">CirrusCI</a> mostly triggers Linux aarch64 and MacOS Arm64 wheels
uploads.
<a class="reference external" href="https://github.com/numpy/numpy/blob/main/.cirrus.star">See the configuration file for these checks.</a></p>
</li>
</ul>
</section>
<section id="test-building-wheels">
<h5>Test building wheels<a class="headerlink" href="#test-building-wheels" title="Link to this heading">#</a></h5>
<p>NumPy currently uses <a class="reference external" href="https://cibuildwheel.readthedocs.io/en/stable/">cibuildwheel</a>
in order to build wheels through continuous integration services. To save resources, the
cibuildwheel wheel builders are not run by default on every single PR or commit to main.</p>
<p>If you would like to test that your pull request do not break the wheel builders,
you can do so by appending <code class="docutils literal notranslate"><span class="pre">[wheel</span> <span class="pre">build]</span></code> to the first line of the commit
message of the newest commit in your PR. Please only do so for build-related
PRs, because running all wheel builds is slow and expensive.</p>
<p>The wheels built via github actions (including 64-bit Linux, x86-64 macOS, and
32/64-bit Windows) will be uploaded as artifacts in zip files. You can access
them from the Summary page of the “Wheel builder” action. The aarch64 Linux and
arm64 macOS wheels built via Cirrus CI are not available as artifacts.
Additionally, the wheels will be uploaded to
<a class="reference external" href="https://anaconda.org/scientific-python-nightly-wheels/">https://anaconda.org/scientific-python-nightly-wheels/</a> on the following conditions:</p>
<ul class="simple">
<li><p>by a weekly cron job or</p></li>
<li><p>if the GitHub Actions or Cirrus build has been manually triggered, which
requires appropriate permissions</p></li>
</ul>
<p>The wheels will be uploaded to <a class="reference external" href="https://anaconda.org/multibuild-wheels-staging/">https://anaconda.org/multibuild-wheels-staging/</a>
if the build was triggered by a tag to the repo that begins with <code class="docutils literal notranslate"><span class="pre">v</span></code></p>
</section>
</section>
</section>
<section id="get-the-mailing-list-s-opinion">
<span id="workflow-mailing-list"></span><h3>Get the mailing list’s opinion<a class="headerlink" href="#get-the-mailing-list-s-opinion" title="Link to this heading">#</a></h3>
<p>If you plan a new feature or API change, it’s wisest to first email the
NumPy <a class="reference external" href="https://mail.python.org/mailman/listinfo/numpy-discussion">mailing list</a>
asking for comment. If you haven’t heard back in a week, it’s
OK to ping the list again.</p>
</section>
<section id="asking-for-your-changes-to-be-merged-with-the-main-repo">
<span id="asking-for-merging"></span><h3>Asking for your changes to be merged with the main repo<a class="headerlink" href="#asking-for-your-changes-to-be-merged-with-the-main-repo" title="Link to this heading">#</a></h3>
<p>When you feel your work is finished, you can create a pull request (PR).
If your changes involve modifications to the API or addition/modification of a
function, add a release note to the <code class="docutils literal notranslate"><span class="pre">doc/release/upcoming_changes/</span></code>
directory, following the instructions and format in the
<code class="docutils literal notranslate"><span class="pre">doc/release/upcoming_changes/README.rst</span></code> file.</p>
<p>Use the same prefix convention for your pull request title as for commit
messages (e.g., <code class="docutils literal notranslate"><span class="pre">BUG:</span></code>, <code class="docutils literal notranslate"><span class="pre">ENH:</span></code>, <code class="docutils literal notranslate"><span class="pre">DOC:</span></code>). This enables automated labeling
of your PR.</p>
</section>
<section id="getting-your-pr-reviewed">
<span id="workflow-pr-timeline"></span><h3>Getting your PR reviewed<a class="headerlink" href="#getting-your-pr-reviewed" title="Link to this heading">#</a></h3>
<p>We review pull requests as soon as we can, typically within a week. If you get
no review comments within two weeks, feel free to ask for feedback by
adding a comment on your PR (this will notify maintainers).</p>
<p>If your PR is large or complicated, asking for input on the numpy-discussion
mailing list may also be useful.</p>
</section>
<section id="rebasing-on-main">
<span id="id4"></span><h3>Rebasing on main<a class="headerlink" href="#rebasing-on-main" title="Link to this heading">#</a></h3>
<p>This updates your feature branch with changes from the upstream NumPy
GitHub repo. If you do not absolutely need to do this, try to avoid doing
it, except perhaps when you are finished. The first step will be to update
the remote repository with new commits from upstream:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">fetch</span> <span class="n">upstream</span>
</pre></div>
</div>
<p>Next, you need to update the feature branch:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># go to the feature branch</span>
<span class="n">git</span> <span class="n">checkout</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span>
<span class="c1"># make a backup in case you mess up</span>
<span class="n">git</span> <span class="n">branch</span> <span class="n">tmp</span> <span class="n">my</span><span class="o">-</span><span class="n">new</span><span class="o">-</span><span class="n">feature</span>
<span class="c1"># rebase on upstream main branch</span>
<span class="n">git</span> <span class="n">rebase</span> <span class="n">upstream</span><span class="o">/</span><span class="n">main</span>
</pre></div>
</div>
<p>If you have made changes to files that have changed also upstream,
this may generate merge conflicts that you need to resolve. See
<a class="reference internal" href="#recovering-from-mess-up"><span class="std std-ref">below</span></a> for help in this case.</p>
<p>Finally, remove the backup branch upon a successful rebase:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">branch</span> <span class="o">-</span><span class="n">D</span> <span class="n">tmp</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Rebasing on main is preferred over merging upstream back to your
branch. Using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">merge</span></code> and <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">pull</span></code> is discouraged when
working on feature branches.</p>
</div>
</section>
<section id="recovering-from-mess-ups">
<span id="recovering-from-mess-up"></span><h3>Recovering from mess-ups<a class="headerlink" href="#recovering-from-mess-ups" title="Link to this heading">#</a></h3>
<p>Sometimes, you mess up merges or rebases. Luckily, in Git it is
relatively straightforward to recover from such mistakes.</p>
<p>If you mess up during a rebase:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">rebase</span> <span class="o">--</span><span class="n">abort</span>
</pre></div>
</div>
<p>If you notice you messed up after the rebase:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># reset branch back to the saved point</span>
<span class="n">git</span> <span class="n">reset</span> <span class="o">--</span><span class="n">hard</span> <span class="n">tmp</span>
</pre></div>
</div>
<p>If you forgot to make a backup branch:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># look at the reflog of the branch</span>
<span class="n">git</span> <span class="n">reflog</span> <span class="n">show</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span>
<span class="mi">8630830</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span><span class="o">@</span><span class="p">{</span><span class="mi">0</span><span class="p">}:</span> <span class="n">commit</span><span class="p">:</span> <span class="n">BUG</span><span class="p">:</span> <span class="n">io</span><span class="p">:</span> <span class="n">close</span> <span class="n">file</span> <span class="n">handles</span> <span class="n">immediately</span>
<span class="mi">278</span><span class="n">dd2a</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span><span class="o">@</span><span class="p">{</span><span class="mi">1</span><span class="p">}:</span> <span class="n">rebase</span> <span class="n">finished</span><span class="p">:</span> <span class="n">refs</span><span class="o">/</span><span class="n">heads</span><span class="o">/</span><span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span> <span class="n">onto</span> <span class="mi">11</span><span class="n">ee694744f2552d</span>
<span class="mi">26</span><span class="n">aa21a</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span><span class="o">@</span><span class="p">{</span><span class="mi">2</span><span class="p">}:</span> <span class="n">commit</span><span class="p">:</span> <span class="n">BUG</span><span class="p">:</span> <span class="n">lib</span><span class="p">:</span> <span class="n">make</span> <span class="n">seek_gzip_factory</span> <span class="ow">not</span> <span class="n">leak</span> <span class="n">gzip</span> <span class="n">obj</span>
<span class="o">...</span>
<span class="c1"># reset the branch to where it was before the botched rebase</span>
<span class="n">git</span> <span class="n">reset</span> <span class="o">--</span><span class="n">hard</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span><span class="o">@</span><span class="p">{</span><span class="mi">2</span><span class="p">}</span>
</pre></div>
</div>
<p>If you didn’t actually mess up but there are merge conflicts, you need to
resolve those.</p>
</section>
</section>
<section id="additional-things-you-might-want-to-do">
<h2>Additional things you might want to do<a class="headerlink" href="#additional-things-you-might-want-to-do" title="Link to this heading">#</a></h2>
<section id="rewriting-commit-history">
<span id="id5"></span><h3>Rewriting commit history<a class="headerlink" href="#rewriting-commit-history" title="Link to this heading">#</a></h3>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Do this only for your own feature branches.</p>
</div>
<p>There’s an embarrassing typo in a commit you made? Or perhaps you
made several false starts you would like the posterity not to see.</p>
<p>This can be done via <em>interactive rebasing</em>.</p>
<p>Suppose that the commit history looks like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">log</span> <span class="o">--</span><span class="n">oneline</span>
<span class="n">eadc391</span> <span class="n">Fix</span> <span class="n">some</span> <span class="n">remaining</span> <span class="n">bugs</span>
<span class="n">a815645</span> <span class="n">Modify</span> <span class="n">it</span> <span class="n">so</span> <span class="n">that</span> <span class="n">it</span> <span class="n">works</span>
<span class="mi">2</span><span class="n">dec1ac</span> <span class="n">Fix</span> <span class="n">a</span> <span class="n">few</span> <span class="n">bugs</span> <span class="o">+</span> <span class="n">disable</span>
<span class="mi">13</span><span class="n">d7934</span> <span class="n">First</span> <span class="n">implementation</span>
<span class="mi">6</span><span class="n">ad92e5</span> <span class="o">*</span> <span class="n">masked</span> <span class="ow">is</span> <span class="n">now</span> <span class="n">an</span> <span class="n">instance</span> <span class="n">of</span> <span class="n">a</span> <span class="n">new</span> <span class="nb">object</span><span class="p">,</span> <span class="n">MaskedConstant</span>
<span class="mi">29001</span><span class="n">ed</span> <span class="n">Add</span> <span class="n">pre</span><span class="o">-</span><span class="n">nep</span> <span class="k">for</span> <span class="n">a</span> <span class="n">couple</span> <span class="n">of</span> <span class="n">structured_array_extensions</span><span class="o">.</span>
<span class="o">...</span>
</pre></div>
</div>
<p>and <code class="docutils literal notranslate"><span class="pre">6ad92e5</span></code> is the last commit in the <code class="docutils literal notranslate"><span class="pre">main</span></code> branch. Suppose we
want to make the following changes:</p>
<ul class="simple">
<li><p>Rewrite the commit message for <code class="docutils literal notranslate"><span class="pre">13d7934</span></code> to something more sensible.</p></li>
<li><p>Combine the commits <code class="docutils literal notranslate"><span class="pre">2dec1ac</span></code>, <code class="docutils literal notranslate"><span class="pre">a815645</span></code>, <code class="docutils literal notranslate"><span class="pre">eadc391</span></code> into a single one.</p></li>
</ul>
<p>We do as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># make a backup of the current state</span>
<span class="n">git</span> <span class="n">branch</span> <span class="n">tmp</span> <span class="n">HEAD</span>
<span class="c1"># interactive rebase</span>
<span class="n">git</span> <span class="n">rebase</span> <span class="o">-</span><span class="n">i</span> <span class="mi">6</span><span class="n">ad92e5</span>
</pre></div>
</div>
<p>This will open an editor with the following text in it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pick</span> <span class="mi">13</span><span class="n">d7934</span> <span class="n">First</span> <span class="n">implementation</span>
<span class="n">pick</span> <span class="mi">2</span><span class="n">dec1ac</span> <span class="n">Fix</span> <span class="n">a</span> <span class="n">few</span> <span class="n">bugs</span> <span class="o">+</span> <span class="n">disable</span>
<span class="n">pick</span> <span class="n">a815645</span> <span class="n">Modify</span> <span class="n">it</span> <span class="n">so</span> <span class="n">that</span> <span class="n">it</span> <span class="n">works</span>
<span class="n">pick</span> <span class="n">eadc391</span> <span class="n">Fix</span> <span class="n">some</span> <span class="n">remaining</span> <span class="n">bugs</span>
<span class="c1"># Rebase 6ad92e5..eadc391 onto 6ad92e5</span>
<span class="c1">#</span>
<span class="c1"># Commands:</span>
<span class="c1"># p, pick = use commit</span>
<span class="c1"># r, reword = use commit, but edit the commit message</span>
<span class="c1"># e, edit = use commit, but stop for amending</span>
<span class="c1"># s, squash = use commit, but meld into previous commit</span>
<span class="c1"># f, fixup = like "squash", but discard this commit's log message</span>
<span class="c1">#</span>
<span class="c1"># If you remove a line here THAT COMMIT WILL BE LOST.</span>
<span class="c1"># However, if you remove everything, the rebase will be aborted.</span>
<span class="c1">#</span>
</pre></div>
</div>
<p>To achieve what we want, we will make the following changes to it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">r</span> <span class="mi">13</span><span class="n">d7934</span> <span class="n">First</span> <span class="n">implementation</span>
<span class="n">pick</span> <span class="mi">2</span><span class="n">dec1ac</span> <span class="n">Fix</span> <span class="n">a</span> <span class="n">few</span> <span class="n">bugs</span> <span class="o">+</span> <span class="n">disable</span>
<span class="n">f</span> <span class="n">a815645</span> <span class="n">Modify</span> <span class="n">it</span> <span class="n">so</span> <span class="n">that</span> <span class="n">it</span> <span class="n">works</span>
<span class="n">f</span> <span class="n">eadc391</span> <span class="n">Fix</span> <span class="n">some</span> <span class="n">remaining</span> <span class="n">bugs</span>
</pre></div>
</div>
<p>This means that (i) we want to edit the commit message for
<code class="docutils literal notranslate"><span class="pre">13d7934</span></code>, and (ii) collapse the last three commits into one. Now we
save and quit the editor.</p>
<p>Git will then immediately bring up an editor for editing the commit
message. After revising it, we get the output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">detached</span> <span class="n">HEAD</span> <span class="mi">721</span><span class="n">fc64</span><span class="p">]</span> <span class="n">FOO</span><span class="p">:</span> <span class="n">First</span> <span class="n">implementation</span>
<span class="mi">2</span> <span class="n">files</span> <span class="n">changed</span><span class="p">,</span> <span class="mi">199</span> <span class="n">insertions</span><span class="p">(</span><span class="o">+</span><span class="p">),</span> <span class="mi">66</span> <span class="n">deletions</span><span class="p">(</span><span class="o">-</span><span class="p">)</span>
<span class="p">[</span><span class="n">detached</span> <span class="n">HEAD</span> <span class="mi">0</span><span class="n">f22701</span><span class="p">]</span> <span class="n">Fix</span> <span class="n">a</span> <span class="n">few</span> <span class="n">bugs</span> <span class="o">+</span> <span class="n">disable</span>
<span class="mi">1</span> <span class="n">files</span> <span class="n">changed</span><span class="p">,</span> <span class="mi">79</span> <span class="n">insertions</span><span class="p">(</span><span class="o">+</span><span class="p">),</span> <span class="mi">61</span> <span class="n">deletions</span><span class="p">(</span><span class="o">-</span><span class="p">)</span>
<span class="n">Successfully</span> <span class="n">rebased</span> <span class="ow">and</span> <span class="n">updated</span> <span class="n">refs</span><span class="o">/</span><span class="n">heads</span><span class="o">/</span><span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span><span class="o">.</span>
</pre></div>
</div>
<p>and the history looks now like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">0</span><span class="n">f22701</span> <span class="n">Fix</span> <span class="n">a</span> <span class="n">few</span> <span class="n">bugs</span> <span class="o">+</span> <span class="n">disable</span>
<span class="mi">721</span><span class="n">fc64</span> <span class="n">ENH</span><span class="p">:</span> <span class="n">Sophisticated</span> <span class="n">feature</span>
<span class="mi">6</span><span class="n">ad92e5</span> <span class="o">*</span> <span class="n">masked</span> <span class="ow">is</span> <span class="n">now</span> <span class="n">an</span> <span class="n">instance</span> <span class="n">of</span> <span class="n">a</span> <span class="n">new</span> <span class="nb">object</span><span class="p">,</span> <span class="n">MaskedConstant</span>
</pre></div>
</div>
<p>If it went wrong, recovery is again possible as explained <a class="reference internal" href="#recovering-from-mess-up"><span class="std std-ref">above</span></a>.</p>
</section>
<section id="deleting-a-branch-on-github">
<h3>Deleting a branch on GitHub<a class="headerlink" href="#deleting-a-branch-on-github" title="Link to this heading">#</a></h3>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">checkout</span> <span class="n">main</span>
<span class="c1"># delete branch locally</span>
<span class="n">git</span> <span class="n">branch</span> <span class="o">-</span><span class="n">D</span> <span class="n">my</span><span class="o">-</span><span class="n">unwanted</span><span class="o">-</span><span class="n">branch</span>
<span class="c1"># delete branch on github</span>
<span class="n">git</span> <span class="n">push</span> <span class="n">origin</span> <span class="o">--</span><span class="n">delete</span> <span class="n">my</span><span class="o">-</span><span class="n">unwanted</span><span class="o">-</span><span class="n">branch</span>
</pre></div>
</div>
<p>See also:
<a class="reference external" href="https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely">https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely</a></p>
</section>
<section id="several-people-sharing-a-single-repository">
<h3>Several people sharing a single repository<a class="headerlink" href="#several-people-sharing-a-single-repository" title="Link to this heading">#</a></h3>
<p>If you want to work on some stuff with other people, where you are all
committing into the same repository, or even the same branch, then just
share it via GitHub.</p>
<p>First fork NumPy into your account, as from <a class="reference external" href="https://scikit-image.org/docs/stable/gitwash/forking_hell.html#forking" title="(in skimage v0.26.0)"><span>Making your own copy (fork) of scikit-image</span></a>.</p>
<p>Then, go to your forked repository github page, say
<code class="docutils literal notranslate"><span class="pre">https://github.com/your-user-name/numpy</span></code></p>
<p>Click on the ‘Admin’ button, and add anyone else to the repo as a
collaborator:</p>
<img alt="../_images/pull_button.png" src="../_images/pull_button.png" />
<p>Now all those people can do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="nd">@github</span><span class="o">.</span><span class="n">com</span><span class="p">:</span><span class="n">your</span><span class="o">-</span><span class="n">user</span><span class="o">-</span><span class="n">name</span><span class="o">/</span><span class="n">numpy</span><span class="o">.</span><span class="n">git</span>
</pre></div>
</div>
<p>Remember that links starting with <code class="docutils literal notranslate"><span class="pre">git@</span></code> use the ssh protocol and are
read-write; links starting with <code class="docutils literal notranslate"><span class="pre">git://</span></code> are read-only.</p>
<p>Your collaborators can then commit directly into that repo with the
usual:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">commit</span> <span class="o">-</span><span class="n">am</span> <span class="s1">'ENH - much better code'</span>
<span class="n">git</span> <span class="n">push</span> <span class="n">origin</span> <span class="n">my</span><span class="o">-</span><span class="n">feature</span><span class="o">-</span><span class="n">branch</span> <span class="c1"># pushes directly into your repo</span>
</pre></div>
</div>
</section>
<section id="checkout-changes-from-an-existing-pull-request">
<h3>Checkout changes from an existing pull request<a class="headerlink" href="#checkout-changes-from-an-existing-pull-request" title="Link to this heading">#</a></h3>
<p>If you want to test the changes in a pull request or continue the work in a
new pull request, the commits are to be cloned into a local branch in your
forked repository</p>
<p>First ensure your upstream points to the main repo, as from <a class="reference external" href="https://scikit-image.org/docs/stable/gitwash/set_up_fork.html#linking-to-upstream" title="(in skimage v0.26.0)"><span>Linking your repository to the upstream repo</span></a></p>
<p>Then, fetch the changes and create a local branch. Assuming <code class="docutils literal notranslate"><span class="pre">$ID</span></code> is the pull request number
and <code class="docutils literal notranslate"><span class="pre">$BRANCHNAME</span></code> is the name of the <em>new local</em> branch you wish to create:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>git fetch upstream pull/$ID/head:$BRANCHNAME
</pre></div>
</div>
<p>Checkout the newly created branch:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>git checkout $BRANCHNAME
</pre></div>
</div>
<p>You now have the changes in the pull request.</p>
</section>
<section id="exploring-your-repository">
<h3>Exploring your repository<a class="headerlink" href="#exploring-your-repository" title="Link to this heading">#</a></h3>
<p>To see a graphical representation of the repository branches and
commits:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">gitk</span> <span class="o">--</span><span class="nb">all</span>
</pre></div>
</div>
<p>To see a linear list of commits for this branch:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">log</span>
</pre></div>
</div>
</section>
<section id="backporting">
<h3>Backporting<a class="headerlink" href="#backporting" title="Link to this heading">#</a></h3>
<p>Backporting is the process of copying new feature/fixes committed in NumPy’s
<code class="docutils literal notranslate"><span class="pre">main</span></code> branch back to stable release branches. To do this you make a branch
off the branch you are backporting to, cherry pick the commits you want from
<code class="docutils literal notranslate"><span class="pre">numpy/main</span></code>, and then submit a pull request for the branch containing the
backport.</p>
<ol class="arabic">
<li><p>First, you need to make the branch you will work on. This needs to be
based on the older version of NumPy (not main):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Make a new branch based on numpy/maintenance/1.8.x,</span>
<span class="c1"># backport-3324 is our new name for the branch.</span>
<span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">backport</span><span class="o">-</span><span class="mi">3324</span> <span class="n">upstream</span><span class="o">/</span><span class="n">maintenance</span><span class="o">/</span><span class="mf">1.8</span><span class="o">.</span><span class="n">x</span>
</pre></div>
</div>
</li>
<li><p>Now you need to apply the changes from main to this branch using
<code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">cherry-pick</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Update remote</span>
<span class="n">git</span> <span class="n">fetch</span> <span class="n">upstream</span>
<span class="c1"># Check the commit log for commits to cherry pick</span>
<span class="n">git</span> <span class="n">log</span> <span class="n">upstream</span><span class="o">/</span><span class="n">main</span>
<span class="c1"># This pull request included commits aa7a047 to c098283 (inclusive)</span>
<span class="c1"># so you use the .. syntax (for a range of commits), the ^ makes the</span>
<span class="c1"># range inclusive.</span>
<span class="n">git</span> <span class="n">cherry</span><span class="o">-</span><span class="n">pick</span> <span class="n">aa7a047</span><span class="o">^..</span><span class="n">c098283</span>
<span class="o">...</span>
<span class="c1"># Fix any conflicts, then if needed:</span>
<span class="n">git</span> <span class="n">cherry</span><span class="o">-</span><span class="n">pick</span> <span class="o">--</span><span class="k">continue</span>
</pre></div>