From 108281babbdf003610959f3e27fb9273349f6d37 Mon Sep 17 00:00:00 2001 From: "Peter C. Petersen" Date: Sun, 8 Nov 2026 08:37:53 +0100 Subject: [PATCH] Remove unsupported API resources and portal Remove two retired models and the super portal. Update export documentation for format 2.x and bump the version to 2.1.1. --- CHANGELOG.md | 10 ++++++++++ README.md | 2 +- brainstem_api_tools/__init__.py | 2 +- brainstem_api_tools/brainstem_api_client.py | 5 +---- brainstem_api_tutorial.ipynb | 2 +- brainstem_api_tutorial.py | 2 +- pyproject.toml | 2 +- tests/test_client.py | 8 ++++++-- 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff7cbf..5ddb02e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 2.1.1 (unreleased) + +### Removed +- The models `dataacquisitionprocedure` and `admingroup`: BrainSTEM no longer serves them, so loading them + now raises "Unknown model" instead of requesting a route that returns 404. + +### Changed +- Documentation describes exports as format 2.x; www.brainstem.org writes 2.2, in which recordings link to + biology through experimental interfaces only. The client reads any 2.x export unchanged. + ## 2.1.0 (2026-11-07) Server requirements: BrainSTEM with the `specimen-1` data model, the project/session export API diff --git a/README.md b/README.md index 073c2cc..6c476fb 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ Both exports have this structure: ```text { "export_info": { - "format_version": "2.1", + "format_version": "2.2", "exported_at": "", "scope": "project", # or "session" "project_id": "", # null for a session export diff --git a/brainstem_api_tools/__init__.py b/brainstem_api_tools/__init__.py index 4b339fd..19c64d9 100644 --- a/brainstem_api_tools/__init__.py +++ b/brainstem_api_tools/__init__.py @@ -1,3 +1,3 @@ from .brainstem_api_client import BrainstemClient, ModelType, PortalType, AuthenticationError, ExportError -__version__ = "2.1.0" +__version__ = "2.1.1" diff --git a/brainstem_api_tools/brainstem_api_client.py b/brainstem_api_tools/brainstem_api_client.py index 077929b..f8396f0 100644 --- a/brainstem_api_tools/brainstem_api_client.py +++ b/brainstem_api_tools/brainstem_api_client.py @@ -41,7 +41,6 @@ "consumablestock": "modules", "dataacquisition": "modules", "dataacquisitioninterface": "modules", - "dataacquisitionprocedure": "modules", "dataacquisitiontemplate": "modules", "episodepersonnel": "modules", "equipment": "modules", @@ -109,7 +108,6 @@ "publication": "dissemination", "publicationapproval": "dissemination", # users - "admingroup": "users", "group": "users", "groupmembershipinvitation": "users", "groupmembershiprequest": "users", @@ -136,7 +134,7 @@ "ModelType", {k: k for k in [*_MODEL_TO_APP, *_MODEL_ALIASES]} ) -_VALID_PORTALS = {"private", "public", "super"} +_VALID_PORTALS = {"private", "public"} def _resolve_model(model) -> str: @@ -174,7 +172,6 @@ def _resolve_portal(portal) -> str: class PortalType(Enum): public = "public" private = "private" - super = "super" # --------------------------------------------------------------------------- diff --git a/brainstem_api_tutorial.ipynb b/brainstem_api_tutorial.ipynb index 7606c0a..6a40e76 100644 --- a/brainstem_api_tutorial.ipynb +++ b/brainstem_api_tutorial.ipynb @@ -406,7 +406,7 @@ "source": [ "## Exporting a project or a session\n", "\n", - "An export is one JSON document (format 2.1) with every record of the project or session you may read. Pass `background=True` for large projects: the server builds the file as a job and the client waits for it." + "An export is one JSON document (format 2.x) with every record of the project or session you may read. Pass `background=True` for large projects: the server builds the file as a job and the client waits for it." ] }, { diff --git a/brainstem_api_tutorial.py b/brainstem_api_tutorial.py index f831083..d41cc71 100644 --- a/brainstem_api_tutorial.py +++ b/brainstem_api_tutorial.py @@ -145,7 +145,7 @@ # Exporting a project or a session -## An export is one JSON document (format 2.1) with every record of the project +## An export is one JSON document (format 2.x) with every record of the project ## or session you may read. Pass background=True for large projects: the server ## builds the file as a job and the client waits for it. export = client.export_project("") diff --git a/pyproject.toml b/pyproject.toml index b145ba5..6a03797 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "brainstem_python_api_tools" -version = "2.1.0" +version = "2.1.1" description = "A Python toolset for interacting with the BrainSTEM API." readme = "README.md" license = { text = "MIT" } diff --git a/tests/test_client.py b/tests/test_client.py index 1f1ad7d..f4acf00 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -248,7 +248,7 @@ def test_load_invalid_model_raises(self): "experimentalinterface", "experimentalinterfacetemplate", "materialusage", "materialusagetemplate", "specimenprocedure", "specimenproceduretemplate", "specimenlog", "dataacquisitioninterface", "manipulationinterface", - "dataacquisitionprocedure", "proceduretemplate", "dataacquisitiontemplate", + "proceduretemplate", "dataacquisitiontemplate", "manipulationtemplate", "procedureepisode", "procedureepisodetemplate", "episodepersonnel"]], *[(m, "taxonomies") for m in [ @@ -261,6 +261,11 @@ def test_new_models_routed(self, model, expected_app): self.client.load(model) assert f"/api/private/{expected_app}/{model}/" in self.client._session.get.call_args[0][0] + @pytest.mark.parametrize("model", ["dataacquisitionprocedure", "admingroup"]) + def test_resources_the_server_removed_are_unknown(self, model): + with pytest.raises(ValueError, match="Unknown model"): + self.client.load(model) + def test_load_invalid_portal_raises(self): with pytest.raises(ValueError, match="Unknown portal"): self.client.load("session", portal="badportal") @@ -280,7 +285,6 @@ def test_old_underscored_names_resolve_with_warning(self, old, new, app): self.client.load(ModelType[old]) @pytest.mark.parametrize("model,app", [ - ("admingroup", "users"), ("speciesapproval", "taxonomies"), ("supplierapproval", "resources"), ("publicationapproval", "dissemination"),