-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeveloper_notes.html
More file actions
561 lines (548 loc) · 47.6 KB
/
Copy pathdeveloper_notes.html
File metadata and controls
561 lines (548 loc) · 47.6 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
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<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>Developer notes — Thetis 2026.7.dev8 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/thetis.css?v=0f3339d6" />
<script src="_static/documentation_options.js?v=3dc2f53e"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
<!-- <link rel="stylesheet" href="_static/featured.css"> -->
<link rel="shortcut icon" href="_static/icon_thetis.ico" />
</head><body>
<div class="wrapper">
<a href="index.html"><img src="_static/banner.jpg" height="180px" alt="Thetis Project Banner" /></a>
<div id="access">
<div class="menu">
<ul>
<li class="page_item"><a href="documentation.html" title="Thetis documentation">Documentation</a></li>
<li class="page_item"><a href="#" title="Developer notes">Developer Notes</a></li>
<li class="page_item"><a href="download.html" title="Install Thetis">Install</a></li>
<li class="page_item"><a href="team.html" title="Development team">Team</a></li>
<li class="page_item"><a href="publications.html" title="Publications">Publications</a></li>
<li class="page_item"><a href="funding.html" title="Our financial supporters">Funding</a></li>
<li class="page_item"><a href="contact.html" title="Getting in touch">Contact</a></li>
<li class="page_item"><a href="https://github.com/thetisproject/thetis" title="Thetis source on GitHub">GitHub</a></li>
</ul>
</div><!-- .menu -->
</div><!-- #access -->
</div><!-- #wrapper -->
<div class="document">
<div class="developer_notes">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="developer-notes">
<h1>Developer notes<a class="headerlink" href="#developer-notes" title="Link to this heading">¶</a></h1>
<p>This page is aimed at people developing Thetis, maintaining continuous
integration (CI), and doing releases.</p>
<section id="branches-main-vs-release">
<span id="id1"></span><h2>Branches (<strong>main</strong> vs <strong>release</strong>)<a class="headerlink" href="#branches-main-vs-release" title="Link to this heading">¶</a></h2>
<p>Thetis has two long-lived branches:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">main</span></code> is the development branch. New features should be developed here.
Thetis <code class="docutils literal notranslate"><span class="pre">main</span></code> tracks Firedrake <code class="docutils literal notranslate"><span class="pre">main</span></code> and generally requires Firedrake
<code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">release</span></code> is the stable branch intended for users. It is kept compatible
with the latest stable Firedrake release.</p></li>
</ul>
<p>The temporary branch <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> is used only while preparing a new
Thetis release after a Firedrake release. It is force-updated to the intended
<code class="docutils literal notranslate"><span class="pre">main</span></code> release commit, and GitHub Actions tests it against the same Firedrake
<code class="docutils literal notranslate"><span class="pre">dev-release</span></code> Docker image used for <code class="docutils literal notranslate"><span class="pre">release</span></code>. This gives maintainers a
tested candidate before the public <code class="docutils literal notranslate"><span class="pre">release</span></code> branch is force-updated and
tagged.</p>
<p>CI reflects this by testing <code class="docutils literal notranslate"><span class="pre">main</span></code> against the Firedrake <code class="docutils literal notranslate"><span class="pre">dev-main</span></code> Docker
image and testing <code class="docutils literal notranslate"><span class="pre">release</span></code> and <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> against the Firedrake
<code class="docutils literal notranslate"><span class="pre">dev-release</span></code> Docker image.</p>
</section>
<section id="installing-firedrake">
<h2>Installing Firedrake<a class="headerlink" href="#installing-firedrake" title="Link to this heading">¶</a></h2>
<p>If you are developing Thetis on <code class="docutils literal notranslate"><span class="pre">main</span></code>, you will generally need Firedrake
<code class="docutils literal notranslate"><span class="pre">main</span></code> as well. Firedrake <code class="docutils literal notranslate"><span class="pre">main</span></code> follows a different set of installation
instructions from the stable Firedrake release.</p>
<p>Firedrake has a different <a class="reference external" href="https://www.firedrakeproject.org/firedrake">website address</a> for the development <code class="docutils literal notranslate"><span class="pre">main</span></code>
branch. You can install Firedrake by following the download documentation
<a class="reference external" href="https://www.firedrakeproject.org/firedrake/install#developer-install">there</a>.</p>
<p>After installation, in order to use Firedrake and install Thetis you need to
activate the Firedrake virtual environment:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">source</span> <span class="o"><</span><span class="n">your</span><span class="o">-</span><span class="n">firedrake</span><span class="o">-</span><span class="n">venv</span><span class="o">-</span><span class="nb">dir</span><span class="o">>/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p><strong>On the main branch, it is critical to check the Firedrake install has</strong>
<strong>been successful by running:</strong></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">firedrake</span><span class="o">-</span><span class="n">check</span>
</pre></div>
</div>
</div>
</section>
<section id="installing-thetis">
<h2>Installing Thetis<a class="headerlink" href="#installing-thetis" title="Link to this heading">¶</a></h2>
<p>For development work, clone the repo and install in editable mode:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/thetisproject/thetis
cd thetis
git checkout <branch_name>
pip install -e .
</pre></div>
</div>
<p>If you have SSH keys set up with GitHub, you can use the SSH-based clone
instead:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git clone git@github.com:thetisproject/thetis
cd thetis
git checkout <branch_name>
pip install -e .
</pre></div>
</div>
<p>If you are a developer, you may also want to directly install dependencies for
testing Thetis and building the website:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip install -e ".[docs,lint,test]"
</pre></div>
</div>
</section>
<section id="ci-testing">
<h2>CI testing<a class="headerlink" href="#ci-testing" title="Link to this heading">¶</a></h2>
<p>CI is implemented with GitHub Actions workflows under <code class="docutils literal notranslate"><span class="pre">.github/workflows/</span></code>:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">push.yml</span></code> runs on pushes to <code class="docutils literal notranslate"><span class="pre">main</span></code>, <code class="docutils literal notranslate"><span class="pre">release</span></code>, and
<code class="docutils literal notranslate"><span class="pre">release-candidate</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pr.yml</span></code> runs on pull requests.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">weekly-main.yml</span></code> schedules a weekly run on <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">weekly-release.yml</span></code> schedules a weekly run on <code class="docutils literal notranslate"><span class="pre">release</span></code>. Note that as it
triggered on <code class="docutils literal notranslate"><span class="pre">main</span></code>, the tag in the Actions tab will show as <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">core.yml</span></code> is the reusable workflow that does the actual work.</p></li>
</ul>
<p>The reusable workflow (<code class="docutils literal notranslate"><span class="pre">core.yml</span></code>):</p>
<ul>
<li><p>runs on a self-hosted Linux runner (physically situated at Imperial College
London),
inside a Firedrake Docker image</p></li>
<li><p>checks out the requested ref into a directory called <code class="docutils literal notranslate"><span class="pre">thetis-repo</span></code> (to
avoid false positives from <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">thetis</span></code> working without installation)</p></li>
<li><p>creates <code class="docutils literal notranslate"><span class="pre">venv-thetis</span></code> with <code class="docutils literal notranslate"><span class="pre">--system-site-packages</span></code> (this is only
appropriate where Firedrake is installed in system packages) and installs
Thetis</p></li>
<li><p>runs linting via <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">-C</span> <span class="pre">thetis-repo</span> <span class="pre">lint</span></code></p></li>
<li><p>runs tests:</p>
<ul>
<li><p>serial tests via pytest-xdist:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pytest</span> <span class="o">-</span><span class="n">n</span> <span class="mi">12</span> <span class="o">--</span><span class="n">verbose</span> <span class="o">--</span><span class="n">durations</span><span class="o">=</span><span class="mi">0</span> <span class="o">--</span><span class="n">durations</span><span class="o">-</span><span class="nb">min</span><span class="o">=</span><span class="mf">60.0</span> \
<span class="o">--</span><span class="n">ignore</span><span class="o">=</span><span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test</span><span class="o">/</span><span class="n">examples</span> \
<span class="o">-</span><span class="n">m</span> <span class="n">parallel</span><span class="p">[</span><span class="n">match</span><span class="p">]</span> <span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test</span>
</pre></div>
</div>
</li>
<li><p>MPI-parallel tests, split into 2-rank jobs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">firedrake</span><span class="o">-</span><span class="n">run</span><span class="o">-</span><span class="n">split</span><span class="o">-</span><span class="n">tests</span> <span class="mi">2</span> <span class="mi">4</span> \
<span class="o">--</span><span class="n">durations</span><span class="o">=</span><span class="mi">0</span> <span class="o">--</span><span class="n">durations</span><span class="o">-</span><span class="nb">min</span><span class="o">=</span><span class="mf">60.0</span> \
<span class="o">--</span><span class="n">timeout</span><span class="o">=</span><span class="mi">600</span> <span class="o">--</span><span class="n">timeout</span><span class="o">-</span><span class="n">method</span><span class="o">=</span><span class="n">thread</span> \
<span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test</span>
</pre></div>
</div>
</li>
<li><p>examples via pytest-xdist:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pytest</span> <span class="o">-</span><span class="n">n</span> <span class="mi">12</span> <span class="o">--</span><span class="n">verbose</span> <span class="o">--</span><span class="n">durations</span><span class="o">=</span><span class="mi">0</span> <span class="o">--</span><span class="n">durations</span><span class="o">-</span><span class="nb">min</span><span class="o">=</span><span class="mf">60.0</span> \
<span class="o">-</span><span class="n">m</span> <span class="n">parallel</span><span class="p">[</span><span class="n">match</span><span class="p">]</span> \
<span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test</span><span class="o">/</span><span class="n">examples</span> <span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test_adjoint</span><span class="o">/</span><span class="n">examples</span>
</pre></div>
</div>
</li>
<li><p>adjoint tests via pytest-xdist:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">pytest</span> <span class="o">-</span><span class="n">n</span> <span class="mi">2</span> <span class="o">--</span><span class="n">verbose</span> <span class="o">--</span><span class="n">durations</span><span class="o">=</span><span class="mi">0</span> <span class="o">--</span><span class="n">durations</span><span class="o">-</span><span class="nb">min</span><span class="o">=</span><span class="mf">60.0</span> \
<span class="o">--</span><span class="n">ignore</span><span class="o">=</span><span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test_adjoint</span><span class="o">/</span><span class="n">examples</span> \
<span class="o">-</span><span class="n">m</span> <span class="n">parallel</span><span class="p">[</span><span class="n">match</span><span class="p">]</span> <span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test_adjoint</span>
</pre></div>
</div>
</li>
<li><p>MPI-parallel adjoint tests, split into 2-rank jobs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">firedrake</span><span class="o">-</span><span class="n">run</span><span class="o">-</span><span class="n">split</span><span class="o">-</span><span class="n">tests</span> <span class="mi">2</span> <span class="mi">1</span> \
<span class="o">--</span><span class="n">durations</span><span class="o">=</span><span class="mi">0</span> <span class="o">--</span><span class="n">durations</span><span class="o">-</span><span class="nb">min</span><span class="o">=</span><span class="mf">60.0</span> \
<span class="o">--</span><span class="n">timeout</span><span class="o">=</span><span class="mi">600</span> <span class="o">--</span><span class="n">timeout</span><span class="o">-</span><span class="n">method</span><span class="o">=</span><span class="n">thread</span> \
<span class="n">thetis</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span><span class="n">test_adjoint</span>
</pre></div>
</div>
</li>
</ul>
</li>
</ul>
<p>The workflow sets <code class="docutils literal notranslate"><span class="pre">PYTEST_MPI_MAX_NPROCS=2</span></code> to avoid silently skipping tests
that request more ranks than are available. It also sets
<code class="docutils literal notranslate"><span class="pre">FIREDRAKE_RUN_SPLIT_TESTS_TIMEOUT</span></code> and
<code class="docutils literal notranslate"><span class="pre">FIREDRAKE_RUN_SPLIT_TESTS_KILL_AFTER</span></code> for the split MPI test jobs.
This ensures that if there are any issues with the parallel running of tests,
the processes are killed so they don’t hang indefinitely.</p>
</section>
<section id="pull-requests">
<h2>Pull requests<a class="headerlink" href="#pull-requests" title="Link to this heading">¶</a></h2>
<p>Most changes should go via a pull request (PR) to <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p>
<ul class="simple">
<li><p>Target branch: PRs should usually target <code class="docutils literal notranslate"><span class="pre">main</span></code>. PRs to <code class="docutils literal notranslate"><span class="pre">release</span></code> should
only be used for release-management work, release-only fixes, or exceptional
backports that must ship before the next Firedrake release cycle.</p></li>
<li><p>CI: PRs are tested by <code class="docutils literal notranslate"><span class="pre">.github/workflows/pr.yml</span></code> against the appropriate
Firedrake Docker image (based on the PR base branch).</p></li>
<li><p>Before opening/merging a PR, it is expected that lint is clean
(<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">lint</span></code>),
tests are run where practical (see the CI commands above), and docs changes
render as expected (build the Sphinx site locally, using <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">html</span></code> in the <code class="docutils literal notranslate"><span class="pre">docs/</span></code> directory, if you edited
<code class="docutils literal notranslate"><span class="pre">docs/source/*</span></code>).</p></li>
</ul>
<p><strong>Branch hygiene</strong>: on feature branches it is fine (and often encouraged) to
clean up history (interactive rebase, squash, fixups) and force-push while
iterating on a PR.</p>
<p><strong>Merging</strong>: for normal PRs into <code class="docutils literal notranslate"><span class="pre">main</span></code> or <code class="docutils literal notranslate"><span class="pre">release</span></code>, prefer squash merge or
rebase merge so that project history stays linear. This is especially important
for <code class="docutils literal notranslate"><span class="pre">release</span></code> hotfix/backport PRs, where the result should be a single
release-side fix commit rather than an extra PR merge commit. The
Firedrake-triggered <code class="docutils literal notranslate"><span class="pre">release</span></code> update is not a PR merge: it is an explicit
branch reset by someone with the necessary repository permissions.</p>
</section>
<section id="maintaining-release">
<h2>Maintaining <strong>release</strong><a class="headerlink" href="#maintaining-release" title="Link to this heading">¶</a></h2>
<section id="policy-hard-reset-at-firedrake-release-points">
<h3>Policy (Hard Reset at Firedrake Release Points)<a class="headerlink" href="#policy-hard-reset-at-firedrake-release-points" title="Link to this heading">¶</a></h3>
<p>Thetis follows Firedrake’s major release cadence:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">main</span></code> is the normal development branch. New features and ordinary bug fixes
should land on <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">release</span></code> is the current stable branch. It tracks the latest stable
Firedrake release and is the branch used for the published website.</p></li>
<li><p>When Firedrake makes a major release, Thetis <code class="docutils literal notranslate"><span class="pre">release</span></code> is hard-reset
to a <code class="docutils literal notranslate"><span class="pre">main</span></code> commit that has been tested in the Firedrake <code class="docutils literal notranslate"><span class="pre">dev-release</span></code>
container.</p></li>
<li><p>Between these reset points, keep <code class="docutils literal notranslate"><span class="pre">release</span></code> conservative. Bug fixes may be
cherry-picked when they should be available on the stable line, but do not
backport new functionality, API changes, substantial rewrites, or changes
whose risk is out of proportion to the bug being fixed.</p></li>
</ul>
<p>After Firedrake has made a major release, avoid merging further changes to
Thetis <code class="docutils literal notranslate"><span class="pre">main</span></code> until the corresponding Thetis release has been completed. The
release should be based on the <code class="docutils literal notranslate"><span class="pre">main</span></code> state that is intended to work with the
new Firedrake release, not on later development work against a moving Firedrake
<code class="docutils literal notranslate"><span class="pre">main</span></code>.</p>
<p>This policy keeps <code class="docutils literal notranslate"><span class="pre">main</span></code> linear and avoids merge commits whose only purpose is
to move changes back and forth between long-lived branches. The hard reset is
also acceptable because users will typically need to reinstall PETSc and
Firedrake at each major release cycle anyway. The tradeoff is that the public
<code class="docutils literal notranslate"><span class="pre">release</span></code> branch is force-updated at release points. Tags are therefore the
stable install points for historical releases.</p>
</section>
<section id="when-does-release-move">
<h3>When Does <strong>release</strong> Move?<a class="headerlink" href="#when-does-release-move" title="Link to this heading">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">release</span></code> moves in three cases:</p>
<ol class="arabic simple">
<li><p>Firedrake makes a major release and Thetis <code class="docutils literal notranslate"><span class="pre">release</span></code> is hard-reset
to the compatible, tested <code class="docutils literal notranslate"><span class="pre">main</span></code> commit.</p></li>
<li><p>A release-only fix is required for the current stable Firedrake stack.</p></li>
<li><p>A shared fix from <code class="docutils literal notranslate"><span class="pre">main</span></code> must be copied to the current stable branch before
the next hard reset.</p></li>
</ol>
<p>Keep <code class="docutils literal notranslate"><span class="pre">release</span></code> changes minimal and compatibility-driven. Each update to
<code class="docutils literal notranslate"><span class="pre">release</span></code> creates a new installable stable state and should be tagged after
the corresponding CI run has passed.</p>
</section>
<section id="workflow-normal-development-and-bug-fixes">
<h3>Workflow: Normal Development and Bug Fixes<a class="headerlink" href="#workflow-normal-development-and-bug-fixes" title="Link to this heading">¶</a></h3>
<p>Most changes should go to <code class="docutils literal notranslate"><span class="pre">main</span></code> only:</p>
<ol class="arabic simple">
<li><p>Create a branch from <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p>Open a PR with base branch <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p>Merge according to normal project practice.</p></li>
</ol>
<p>If the change does not need to ship on the current stable Firedrake stack, do
not backport it. It will arrive on <code class="docutils literal notranslate"><span class="pre">release</span></code> at the next hard reset.</p>
</section>
<section id="workflow-shared-fix-from-main-to-release">
<h3>Workflow: Shared Fix from <strong>main</strong> to <strong>release</strong><a class="headerlink" href="#workflow-shared-fix-from-main-to-release" title="Link to this heading">¶</a></h3>
<p>Use this only when a fix already on <code class="docutils literal notranslate"><span class="pre">main</span></code> must also ship on the current
stable branch before the next reset.</p>
<ol class="arabic">
<li><p>Create a backport branch from <code class="docutils literal notranslate"><span class="pre">release</span></code> and cherry-pick the <code class="docutils literal notranslate"><span class="pre">main</span></code> fix:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout -b release-backport/<short-description> origin/release
git cherry-pick -x <main-fix-sha>
git push -u origin release-backport/<short-description>
</pre></div>
</div>
</li>
<li><p>Open a PR with base branch <code class="docutils literal notranslate"><span class="pre">release</span></code>.</p></li>
<li><p>Merge with a method that leaves a single release-side fix commit where
possible (squash merge, or rebase merge if enabled). If using squash merge,
keep the original <code class="docutils literal notranslate"><span class="pre">cherry</span> <span class="pre">picked</span> <span class="pre">from</span></code> line or mention the source <code class="docutils literal notranslate"><span class="pre">main</span></code>
PR/commit in the squash commit message.</p></li>
<li><p>Wait for the post-merge <code class="docutils literal notranslate"><span class="pre">release</span></code> push workflow to pass.</p></li>
<li><p>Tag the resulting <code class="docutils literal notranslate"><span class="pre">release</span></code> commit using the tag convention below.</p></li>
</ol>
<p>The release-side commit will usually have a different SHA from the <code class="docutils literal notranslate"><span class="pre">main</span></code> fix.
This is expected because the parent commits differ; the same patch cannot have
the same commit SHA unless it has the same parents and metadata. If <code class="docutils literal notranslate"><span class="pre">release</span></code>
was already <code class="docutils literal notranslate"><span class="pre">N</span></code> development commits behind <code class="docutils literal notranslate"><span class="pre">main</span></code> before the cherry-pick,
then after this workflow <code class="docutils literal notranslate"><span class="pre">release</span></code> is normally <code class="docutils literal notranslate"><span class="pre">N</span> <span class="pre">+</span> <span class="pre">1</span></code> commits behind
<code class="docutils literal notranslate"><span class="pre">main</span></code> and one commit ahead of <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p>
</section>
<section id="workflow-release-only-fix">
<h3>Workflow: <strong>release</strong>-Only Fix<a class="headerlink" href="#workflow-release-only-fix" title="Link to this heading">¶</a></h3>
<p>Use this when the issue only exists on the current stable branch, for example
because of the older Firedrake dependency stack.</p>
<ol class="arabic">
<li><p>Create a branch from <code class="docutils literal notranslate"><span class="pre">release</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout -b release-fix/<short-description> origin/release
</pre></div>
</div>
</li>
<li><p>Commit the fix and open a PR with base branch <code class="docutils literal notranslate"><span class="pre">release</span></code>.</p></li>
<li><p>Merge with a method that leaves a single release-side fix commit where
possible.</p></li>
<li><p>Wait for the post-merge <code class="docutils literal notranslate"><span class="pre">release</span></code> push workflow to pass.</p></li>
<li><p>Tag the resulting <code class="docutils literal notranslate"><span class="pre">release</span></code> commit using the tag convention below.</p></li>
</ol>
<p>If the same fix is also needed on <code class="docutils literal notranslate"><span class="pre">main</span></code>, put it on <code class="docutils literal notranslate"><span class="pre">main</span></code> first and use the
shared-fix workflow above. For a true release-only fix, if <code class="docutils literal notranslate"><span class="pre">release</span></code> was
already <code class="docutils literal notranslate"><span class="pre">N</span></code> development commits behind <code class="docutils literal notranslate"><span class="pre">main</span></code> before the fix, then after the
fix <code class="docutils literal notranslate"><span class="pre">release</span></code> is normally <code class="docutils literal notranslate"><span class="pre">N</span></code> commits behind <code class="docutils literal notranslate"><span class="pre">main</span></code> and one commit ahead of
<code class="docutils literal notranslate"><span class="pre">main</span></code>.</p>
</section>
<section id="workflow-hard-reset-release-to-main">
<h3>Workflow: Hard-Reset <strong>release</strong> to <strong>main</strong><a class="headerlink" href="#workflow-hard-reset-release-to-main" title="Link to this heading">¶</a></h3>
<p>This is the normal workflow when Firedrake makes a major release and
Thetis <code class="docutils literal notranslate"><span class="pre">release</span></code> should become the compatible state from <code class="docutils literal notranslate"><span class="pre">main</span></code>. The goal is
to tag only a commit that has passed Thetis CI in the Firedrake release
container.</p>
<p>Before moving <code class="docutils literal notranslate"><span class="pre">release</span></code>, check whether the final state of the old stable line
already has the intended tag. If it does not, preserve it with a tag using the
tag convention below.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout release
git pull --ff-only
git tag -a <old-version-final-or-patch-tag> release -m "<tag message>"
git push origin <old-version-final-or-patch-tag>
</pre></div>
</div>
<p>Prepare and test a temporary <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> branch. Pushes to this branch
run the same <code class="docutils literal notranslate"><span class="pre">push.yml</span></code> workflow as <code class="docutils literal notranslate"><span class="pre">release</span></code> and use the Firedrake
<code class="docutils literal notranslate"><span class="pre">dev-release</span></code> Docker image.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout -B release-candidate <main-sha-or-origin/main>
git push --force-with-lease origin release-candidate
</pre></div>
</div>
<p>Wait for the <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> push workflow to pass. If it fails, fix the
problem on <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> and push again until CI passes. Keep
<code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> based on the selected <code class="docutils literal notranslate"><span class="pre">main</span></code> commit; it is fine to
rewrite or squash fix commits on <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> while preparing the
release.</p>
<p>If fixes were needed on <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code>, fast-forward <code class="docutils literal notranslate"><span class="pre">main</span></code> to the
passing candidate before moving <code class="docutils literal notranslate"><span class="pre">release</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout main
git pull --ff-only
git merge --ff-only origin/release-candidate
git push origin main
</pre></div>
</div>
<p>This push to <code class="docutils literal notranslate"><span class="pre">main</span></code> should still be a normal fast-forward push, not a
force-push. If GitHub rejects this due to branch protection rules, a
maintainer must temporarily relax the relevant rule, make the normal
fast-forward push, and restore branch protection immediately afterwards.
After the Thetis release is complete, fix any remaining <code class="docutils literal notranslate"><span class="pre">main</span></code> CI failure
through the normal PR workflow.</p>
<p>After <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> has passed, move <code class="docutils literal notranslate"><span class="pre">release</span></code> to exactly the passing
commit:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git fetch origin
git checkout release
git reset --hard origin/release-candidate
git push --force-with-lease origin release
</pre></div>
</div>
<p>Wait for the <code class="docutils literal notranslate"><span class="pre">release</span></code> push workflow to pass, then tag that exact commit and
push the tag. If the <code class="docutils literal notranslate"><span class="pre">release</span></code> workflow fails unexpectedly, do not tag it; fix
the problem on <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code> and repeat the move to <code class="docutils literal notranslate"><span class="pre">release</span></code>. The
package version is derived from git tags, so no version-only commit is needed at
the hard reset point.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git tag -a <new-release-version> release -m "Thetis <new-release-version>"
git push origin <new-release-version>
</pre></div>
</div>
<p>Immediately restore/confirm the branch protection settings after the force-push
if they had to be relaxed.</p>
</section>
<section id="history-shape">
<h3>History Shape<a class="headerlink" href="#history-shape" title="Link to this heading">¶</a></h3>
<p>Immediately after a hard reset, <code class="docutils literal notranslate"><span class="pre">release</span></code> contains the vetted <code class="docutils literal notranslate"><span class="pre">main</span></code> state.
If <code class="docutils literal notranslate"><span class="pre">release</span></code> receives a release-only fix, it will diverge from <code class="docutils literal notranslate"><span class="pre">main</span></code> until
the next reset:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>main: A -- B -- C -- D
release: A -- B -- R1
</pre></div>
</div>
<p>After the reset, active <code class="docutils literal notranslate"><span class="pre">release</span></code> contains the selected <code class="docutils literal notranslate"><span class="pre">main</span></code> state and the
old state remains available by the tag created before the reset:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>main: A -- B -- C -- D
release: A -- B -- C -- D
tag: A -- B -- R1
</pre></div>
</div>
</section>
<section id="publishing-a-tagged-release">
<h3>Publishing A Tagged Release<a class="headerlink" href="#publishing-a-tagged-release" title="Link to this heading">¶</a></h3>
<p>When publishing a tagged release, push a tag, create a GitHub Release, and
verify Zenodo archived the release (see the Zenodo section below). If the
release includes documentation changes, update the published website at the same
time.</p>
</section>
<section id="tag-convention">
<h3>Tag convention<a class="headerlink" href="#tag-convention" title="Link to this heading">¶</a></h3>
<p>The repository currently contains multiple historical tag naming schemes (for
example <code class="docutils literal notranslate"><span class="pre">2026.4.0</span></code> / <code class="docutils literal notranslate"><span class="pre">2025.10.1</span></code> as well as older <code class="docutils literal notranslate"><span class="pre">Thetis_YYYYMMDD</span></code>-style
tags). For new releases, the release tag is the source of the packaged version,
so use PEP 440-compatible tags.</p>
<p>New stable release tags should use:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>YYYY.M.postN
</pre></div>
</div>
<p>where <code class="docutils literal notranslate"><span class="pre">YYYY.M</span></code> is the Firedrake major release series used by that Thetis
release branch and <code class="docutils literal notranslate"><span class="pre">N</span></code> is incremented for each Thetis release update on that
branch. For example, the first Thetis release against the Firedrake <code class="docutils literal notranslate"><span class="pre">2026.4</span></code>
line should be tagged <code class="docutils literal notranslate"><span class="pre">2026.4.post0</span></code>. The next Thetis update to that release
line should be tagged <code class="docutils literal notranslate"><span class="pre">2026.4.post1</span></code>, regardless of whether the compatible
Firedrake stack is <code class="docutils literal notranslate"><span class="pre">2026.4.0</span></code>, <code class="docutils literal notranslate"><span class="pre">2026.4.1</span></code>, or a later Firedrake patch. This
keeps Thetis release numbering visibly separate from Firedrake patch numbering.</p>
<p>Tags are normally created only:</p>
<ul class="simple">
<li><p>before a hard reset, if the final installable state of the old stable line has
not already been tagged;</p></li>
<li><p>after a hard reset, after CI has passed for the new Thetis release against the
Firedrake release container; or</p></li>
<li><p>after a tested release-only fix or backported bug fix has been merged to
<code class="docutils literal notranslate"><span class="pre">release</span></code>.</p></li>
</ul>
<p>Do not use tags such as <code class="docutils literal notranslate"><span class="pre">2026.4.rel1</span></code> for Thetis releases: the release tag is
used as the Python package version, and <code class="docutils literal notranslate"><span class="pre">rel1</span></code> is not valid in that position
under PEP 440.</p>
</section>
<section id="python-package-versions">
<h3>Python package versions<a class="headerlink" href="#python-package-versions" title="Link to this heading">¶</a></h3>
<p>Thetis uses dynamic versioning from git tags and branch state. Developers
normally only choose the release tags described above; untagged development
versions are derived automatically.</p>
<p>The automatic package-version rules are:</p>
<ul class="simple">
<li><p>A tagged commit has the exact release version from the tag.</p></li>
<li><p>Untagged commits on <code class="docutils literal notranslate"><span class="pre">main</span></code> and ordinary feature branches report
<code class="docutils literal notranslate"><span class="pre">YYYY.M.devN</span></code>. <code class="docutils literal notranslate"><span class="pre">YYYY.M</span></code> is based on the commit date of <code class="docutils literal notranslate"><span class="pre">HEAD</span></code> (the Git
committer date, not the author date), and <code class="docutils literal notranslate"><span class="pre">N</span></code> is the number of commits in
that month.</p></li>
<li><p>Untagged commits on <code class="docutils literal notranslate"><span class="pre">release</span></code> and <code class="docutils literal notranslate"><span class="pre">release-*</span></code>/<code class="docutils literal notranslate"><span class="pre">release/*</span></code> maintenance
branches, including <code class="docutils literal notranslate"><span class="pre">release-candidate</span></code>, report the next <code class="docutils literal notranslate"><span class="pre">postN</span></code>
development version for that release line.</p></li>
</ul>
<p>If <code class="docutils literal notranslate"><span class="pre">main</span></code> and <code class="docutils literal notranslate"><span class="pre">release</span></code> point at the same tagged commit, they report the
same exact version. Once <code class="docutils literal notranslate"><span class="pre">main</span></code> receives new commits, it reports a development
version again. Do not manually tag arbitrary <code class="docutils literal notranslate"><span class="pre">main</span></code> commits to create
development versions.</p>
<p>For editable installs, <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">pull</span></code> updates the source code but does not rewrite
the installed Python distribution metadata that commands such as <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">list</span></code>
and <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">show</span></code> read. Re-run <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">-e</span> <span class="pre">.</span></code> after switching branches,
pulling new commits, or creating/checking out a release tag if the version shown
by pip needs to match the current checkout.</p>
</section>
</section>
<section id="thetis-website">
<h2>Thetis website<a class="headerlink" href="#thetis-website" title="Link to this heading">¶</a></h2>
<section id="content">
<h3>Content<a class="headerlink" href="#content" title="Link to this heading">¶</a></h3>
<p>Thetis documentation content lives in this repository under <code class="docutils literal notranslate"><span class="pre">docs/source</span></code> and
is built with Sphinx (see <code class="docutils literal notranslate"><span class="pre">docs/Makefile</span></code> and <code class="docutils literal notranslate"><span class="pre">docs/source/conf.py</span></code>).</p>
<p>Thetis has a single published documentation website. The published site is
updated whenever the documentation content in the <code class="docutils literal notranslate"><span class="pre">release</span></code> branch is updated,
and it must be built from the <code class="docutils literal notranslate"><span class="pre">release</span></code> branch (do not publish a site built
from <code class="docutils literal notranslate"><span class="pre">main</span></code>).</p>
<p>If you need the equivalent rendered documentation for <code class="docutils literal notranslate"><span class="pre">main</span></code>, build it
locally from a <code class="docutils literal notranslate"><span class="pre">main</span></code> checkout using the same instructions below.</p>
</section>
<section id="deployment">
<h3>Deployment<a class="headerlink" href="#deployment" title="Link to this heading">¶</a></h3>
<p>Thetis is published from a separate <a class="reference external" href="https://github.com/thetisproject/thetisproject.github.io">rendered-site repository</a>. Documentation
content changes should normally be merged to <code class="docutils literal notranslate"><span class="pre">main</span></code> first, like other Thetis
changes. If the website needs to be updated before the next release reset,
backport or repeat the documentation change on <code class="docutils literal notranslate"><span class="pre">release</span></code> and build the
published site from that <code class="docutils literal notranslate"><span class="pre">release</span></code> checkout.</p>
<p>The workflow is:</p>
<ol class="arabic">
<li><p>Make the relevant changes under <code class="docutils literal notranslate"><span class="pre">docs/source/</span></code> (for example
<code class="docutils literal notranslate"><span class="pre">docs/source/download.rst</span></code>) on a branch based on <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p>Build the website locally from source.</p>
<p>Install the doc-build dependencies if needed.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">e</span> <span class="s2">".[docs]"</span>
</pre></div>
</div>
<p>Build the website locally.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="o">-</span><span class="n">C</span> <span class="n">docs</span> <span class="n">html</span>
</pre></div>
</div>
<p>The rendered site will be in <code class="docutils literal notranslate"><span class="pre">docs/build/html</span></code>. You can inspect the local
build, e.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">firefox</span> <span class="n">docs</span><span class="o">/</span><span class="n">build</span><span class="o">/</span><span class="n">html</span><span class="o">/</span><span class="n">index</span><span class="o">.</span><span class="n">html</span>
</pre></div>
</div>
</li>
<li><p>Commit the changes in the Thetis repo and open a PR to <code class="docutils literal notranslate"><span class="pre">main</span></code>.</p></li>
<li><p>If the change should appear on the published website before the next release
reset, apply the same content change to <code class="docutils literal notranslate"><span class="pre">release</span></code> using the shared-fix
workflow above, then check out <code class="docutils literal notranslate"><span class="pre">release</span></code> and rebuild the website locally.</p></li>
<li><p>Copy the contents of <code class="docutils literal notranslate"><span class="pre">docs/build/html/</span></code> from the <code class="docutils literal notranslate"><span class="pre">release</span></code> build into the
<code class="docutils literal notranslate"><span class="pre">thetisproject.github.io</span></code> repository and merge there as well.</p>
<p>It is encouraged to do this via a PR in the rendered-site repository and to
check on GitHub that the rendered changes are as intended. If unsure, ask for
a review.</p>
</li>
</ol>
</section>
</section>
<section id="zenodo">
<h2>Zenodo<a class="headerlink" href="#zenodo" title="Link to this heading">¶</a></h2>
<p>Zenodo can archive GitHub releases/tags and mint a DOI per version (plus a
concept DOI across all versions).</p>
<p>In practice for Thetis:</p>
<ol class="arabic simple">
<li><p>Create and push a git tag for the release.</p></li>
<li><p>Create a GitHub Release for that tag.</p></li>
<li><p>Verify Zenodo created/updated the corresponding record and that metadata
(authors, title, description) is correct.</p></li>
</ol>
<p>Sometimes the GitHub-Zenodo integration breaks and GitHub Releases do not get
archived on Zenodo. To fix it, a GitHub organization owner for
<code class="docutils literal notranslate"><span class="pre">thetisproject</span></code> (not just a repository collaborator) may need to:</p>
<ol class="arabic simple">
<li><p>Delete the Zenodo webhook in the GitHub repository settings.</p></li>
<li><p>Disconnect and reconnect <em>their</em> GitHub <-> Zenodo account connection and
re-authenticate.</p></li>
<li><p>Re-enable the Thetis repository in Zenodo’s GitHub integration settings (if
it does not re-enable automatically).</p></li>
</ol>
<p>It is often also worth the person doing the release reconnecting their personal
GitHub/Zenodo connection.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2016-2026, Tuomas Kärnä et al..
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
</div>
</body>
</html>