From cffee395f6f1ec88b6b0359142ab543c57ace24b Mon Sep 17 00:00:00 2001 From: Isaac To Date: Tue, 10 Mar 2026 11:14:01 -0700 Subject: [PATCH 01/23] build(hatch-env): specify env for conversion to LinkML and back Specify Hatch-managed env for auto converting `dandischema.models` to LinkML schema and back to Pydantic models --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index dca8b6b2..1d534fcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,12 @@ all = [ installer = "uv" python = "3.10" +# Env for auto converting `dandischema.models` to LinkML schema and back to Pydantic models +[tool.hatch.envs.linkml-auto-converted] +dependencies = [ + "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" +] + [tool.setuptools.packages.find] namespaces = true include = ["dandischema*"] From b5644c1a3558923707e5c2d4c08ab861876a6081 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Tue, 10 Mar 2026 11:43:36 -0700 Subject: [PATCH 02/23] build(hatch-env): provide script to translate `dandischema.models` Provide script to translate `dandischema.models` in to a LinkML schema and overly it with definition provided by an overlay file. --- dandischema/models_overlay.yaml | 4 ++++ pyproject.toml | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 dandischema/models_overlay.yaml diff --git a/dandischema/models_overlay.yaml b/dandischema/models_overlay.yaml new file mode 100644 index 00000000..69b1c3e2 --- /dev/null +++ b/dandischema/models_overlay.yaml @@ -0,0 +1,4 @@ +name: dandi-schema +id: https://schema.dandiarchive.org/s/dandi/v0.7 +version: 0.7.0 +status: eunal:concept-status/DRAFT diff --git a/pyproject.toml b/pyproject.toml index 1d534fcc..962caf07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,8 @@ python = "3.10" dependencies = [ "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] +[tool.hatch.envs.linkml-auto-converted.scripts] +2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml -o dandischema/models.yaml dandischema.models" [tool.setuptools.packages.find] namespaces = true From cfe3beacadeb5923a32b82a7187f724c268390f5 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Tue, 10 Mar 2026 12:22:13 -0700 Subject: [PATCH 03/23] build(hatch-env): provide script to translate `dandischema/models.yaml` Provide script to translate `dandischema/models.yaml` back to Pydantic models and store them in `dandischema/models.py` --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 962caf07..d51e4a19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,10 +65,12 @@ python = "3.10" # Env for auto converting `dandischema.models` to LinkML schema and back to Pydantic models [tool.hatch.envs.linkml-auto-converted] dependencies = [ + "black", # This allows `gen-pydantic` to format the generated Pydantic models with Black formatting "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] [tool.hatch.envs.linkml-auto-converted.scripts] 2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml -o dandischema/models.yaml dandischema.models" +2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models.py" [tool.setuptools.packages.find] namespaces = true From 73c46b6a4690ce492282b407c44d8052d69082e7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 16:42:59 -0400 Subject: [PATCH 04/23] Now we will sanitize the converted model addresses --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d51e4a19..5d6dcd32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ dependencies = [ "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] [tool.hatch.envs.linkml-auto-converted.scripts] -2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml -o dandischema/models.yaml dandischema.models" +2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' > dandischema/models.yaml " 2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models.py" [tool.setuptools.packages.find] From c79b1e2694c3d86b0813f84fca4455c37b9e58e0 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 18:32:09 -0400 Subject: [PATCH 05/23] more sanitization --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5d6dcd32..1792f36e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ dependencies = [ "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] [tool.hatch.envs.linkml-auto-converted.scripts] -2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' > dandischema/models.yaml " +2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -e 's,\\(.\\+\\):[0-9]\\+,\\1:NUMBER,g' > dandischema/models.yaml" 2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models.py" [tool.setuptools.packages.find] From 0b2b51dff340539dfea196319bf8c526d17ec71b Mon Sep 17 00:00:00 2001 From: Isaac To Date: Thu, 12 Mar 2026 20:07:21 -0700 Subject: [PATCH 06/23] feat: provide `prefixes` definition in the overlay file These prefixes are copied from https://github.com/dandi/schema/blob/master/releases/0.7.0/context.json --- dandischema/models_overlay.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dandischema/models_overlay.yaml b/dandischema/models_overlay.yaml index 69b1c3e2..f3e477bd 100644 --- a/dandischema/models_overlay.yaml +++ b/dandischema/models_overlay.yaml @@ -2,3 +2,27 @@ name: dandi-schema id: https://schema.dandiarchive.org/s/dandi/v0.7 version: 0.7.0 status: eunal:concept-status/DRAFT + +prefixes: + dandi: http://schema.dandiarchive.org/ + dcite: http://schema.dandiarchive.org/datacite/ + dandiasset: http://dandiarchive.org/asset/ + DANDI: http://dandiarchive.org/dandiset/ + dct: http://purl.org/dc/terms/ + owl: http://www.w3.org/2002/07/owl# + rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# + rdfa: http://www.w3.org/ns/rdfa# + rdfs: http://www.w3.org/2000/01/rdf-schema# + schema: http://schema.org/ + xsd: http://www.w3.org/2001/XMLSchema# + skos: http://www.w3.org/2004/02/skos/core# + prov: http://www.w3.org/ns/prov# + pav: http://purl.org/pav/ + nidm: http://purl.org/nidash/nidm# + uuid: http://uuid.repronim.org/ + rs: http://schema.repronim.org/ + RRID: "https://scicrunch.org/resolver/RRID:" + ORCID: https://orcid.org/ + ROR: https://ror.org/ + PATO: http://purl.obolibrary.org/obo/PATO_ + spdx: http://spdx.org/licenses/ From 6cb2f826c6c011d72ce7f7d9d91a985417da19ff Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 17:05:48 -0400 Subject: [PATCH 07/23] Added linkml: prefix and sorted all the entries --- dandischema/models_overlay.yaml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dandischema/models_overlay.yaml b/dandischema/models_overlay.yaml index f3e477bd..d10006bc 100644 --- a/dandischema/models_overlay.yaml +++ b/dandischema/models_overlay.yaml @@ -4,25 +4,26 @@ version: 0.7.0 status: eunal:concept-status/DRAFT prefixes: - dandi: http://schema.dandiarchive.org/ - dcite: http://schema.dandiarchive.org/datacite/ dandiasset: http://dandiarchive.org/asset/ DANDI: http://dandiarchive.org/dandiset/ + dandi: http://schema.dandiarchive.org/ + dcite: http://schema.dandiarchive.org/datacite/ dct: http://purl.org/dc/terms/ + linkml: https://w3id.org/linkml/ + nidm: http://purl.org/nidash/nidm# + ORCID: https://orcid.org/ owl: http://www.w3.org/2002/07/owl# - rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# + PATO: http://purl.obolibrary.org/obo/PATO_ + pav: http://purl.org/pav/ + prov: http://www.w3.org/ns/prov# rdfa: http://www.w3.org/ns/rdfa# + rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# + ROR: https://ror.org/ + RRID: "https://scicrunch.org/resolver/RRID:" + rs: http://schema.repronim.org/ schema: http://schema.org/ - xsd: http://www.w3.org/2001/XMLSchema# skos: http://www.w3.org/2004/02/skos/core# - prov: http://www.w3.org/ns/prov# - pav: http://purl.org/pav/ - nidm: http://purl.org/nidash/nidm# - uuid: http://uuid.repronim.org/ - rs: http://schema.repronim.org/ - RRID: "https://scicrunch.org/resolver/RRID:" - ORCID: https://orcid.org/ - ROR: https://ror.org/ - PATO: http://purl.obolibrary.org/obo/PATO_ spdx: http://spdx.org/licenses/ + uuid: http://uuid.repronim.org/ + xsd: http://www.w3.org/2001/XMLSchema# From 76526a9d49c2d591b57d1927bb7f6b271e318888 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 17:08:12 -0400 Subject: [PATCH 08/23] Provide default prefix to be custom dandi_default --- dandischema/models_overlay.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dandischema/models_overlay.yaml b/dandischema/models_overlay.yaml index d10006bc..983cbaaf 100644 --- a/dandischema/models_overlay.yaml +++ b/dandischema/models_overlay.yaml @@ -27,3 +27,5 @@ prefixes: spdx: http://spdx.org/licenses/ uuid: http://uuid.repronim.org/ xsd: http://www.w3.org/2001/XMLSchema# + +default_prefix: dandi_default From 7fa95c24c88d614c156a91d1ef2b955b500b7241 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 18:18:09 -0400 Subject: [PATCH 09/23] use portable ERE sed pattern for normalizing memory addresses The previous BRE pattern used `\+` (GNU sed extension) which silently fails on macOS BSD sed. Switch to `-E` (extended regex) with POSIX character class `[^[:space:]]` instead of `\S` (also unsupported by BSD sed), making the normalization work on both macOS and Linux. Co-Authored-By: Claude Sonnet 4.6 Expand comment for linkml-auto-converted hatch env with usage instructions Co-Authored-By: Claude Sonnet 4.6 --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1792f36e..316c271e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,14 +63,17 @@ installer = "uv" python = "3.10" # Env for auto converting `dandischema.models` to LinkML schema and back to Pydantic models +# To invoke conversion scripts provided by the environment, execute the following respective commands: +# `hatch run linkml-auto-converted:2linkml` # Convert dandischema.models -> dandischema/models.yaml +# `hatch run linkml-auto-converted:2pydantic` # Convert dandischema/models.yaml -> dandischema/models_linkml.py [tool.hatch.envs.linkml-auto-converted] dependencies = [ "black", # This allows `gen-pydantic` to format the generated Pydantic models with Black formatting "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] [tool.hatch.envs.linkml-auto-converted.scripts] -2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -e 's,\\(.\\+\\):[0-9]\\+,\\1:NUMBER,g' > dandischema/models.yaml" -2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models.py" +2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -E -e 's,([^[:space:]]+):[0-9]+,\\1:NUMBER,g' > dandischema/models.yaml" +2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models_linkml.py" [tool.setuptools.packages.find] namespaces = true From fad68793ea7408dba05467fb74b7e12996206b7c Mon Sep 17 00:00:00 2001 From: Isaac To Date: Mon, 16 Mar 2026 16:57:13 -0700 Subject: [PATCH 10/23] fix: correct `default_prefix` to `dandi` There is no prefix defined as `dandi_default`. The intended default prefix is `dandi` --- dandischema/models_overlay.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dandischema/models_overlay.yaml b/dandischema/models_overlay.yaml index 983cbaaf..6bcb0144 100644 --- a/dandischema/models_overlay.yaml +++ b/dandischema/models_overlay.yaml @@ -28,4 +28,4 @@ prefixes: uuid: http://uuid.repronim.org/ xsd: http://www.w3.org/2001/XMLSchema# -default_prefix: dandi_default +default_prefix: dandi From 5f78b87873728bccddc2c4ea469469d1c9003095 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 13 Mar 2026 18:22:41 -0400 Subject: [PATCH 11/23] Adding models_importstab.py so we could use it to import from converted and some symbols from _orig for now we do it so it does not overlay models.py since then git is unable to track renames --- dandischema/models_importstab.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 dandischema/models_importstab.py diff --git a/dandischema/models_importstab.py b/dandischema/models_importstab.py new file mode 100644 index 00000000..6815ca49 --- /dev/null +++ b/dandischema/models_importstab.py @@ -0,0 +1,9 @@ +from .models_linkml import * # noqa: F401,F403 +from .models_orig import DANDI_INSTANCE_URL_PATTERN # noqa: F401 + +# TODO: temporary imports of consts etc which might need to be 'redone' +# so we do not duplicate them + + +# TODO: do the extra tune ups like linking extra validations etc, +# potentially copied from models_orig.py From 0208c9c6eed6c6e4431f33e5d6dfb7b6fba3bffe Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:13:26 -0400 Subject: [PATCH 12/23] Adding the tool to assist in establishing "merges" with regeneration into linkml-auto-converted --- tools/linkml_conversion | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/linkml_conversion diff --git a/tools/linkml_conversion b/tools/linkml_conversion new file mode 100755 index 00000000..c34e803c --- /dev/null +++ b/tools/linkml_conversion @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Script which will force us to apply the changes we have +# + +set -eu + +ver=$(git describe linkml-conversion) + +# ensure we are clean to no side effects and are in +test -z "$(git status --porcelain)" || { echo "Git tree is dirty, aborting."; exit 1; } + +git checkout linkml-auto-converted + +git merge -s ours --no-commit linkml-conversion + +git read-tree -m -u linkml-conversion + +hatch run linkml-auto-converted:2linkml +hatch run linkml-auto-converted:2pydantic + +# add (re)generated files +git add dandischema/models_linkml.py dandischema/models.yaml + +# add our stab +git mv dandischema/models_importstab.py dandischema/models.py + +git commit -m '"Merged" with reconversion linkml-conversion $ver' -a From 488e2e94f74b2101e36c0ab74ed4c79d234e1721 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:18:02 -0400 Subject: [PATCH 13/23] We are doomed to use --no-verify for now as converted python code has flake8 issues --- tools/linkml_conversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index c34e803c..282d0565 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -25,4 +25,4 @@ git add dandischema/models_linkml.py dandischema/models.yaml # add our stab git mv dandischema/models_importstab.py dandischema/models.py -git commit -m '"Merged" with reconversion linkml-conversion $ver' -a +git commit -m '"Merged" with reconversion linkml-conversion $ver' -a --no-verify From 0ba5ad757e265992da110424ab3c2b83b3398bb7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:22:05 -0400 Subject: [PATCH 14/23] BF the commit version specification --- tools/linkml_conversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index 282d0565..21e74f09 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -25,4 +25,4 @@ git add dandischema/models_linkml.py dandischema/models.yaml # add our stab git mv dandischema/models_importstab.py dandischema/models.py -git commit -m '"Merged" with reconversion linkml-conversion $ver' -a --no-verify +git commit -m "'Merged' with reconversion linkml-conversion $ver" -a --no-verify From 2faf932ae562cd09ea0544810c9454812e58e3e1 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:38:34 -0400 Subject: [PATCH 15/23] Implement poor man patch queue --- tools/linkml_conversion | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index 21e74f09..abdb9f26 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -16,6 +16,19 @@ git merge -s ours --no-commit linkml-conversion git read-tree -m -u linkml-conversion +# Poor man patch queue implementation +# Edit this list if you want to merge or drop PRs branches to be patched with. +# Order matters +branches_to_merge=( remove-discriminated-unions ) + +# determine remote name based on what remote linkml-conversion is +# tracked from which should correspond to our main repo! +remote=$(git config branch.linkml-conversion.remote) + +for b in $"{branches_to_merge[@]}"; do + git diff "$remote"/master...$b | patch -p1 +done + hatch run linkml-auto-converted:2linkml hatch run linkml-auto-converted:2pydantic @@ -25,4 +38,7 @@ git add dandischema/models_linkml.py dandischema/models.yaml # add our stab git mv dandischema/models_importstab.py dandischema/models.py -git commit -m "'Merged' with reconversion linkml-conversion $ver" -a --no-verify +git commit -m "'Merged' with linkml-conversion $ver and ${#branches_to_merge[@]} branches + +branches merged: ${branches_to_merge[@]} +" -a --no-verify From c177479760b4ebb4d555cb427473dfcb708adfa5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:49:35 -0400 Subject: [PATCH 16/23] reflect that I rewritten how we handle patching we had to maintain original filename for models.py to apply patches easily --- tools/linkml_conversion | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index abdb9f26..c600b1df 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -35,7 +35,8 @@ hatch run linkml-auto-converted:2pydantic # add (re)generated files git add dandischema/models_linkml.py dandischema/models.yaml -# add our stab +# add our stab and rename original models.py +git mv dandischema/models.py dandischema/models_orig.py git mv dandischema/models_importstab.py dandischema/models.py git commit -m "'Merged' with linkml-conversion $ver and ${#branches_to_merge[@]} branches From 54cf276ede8a9da021395715e7d0935e101fc722 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 17:52:23 -0400 Subject: [PATCH 17/23] Inform on what we are doing --- tools/linkml_conversion | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index c600b1df..bd80abd0 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -25,8 +25,12 @@ branches_to_merge=( remove-discriminated-unions ) # tracked from which should correspond to our main repo! remote=$(git config branch.linkml-conversion.remote) -for b in $"{branches_to_merge[@]}"; do - git diff "$remote"/master...$b | patch -p1 +for b in ${branches_to_merge[@]}; do + b_ver=$(git describe "$remote"/$b) + echo "Applying branch $b with following differences" + git diff --stat "$remote"/master..."$remote"/$b + + git diff "$remote"/master..."$remote"/$b | patch -p1 done hatch run linkml-auto-converted:2linkml From 5eb4a91f695af0b2dbb948335e4e8bc9671d5f13 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 18:08:21 -0400 Subject: [PATCH 18/23] Now do patch diff of master in as well for good measure --- tools/linkml_conversion | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index bd80abd0..f2b8175b 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -5,11 +5,21 @@ set -eu -ver=$(git describe linkml-conversion) - # ensure we are clean to no side effects and are in test -z "$(git status --porcelain)" || { echo "Git tree is dirty, aborting."; exit 1; } +# determine remote name based on what remote linkml-conversion is +# tracked from which should correspond to our main repo! +remote=$(git config branch.linkml-conversion.remote) + +git checkout linkml-conversion +# ensure up to date! +git pull --ff-only + +ver=$(git describe linkml-conversion) + +master_mergebase=$(git merge-base $remote/master linkml-conversion) + git checkout linkml-auto-converted git merge -s ours --no-commit linkml-conversion @@ -19,18 +29,19 @@ git read-tree -m -u linkml-conversion # Poor man patch queue implementation # Edit this list if you want to merge or drop PRs branches to be patched with. # Order matters -branches_to_merge=( remove-discriminated-unions ) +branches_to_merge=( + master + remove-discriminated-unions +) -# determine remote name based on what remote linkml-conversion is -# tracked from which should correspond to our main repo! -remote=$(git config branch.linkml-conversion.remote) +echo "Applying patches from base $master_mergebase" for b in ${branches_to_merge[@]}; do b_ver=$(git describe "$remote"/$b) - echo "Applying branch $b with following differences" - git diff --stat "$remote"/master..."$remote"/$b + echo "Applying branch $b patch with following differences" + git diff --stat "$master_mergebase"..."$remote"/$b - git diff "$remote"/master..."$remote"/$b | patch -p1 + git diff "$master_mergebase"..."$remote"/$b | patch -p1 done hatch run linkml-auto-converted:2linkml From 76a9d771eacdf3da85a849d8f3951bdc12dc2844 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 18:12:13 -0400 Subject: [PATCH 19/23] Removing reporting branches - did not work --- tools/linkml_conversion | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index f2b8175b..cd94ea86 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -54,7 +54,4 @@ git add dandischema/models_linkml.py dandischema/models.yaml git mv dandischema/models.py dandischema/models_orig.py git mv dandischema/models_importstab.py dandischema/models.py -git commit -m "'Merged' with linkml-conversion $ver and ${#branches_to_merge[@]} branches - -branches merged: ${branches_to_merge[@]} -" -a --no-verify +git commit -m "'Merged' with linkml-conversion $ver and ${#branches_to_merge[@]} branches" -a --no-verify From c6172c4a7acdf0db4663d4a90663dc635d321a4f Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 18:25:27 -0400 Subject: [PATCH 20/23] ENH: patch converted to pydantic model to strip dciteCOLO --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 316c271e..009ed3c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ dependencies = [ ] [tool.hatch.envs.linkml-auto-converted.scripts] 2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -E -e 's,([^[:space:]]+):[0-9]+,\\1:NUMBER,g' > dandischema/models.yaml" -2pydantic = "gen-pydantic --black dandischema/models.yaml > dandischema/models_linkml.py" +2pydantic = "gen-pydantic --black dandischema/models.yaml | sed -e 's,dciteCOLON,,g' > dandischema/models_linkml.py" [tool.setuptools.packages.find] namespaces = true From e2d124cb93b9e2a046747be357d5d435d48c7813 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 20 Mar 2026 18:29:08 -0400 Subject: [PATCH 21/23] do pre-commit --- tools/linkml_conversion | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/linkml_conversion b/tools/linkml_conversion index cd94ea86..47cf02e1 100755 --- a/tools/linkml_conversion +++ b/tools/linkml_conversion @@ -54,4 +54,7 @@ git add dandischema/models_linkml.py dandischema/models.yaml git mv dandischema/models.py dandischema/models_orig.py git mv dandischema/models_importstab.py dandischema/models.py +# because we have pre-commit.ci doing that behind our back too! +pre-commit run --all || : + git commit -m "'Merged' with linkml-conversion $ver and ${#branches_to_merge[@]} branches" -a --no-verify From d8b1bea323a7c604cfe478a348f6fe1cd866a710 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Thu, 26 Mar 2026 11:56:49 -0700 Subject: [PATCH 22/23] feat: provide partial schema Provide a partial schema to be merged with the generated schema --- dandischema/models_merge.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 dandischema/models_merge.yaml diff --git a/dandischema/models_merge.yaml b/dandischema/models_merge.yaml new file mode 100644 index 00000000..17afaa9c --- /dev/null +++ b/dandischema/models_merge.yaml @@ -0,0 +1,7 @@ +# This file specifies a partial schema to be merged with the auto LinkML translation +# `dandischema.models`. It is a place to specify elements of the target dandischema +# LinkML schema that are not translatable from or not available in `dandischema.models` + +slots: + schemaKey: + designates_type: true From c0fbd02b95918d4aba4e593a4752689bb7f79cf4 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Thu, 26 Mar 2026 12:08:01 -0700 Subject: [PATCH 23/23] feat: enable `2linkml` to merge partial schema in `models_merge.yaml` --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 009ed3c9..c73d200a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ dependencies = [ "pydantic2linkml @ git+https://github.com/dandi/pydantic2linkml.git" ] [tool.hatch.envs.linkml-auto-converted.scripts] -2linkml = "pydantic2linkml -l INFO -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -E -e 's,([^[:space:]]+):[0-9]+,\\1:NUMBER,g' > dandischema/models.yaml" +2linkml = "pydantic2linkml -l INFO -M dandischema/models_merge.yaml -O dandischema/models_overlay.yaml dandischema.models | sed -e 's,0x[0-9a-ef]*,0xADDRESS,g' -E -e 's,([^[:space:]]+):[0-9]+,\\1:NUMBER,g' > dandischema/models.yaml" 2pydantic = "gen-pydantic --black dandischema/models.yaml | sed -e 's,dciteCOLON,,g' > dandischema/models_linkml.py" [tool.setuptools.packages.find]