Skip to content

Commit

Permalink
ci: Run example notebooks with a static seed
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Dec 16, 2024
1 parent 14d3c71 commit dc5835c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/code-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,14 @@ jobs:
run: |
jq --version
set -o pipefail
export CAPELLAMBSE_UUID_SEED=0
ok=true
function celloutputs() {
jq -r '.cells[] | select(.cell_type=="code") | .outputs[] | (.text, .data["text/plain"]) | .[]?' < "$1" |
grep -v '^$' |
sed -e 's/ at 0x[0-9a-fA-F]\+/ at 0x0/'
}
for file in docs/source/examples/*.ipynb; do
# Requirement notebook creates objects, which will get randomized UUIDs
if [[ "${file##*/}" = "06 Introduction to Requirement access and management.ipynb" ]]; then continue; fi
old_outputs="$(celloutputs "$file")"
if ! jupyter nbconvert --to notebook --execute "$file" --output "${file##*/}" --ExecutePreprocessor.timeout "${NOTEBOOK_TIMEOUT_SEC:-300}"; then
ok=false
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,16 @@ develop and re-run the example notebooks:
```bash
pip install jupyter capellambse
cd docs/source/examples
jupyter-notebook
CAPELLAMBSE_UUID_SEED=0 jupyter-notebook
```

.. note::

The above command provides a static seed for the internal pseudo-random
number generator. This is not recommended for production environments. [Read
more about
CAPELLAMBSE_UUID_SEED.](https://dsd-dbs.github.io/py-capellambse/start/envvars.html)

If your browser did not open automatically, follow the instructions in the
terminal to start it manually.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
"<tr><th style=\"text-align: right;\">property_value_groups</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">property_value_packages</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">property_values</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">pvmt</th><td style=\"text-align: left;\">Property Value Management for <strong>Requirement</strong> <a href=\"hlink://3a208454-d271-49f4-8b93-20b958721300\">&quot;New showcase req1&quot;</a> (3a208454-d271-49f4-8b93-20b958721300)</td></tr>\n",
"<tr><th style=\"text-align: right;\">pvmt</th><td style=\"text-align: left;\">Property Value Management for <strong>Requirement</strong> <a href=\"hlink://45bf975c-b861-4614-abf6-1de8a801a841\">&quot;New showcase req1&quot;</a> (45bf975c-b861-4614-abf6-1de8a801a841)</td></tr>\n",
"<tr><th style=\"text-align: right;\">related</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">relations</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">requirements</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
Expand All @@ -477,14 +477,14 @@
"<tr><th style=\"text-align: right;\">text</th><td style=\"text-align: left;\"></td></tr>\n",
"<tr><th style=\"text-align: right;\">traces</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">type</th><td style=\"text-align: left;\"><em>None</em></td></tr>\n",
"<tr><th style=\"text-align: right;\">uuid</th><td style=\"text-align: left;\">3a208454-d271-49f4-8b93-20b958721300</td></tr>\n",
"<tr><th style=\"text-align: right;\">uuid</th><td style=\"text-align: left;\">45bf975c-b861-4614-abf6-1de8a801a841</td></tr>\n",
"<tr><th style=\"text-align: right;\">validation</th><td style=\"text-align: left;\"><em>&lt;capellambse.extensions.validation._validate.ElementValidation object at 0x78f99a5ff290&gt;</em></td></tr>\n",
"<tr><th style=\"text-align: right;\">visible_on_diagrams</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">xtype</th><td style=\"text-align: left;\">Requirements:Requirement</td></tr>\n",
"</table>"
],
"text/plain": [
"<Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>\n",
"<Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>\n",
".applied_property_value_groups = []\n",
".applied_property_values = []\n",
".attributes = []\n",
Expand All @@ -505,7 +505,7 @@
".property_value_groups = []\n",
".property_value_packages = []\n",
".property_values = []\n",
".pvmt = <Property Value Management for <Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>>\n",
".pvmt = <Property Value Management for <Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>>\n",
".related = []\n",
".relations = []\n",
".requirements = []\n",
Expand All @@ -514,7 +514,7 @@
".text = Markup('')\n",
".traces = []\n",
".type = None\n",
".uuid = '3a208454-d271-49f4-8b93-20b958721300'\n",
".uuid = '45bf975c-b861-4614-abf6-1de8a801a841'\n",
".validation = <capellambse.extensions.validation._validate.ElementValidation object at 0x78f99a5ff7d0>\n",
".visible_on_diagrams = []\n",
".xtype = 'Requirements:Requirement'"
Expand All @@ -531,7 +531,7 @@
"<li><strong>Requirement</strong> <a href=\"hlink://0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc\">&quot;TypedReq2&quot;</a> (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://79291c33-5147-4543-9398-9077d582576d\">&quot;TestReq3&quot;</a> (79291c33-5147-4543-9398-9077d582576d)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://85d41db2-9e17-438b-95cf-49342452ddf3\">&quot;TypedReq1&quot;</a> (85d41db2-9e17-438b-95cf-49342452ddf3)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://3a208454-d271-49f4-8b93-20b958721300\">&quot;New showcase req1&quot;</a> (3a208454-d271-49f4-8b93-20b958721300)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://45bf975c-b861-4614-abf6-1de8a801a841\">&quot;New showcase req1&quot;</a> (45bf975c-b861-4614-abf6-1de8a801a841)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://1092f69a-5f3a-4fe6-a8fd-b2dffde90650\">&quot;TestReq&quot;</a> (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)</li>\n",
"</ol>"
],
Expand All @@ -540,7 +540,7 @@
"[1] <Requirement 'TypedReq2' (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)>\n",
"[2] <Requirement 'TestReq3' (79291c33-5147-4543-9398-9077d582576d)>\n",
"[3] <Requirement 'TypedReq1' (85d41db2-9e17-438b-95cf-49342452ddf3)>\n",
"[4] <Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>\n",
"[4] <Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>\n",
"[5] <Requirement 'TestReq' (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)>"
]
},
Expand Down Expand Up @@ -624,7 +624,7 @@
"<li><strong>Requirement</strong> <a href=\"hlink://0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc\">&quot;TypedReq2&quot;</a> (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://79291c33-5147-4543-9398-9077d582576d\">&quot;TestReq3&quot;</a> (79291c33-5147-4543-9398-9077d582576d)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://85d41db2-9e17-438b-95cf-49342452ddf3\">&quot;TypedReq1&quot;</a> (85d41db2-9e17-438b-95cf-49342452ddf3)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://3a208454-d271-49f4-8b93-20b958721300\">&quot;New showcase req1&quot;</a> (3a208454-d271-49f4-8b93-20b958721300)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://45bf975c-b861-4614-abf6-1de8a801a841\">&quot;New showcase req1&quot;</a> (45bf975c-b861-4614-abf6-1de8a801a841)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://1092f69a-5f3a-4fe6-a8fd-b2dffde90650\">&quot;TestReq&quot;</a> (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)</li>\n",
"</ol>"
],
Expand All @@ -633,7 +633,7 @@
"[1] <Requirement 'TypedReq2' (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)>\n",
"[2] <Requirement 'TestReq3' (79291c33-5147-4543-9398-9077d582576d)>\n",
"[3] <Requirement 'TypedReq1' (85d41db2-9e17-438b-95cf-49342452ddf3)>\n",
"[4] <Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>\n",
"[4] <Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>\n",
"[5] <Requirement 'TestReq' (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)>"
]
},
Expand Down Expand Up @@ -670,8 +670,8 @@
"<li><strong>Requirement</strong> <a href=\"hlink://0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc\">&quot;TypedReq2&quot;</a> (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://79291c33-5147-4543-9398-9077d582576d\">&quot;TestReq3&quot;</a> (79291c33-5147-4543-9398-9077d582576d)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://85d41db2-9e17-438b-95cf-49342452ddf3\">&quot;TypedReq1&quot;</a> (85d41db2-9e17-438b-95cf-49342452ddf3)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://3a208454-d271-49f4-8b93-20b958721300\">&quot;New showcase req1&quot;</a> (3a208454-d271-49f4-8b93-20b958721300)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://887e45f3-a6b9-487c-ab66-46535abe70ab\">&quot;ReqType during Creation&quot;</a> (887e45f3-a6b9-487c-ab66-46535abe70ab)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://45bf975c-b861-4614-abf6-1de8a801a841\">&quot;New showcase req1&quot;</a> (45bf975c-b861-4614-abf6-1de8a801a841)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://1f0ae65c-a7d2-4336-bc11-61f235b8f610\">&quot;ReqType during Creation&quot;</a> (1f0ae65c-a7d2-4336-bc11-61f235b8f610)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://1092f69a-5f3a-4fe6-a8fd-b2dffde90650\">&quot;TestReq&quot;</a> (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)</li>\n",
"</ol>"
],
Expand All @@ -680,8 +680,8 @@
"[1] <Requirement 'TypedReq2' (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)>\n",
"[2] <Requirement 'TestReq3' (79291c33-5147-4543-9398-9077d582576d)>\n",
"[3] <Requirement 'TypedReq1' (85d41db2-9e17-438b-95cf-49342452ddf3)>\n",
"[4] <Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>\n",
"[5] <Requirement 'ReqType during Creation' (887e45f3-a6b9-487c-ab66-46535abe70ab)>\n",
"[4] <Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>\n",
"[5] <Requirement 'ReqType during Creation' (1f0ae65c-a7d2-4336-bc11-61f235b8f610)>\n",
"[6] <Requirement 'TestReq' (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)>"
]
},
Expand Down Expand Up @@ -921,8 +921,8 @@
"<tr><th style=\"text-align: right;\">requirement_types_folders</th><td style=\"text-align: left;\"><p><em>(Empty list)</em></p></td></tr>\n",
"<tr><th style=\"text-align: right;\">requirements</th><td style=\"text-align: left;\"><ol start=\"0\" style=\"text-align: left;\">\n",
"<li><strong>Requirement</strong> <a href=\"hlink://85d41db2-9e17-438b-95cf-49342452ddf3\">&quot;TypedReq1&quot;</a> (85d41db2-9e17-438b-95cf-49342452ddf3)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://3a208454-d271-49f4-8b93-20b958721300\">&quot;New showcase req1&quot;</a> (3a208454-d271-49f4-8b93-20b958721300)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://887e45f3-a6b9-487c-ab66-46535abe70ab\">&quot;ReqType during Creation&quot;</a> (887e45f3-a6b9-487c-ab66-46535abe70ab)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://45bf975c-b861-4614-abf6-1de8a801a841\">&quot;New showcase req1&quot;</a> (45bf975c-b861-4614-abf6-1de8a801a841)</li>\n",
"<li><strong>Requirement</strong> <a href=\"hlink://1f0ae65c-a7d2-4336-bc11-61f235b8f610\">&quot;ReqType during Creation&quot;</a> (1f0ae65c-a7d2-4336-bc11-61f235b8f610)</li>\n",
"</ol></td></tr>\n",
"<tr><th style=\"text-align: right;\">sid</th><td style=\"text-align: left;\"></td></tr>\n",
"<tr><th style=\"text-align: right;\">summary</th><td style=\"text-align: left;\"></td></tr>\n",
Expand Down Expand Up @@ -957,8 +957,8 @@
".pvmt = <Property Value Management for <CapellaModule 'Test Module' (f8e2195d-b5f5-4452-a12b-79233d943d5e)>>\n",
".requirement_types_folders = []\n",
".requirements = [0] <Requirement 'TypedReq1' (85d41db2-9e17-438b-95cf-49342452ddf3)>\n",
" [1] <Requirement 'New showcase req1' (3a208454-d271-49f4-8b93-20b958721300)>\n",
" [2] <Requirement 'ReqType during Creation' (887e45f3-a6b9-487c-ab66-46535abe70ab)>\n",
" [1] <Requirement 'New showcase req1' (45bf975c-b861-4614-abf6-1de8a801a841)>\n",
" [2] <Requirement 'ReqType during Creation' (1f0ae65c-a7d2-4336-bc11-61f235b8f610)>\n",
".sid = ''\n",
".summary = ''\n",
".traces = []\n",
Expand Down

0 comments on commit dc5835c

Please sign in to comment.