From a3b2f1dcd2d31afd05744b652f9498a1a669979a Mon Sep 17 00:00:00 2001 From: Michelle Wang Date: Wed, 25 Nov 2026 23:00:36 -0500 Subject: [PATCH 1/4] first pass --- docs/source/conf.py | 26 ++++++++++++++++ docs/source/index.md | 10 +++++++ docs/source/initial_setup.md | 2 +- docs/source/updating_node.md | 58 ++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 docs/source/updating_node.md diff --git a/docs/source/conf.py b/docs/source/conf.py index 5a2d244..5441fa5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -64,3 +64,29 @@ # -- Copybutton configuration ------------------------------------------------- copybutton_exclude = ".linenos, .gp" copybutton_selector = "div:not(.no-copybutton) > div.highlight > pre" + +# -- Version substitution ----------------------------------------------------- +# Replaced in all source and included files, including inside code blocks + +node_version = "v0.1.1" +_SUBSTITUTIONS = {"|node_version|": node_version} + + +def _substitute(content: list[str]) -> None: + """Replace substitution tokens in raw source content (in place).""" + for token, value in _SUBSTITUTIONS.items(): + content[0] = content[0].replace(token, value) + + +def _on_source_read(app, docname, content) -> None: + _substitute(content) + + +def _on_include_read(app, relative_path, parent_docname, content) -> None: + _substitute(content) + + +def setup(app) -> None: + """Register source substitution hooks.""" + app.connect("source-read", _on_source_read) + app.connect("include-read", _on_include_read) diff --git a/docs/source/index.md b/docs/source/index.md index 3016fdb..ca4e0d9 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -31,3 +31,13 @@ fl_ready_dataset fedbiomed_node_part_1 fedbiomed_node_part_2 ``` + +```{toctree} +--- +hidden: +includehidden: +titlesonly: +caption: Maintenance +--- +updating_node +``` diff --git a/docs/source/initial_setup.md b/docs/source/initial_setup.md index 94a587f..2ba8537 100644 --- a/docs/source/initial_setup.md +++ b/docs/source/initial_setup.md @@ -7,7 +7,7 @@ Clone and enter the [`brainflex-node`](https://github.com/neurodatascience/brainflex-node) repository: ```bash -git clone --branch v0.1.1 https://github.com/neurodatascience/brainflex-node +git clone --branch |node_version| https://github.com/neurodatascience/brainflex-node cd brainflex-node ``` diff --git a/docs/source/updating_node.md b/docs/source/updating_node.md new file mode 100644 index 0000000..e246c62 --- /dev/null +++ b/docs/source/updating_node.md @@ -0,0 +1,58 @@ +# Updating the node + +When a new version of [`brainflex-node`](https://github.com/neurodatascience/brainflex-node) is released, follow these steps to update to the latest version (**|node_version|**). + +```{include} _includes/working_directory.md +``` + +## Update the code + +First, check whether you created a work branch: + +```bash +git branch --show-current +``` + +If this prints `work` (or another branch name you created): + +```bash +git fetch origin tag |node_version| --no-tags +git merge --no-edit |node_version| +``` + +If this prints nothing (you skipped the optional `git switch -c work` step in [Initial setup](initial_setup.md)): + +```bash +git fetch origin tag |node_version| --no-tags +git switch --detach |node_version| +``` + +To confirm the update worked, run: + +```bash +git describe --tags +``` + +If you have no commits of your own, this prints `|node_version|`. +If you merged into a branch that had your own commits, it prints something like `|node_version|-2-gabc1234`, which is also fine. + +## Update Python dependencies + +With your virtual environment (or `conda` environment) activated, reinstall the dependencies in case they changed: + +```bash +pip install -r requirements.txt # or: uv pip install -r requirements.txt +``` + +## Restart the Fed-BioMed node + +Only do this if you have already started the node (see [Fed-BioMed node: Part 1](fedbiomed_node_part_1.md)): + +```bash +docker compose down +docker compose up -d +``` + +```{note} +If Git reports a conflict or refuses to update because of local changes, please reach out and we'll help. +``` From 850fb9cd7a49a3cb51ce8198d05a1a2d5292db42 Mon Sep 17 00:00:00 2001 From: Michelle Wang Date: Wed, 25 Nov 2026 23:03:17 -0500 Subject: [PATCH 2/4] rename --- docs/source/index.md | 2 +- docs/source/{updating_node.md => node_update.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/source/{updating_node.md => node_update.md} (100%) diff --git a/docs/source/index.md b/docs/source/index.md index ca4e0d9..2b87ea5 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -39,5 +39,5 @@ includehidden: titlesonly: caption: Maintenance --- -updating_node +node_update ``` diff --git a/docs/source/updating_node.md b/docs/source/node_update.md similarity index 100% rename from docs/source/updating_node.md rename to docs/source/node_update.md From d7b7523c72438447838d36cebc4e38098e313d7a Mon Sep 17 00:00:00 2001 From: Michelle Wang Date: Wed, 25 Nov 2026 23:03:58 -0500 Subject: [PATCH 3/4] remove last part --- docs/source/node_update.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/source/node_update.md b/docs/source/node_update.md index e246c62..adf20f8 100644 --- a/docs/source/node_update.md +++ b/docs/source/node_update.md @@ -52,7 +52,3 @@ Only do this if you have already started the node (see [Fed-BioMed node: Part 1] docker compose down docker compose up -d ``` - -```{note} -If Git reports a conflict or refuses to update because of local changes, please reach out and we'll help. -``` From 5e15e79c99b30f26b89a1d4ce6752ab493384373 Mon Sep 17 00:00:00 2001 From: Michelle Wang Date: Wed, 25 Nov 2026 23:22:52 -0500 Subject: [PATCH 4/4] add troubleshooting for uncommitted changes --- docs/source/node_update.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/source/node_update.md b/docs/source/node_update.md index adf20f8..8e1716b 100644 --- a/docs/source/node_update.md +++ b/docs/source/node_update.md @@ -36,14 +36,46 @@ git describe --tags If you have no commits of your own, this prints `|node_version|`. If you merged into a branch that had your own commits, it prints something like `|node_version|-2-gabc1234`, which is also fine. +### Troubleshooting: uncommitted changes + +If you edited files tracked by Git (e.g. `docker-compose.yml`), the update stops with an error like: + +```{code-block} +:caption: Output +error: Your local changes to the following files would be overwritten by [merge|checkout]: + docker-compose.yml +Please commit your changes or stash them before you [merge|switch branches]. +Aborting +``` + +Nothing has been changed yet: your files and your version are as they were. +Commit your changes so they are kept, then update again. + +If `git branch --show-current` printed `work` (or another branch name): + +```bash +git commit -a -m "My local changes" +git merge --no-edit |node_version| +``` + +If it printed nothing, first create a branch so that your commit is not lost, then update with `git merge` (not `git switch --detach`): + +```bash +git switch -c work +git commit -a -m "My local changes" +git merge --no-edit |node_version| +``` + ## Update Python dependencies -With your virtual environment (or `conda` environment) activated, reinstall the dependencies in case they changed: +With your virtual environment (or `conda` environment) activated, run: ```bash -pip install -r requirements.txt # or: uv pip install -r requirements.txt +uv pip install -r requirements.txt # or: pip install -r requirements.txt ``` +This only installs packages that are new or changed in this version. + ## Restart the Fed-BioMed node Only do this if you have already started the node (see [Fed-BioMed node: Part 1](fedbiomed_node_part_1.md)):