Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Both exports have this structure:
```text
{
"export_info": {
"format_version": "2.1",
"format_version": "2.2",
"exported_at": "<ISO 8601 UTC timestamp>",
"scope": "project", # or "session"
"project_id": "<project uuid>", # null for a session export
Expand Down
2 changes: 1 addition & 1 deletion brainstem_api_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .brainstem_api_client import BrainstemClient, ModelType, PortalType, AuthenticationError, ExportError

__version__ = "2.1.0"
__version__ = "2.1.1"
5 changes: 1 addition & 4 deletions brainstem_api_tools/brainstem_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"consumablestock": "modules",
"dataacquisition": "modules",
"dataacquisitioninterface": "modules",
"dataacquisitionprocedure": "modules",
"dataacquisitiontemplate": "modules",
"episodepersonnel": "modules",
"equipment": "modules",
Expand Down Expand Up @@ -109,7 +108,6 @@
"publication": "dissemination",
"publicationapproval": "dissemination",
# users
"admingroup": "users",
"group": "users",
"groupmembershipinvitation": "users",
"groupmembershiprequest": "users",
Expand All @@ -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:
Expand Down Expand Up @@ -174,7 +172,6 @@ def _resolve_portal(portal) -> str:
class PortalType(Enum):
public = "public"
private = "private"
super = "super"


# ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion brainstem_api_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion brainstem_api_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<YOUR_PROJECT_UUID>")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
8 changes: 6 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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")
Expand All @@ -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"),
Expand Down
Loading