From dc5835cb0786206dd4c39ee7a431921555d83c73 Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Mon, 16 Dec 2024 10:17:13 +0100 Subject: [PATCH] ci: Run example notebooks with a static seed --- .github/workflows/code-qa.yml | 4 +-- README.md | 9 ++++- ...to Requirement access and management.ipynb | 34 +++++++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/workflows/code-qa.yml b/.github/workflows/code-qa.yml index ae8ad0a1..890090ef 100644 --- a/.github/workflows/code-qa.yml +++ b/.github/workflows/code-qa.yml @@ -129,6 +129,7 @@ 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" | @@ -136,9 +137,6 @@ jobs: 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 diff --git a/README.md b/README.md index 42a23b0b..afed3e3d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/docs/source/examples/06 Introduction to Requirement access and management.ipynb b/docs/source/examples/06 Introduction to Requirement access and management.ipynb index bb76bd48..6d4739df 100644 --- a/docs/source/examples/06 Introduction to Requirement access and management.ipynb +++ b/docs/source/examples/06 Introduction to Requirement access and management.ipynb @@ -468,7 +468,7 @@ "property_value_groups

(Empty list)

\n", "property_value_packages

(Empty list)

\n", "property_values

(Empty list)

\n", - "pvmtProperty Value Management for Requirement "New showcase req1" (3a208454-d271-49f4-8b93-20b958721300)\n", + "pvmtProperty Value Management for Requirement "New showcase req1" (45bf975c-b861-4614-abf6-1de8a801a841)\n", "related

(Empty list)

\n", "relations

(Empty list)

\n", "requirements

(Empty list)

\n", @@ -477,14 +477,14 @@ "text\n", "traces

(Empty list)

\n", "typeNone\n", - "uuid3a208454-d271-49f4-8b93-20b958721300\n", + "uuid45bf975c-b861-4614-abf6-1de8a801a841\n", "validation<capellambse.extensions.validation._validate.ElementValidation object at 0x78f99a5ff290>\n", "visible_on_diagrams

(Empty list)

\n", "xtypeRequirements:Requirement\n", "" ], "text/plain": [ - "\n", + "\n", ".applied_property_value_groups = []\n", ".applied_property_values = []\n", ".attributes = []\n", @@ -505,7 +505,7 @@ ".property_value_groups = []\n", ".property_value_packages = []\n", ".property_values = []\n", - ".pvmt = >\n", + ".pvmt = >\n", ".related = []\n", ".relations = []\n", ".requirements = []\n", @@ -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 = \n", ".visible_on_diagrams = []\n", ".xtype = 'Requirements:Requirement'" @@ -531,7 +531,7 @@ "
  • Requirement "TypedReq2" (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)
  • \n", "
  • Requirement "TestReq3" (79291c33-5147-4543-9398-9077d582576d)
  • \n", "
  • Requirement "TypedReq1" (85d41db2-9e17-438b-95cf-49342452ddf3)
  • \n", - "
  • Requirement "New showcase req1" (3a208454-d271-49f4-8b93-20b958721300)
  • \n", + "
  • Requirement "New showcase req1" (45bf975c-b861-4614-abf6-1de8a801a841)
  • \n", "
  • Requirement "TestReq" (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)
  • \n", "" ], @@ -540,7 +540,7 @@ "[1] \n", "[2] \n", "[3] \n", - "[4] \n", + "[4] \n", "[5] " ] }, @@ -624,7 +624,7 @@ "
  • Requirement "TypedReq2" (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)
  • \n", "
  • Requirement "TestReq3" (79291c33-5147-4543-9398-9077d582576d)
  • \n", "
  • Requirement "TypedReq1" (85d41db2-9e17-438b-95cf-49342452ddf3)
  • \n", - "
  • Requirement "New showcase req1" (3a208454-d271-49f4-8b93-20b958721300)
  • \n", + "
  • Requirement "New showcase req1" (45bf975c-b861-4614-abf6-1de8a801a841)
  • \n", "
  • Requirement "TestReq" (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)
  • \n", "" ], @@ -633,7 +633,7 @@ "[1] \n", "[2] \n", "[3] \n", - "[4] \n", + "[4] \n", "[5] " ] }, @@ -670,8 +670,8 @@ "
  • Requirement "TypedReq2" (0a9a68b1-ba9a-4793-b2cf-4448f0b4b8cc)
  • \n", "
  • Requirement "TestReq3" (79291c33-5147-4543-9398-9077d582576d)
  • \n", "
  • Requirement "TypedReq1" (85d41db2-9e17-438b-95cf-49342452ddf3)
  • \n", - "
  • Requirement "New showcase req1" (3a208454-d271-49f4-8b93-20b958721300)
  • \n", - "
  • Requirement "ReqType during Creation" (887e45f3-a6b9-487c-ab66-46535abe70ab)
  • \n", + "
  • Requirement "New showcase req1" (45bf975c-b861-4614-abf6-1de8a801a841)
  • \n", + "
  • Requirement "ReqType during Creation" (1f0ae65c-a7d2-4336-bc11-61f235b8f610)
  • \n", "
  • Requirement "TestReq" (1092f69a-5f3a-4fe6-a8fd-b2dffde90650)
  • \n", "" ], @@ -680,8 +680,8 @@ "[1] \n", "[2] \n", "[3] \n", - "[4] \n", - "[5] \n", + "[4] \n", + "[5] \n", "[6] " ] }, @@ -921,8 +921,8 @@ "requirement_types_folders

    (Empty list)

    \n", "requirements
      \n", "
    1. Requirement "TypedReq1" (85d41db2-9e17-438b-95cf-49342452ddf3)
    2. \n", - "
    3. Requirement "New showcase req1" (3a208454-d271-49f4-8b93-20b958721300)
    4. \n", - "
    5. Requirement "ReqType during Creation" (887e45f3-a6b9-487c-ab66-46535abe70ab)
    6. \n", + "
    7. Requirement "New showcase req1" (45bf975c-b861-4614-abf6-1de8a801a841)
    8. \n", + "
    9. Requirement "ReqType during Creation" (1f0ae65c-a7d2-4336-bc11-61f235b8f610)
    10. \n", "
    \n", "sid\n", "summary\n", @@ -957,8 +957,8 @@ ".pvmt = >\n", ".requirement_types_folders = []\n", ".requirements = [0] \n", - " [1] \n", - " [2] \n", + " [1] \n", + " [2] \n", ".sid = ''\n", ".summary = ''\n", ".traces = []\n",