Skip to content

Add vendorization support#2584

Merged
jjnesbitt merged 43 commits intomasterfrom
vendor-configurable
Nov 21, 2025
Merged

Add vendorization support#2584
jjnesbitt merged 43 commits intomasterfrom
vendor-configurable

Conversation

@candleindark
Copy link
Member

@candleindark candleindark commented Oct 3, 2025

This PR includes all the relevant commits (first 4) in #2430. Checkout #2430 for changes regarding those commits.

Additionally, this PR closes #2382 with the following changes.

Additionally, it replaces the hardcoded DAND:, the hardcoded RRID, and the supported licenses with the corresponding attributes in schema instance config defined in dandischema.conf.

Particularly, the hardcoded DAND: that are handled are

  • git grep DANDI: -- dandiapi | grep -v -e test_ -e 'subject=' -e 'verbose_name'

    • dandiapi/api/models/version.py: 'identifier': f'DANDI:{self.dandiset.identifier}',
    • dandiapi/api/models/version.py: 'id': f'DANDI:{self.dandiset.identifier}/{self.version}',
    • dandiapi/api/services/metadata/__init__.py: f'DANDI:{publishable_version.dandiset.identifier}/{publishable_version.version}'
    • dandiapi/api/tests/fuzzy.py:DANDISET_SCHEMA_ID_RE = Re(r'DANDI:\d{6}')
      • This is used in tests, so it is not replaced.
    • dandiapi/api/views/dandiset.py: identifier = identifier.removeprefix('DANDI:')
  • git grep DANDI: -- web | grep -v -e test_ -e 'subject=' -e 'verbose_name'

    • web/src/components/DandisetList.vue: DANDI:<b>{{ item.dandiset.identifier }}</b>
    • web/src/utils/schema.ts: deepCopySchema['properties']['identifier']['pattern'] = '^DANDI:\\d{6}$'
    • web/src/views/DandisetLandingView/DownloadDialog.vue: // Use the special 'DANDI:' url prefix if appropriate.
      • This is a comment. replacement not needed.
    • web/src/views/DandisetLandingView/DownloadDialog.vue: const dandiUrl = `DANDI:${identifier}`;
      • This is the shorten url for https://www.dandiarchive.org/. The hardcode doesn't need to be replaced. Make sure the containing function downloadCommand works for other instances of DANDI though. (See Add vendorization support #2584 (comment) for details)

TODO:

  • drop temporary commit "tmp: point dandi-cli integration test CI to a temporary branch of dandi-cli" used for testing
  • Answer for Add vendorization support #2584 (comment)
  • Handle the case where settings.DANDI_SCHEMA_INSTANCE_CONFIG.instance_identifier is None in metadata.py
  • Revert or drop temporary commit "tmp: temporarily set the dandischema dependency to the devendorize branch".
  • Have the dandischema dependency point to its release version of 0.12.0 once Vendor-Configurable Metadata Models dandi-schema#294 is merged and released as version of 0.12.0

Note

Incidentally, this PR also makes the following minor changes.

  • Improve metadata for PublishActivity by using the version of the dandi-archive instead of a hardcoded version number.

Release Notes

This PR makes the instance config as defined in dandischema.conf, per dandi/dandi-schema#294, available through the api/info/ endpoint and replaces the hardcoded DAND:, the hardcoded RRID, and the supported licenses with the corresponding attributes in schema instance config defined in dandischema.conf.

@candleindark
Copy link
Member Author

@mvandenburgh Why do we need the following line?

deepCopySchema['properties']['identifier']['pattern'] = '^DANDI:\\d{6}$'

The JSON schema of Dandiset already specifies the exact same pattern.

https://github.com/dandi/schema/blob/c90cd41cb18a29e75abaa13728c13125f38d8236/releases/0.6.10/dandiset.json#L1389

@candleindark
Copy link
Member Author

@mvandenburgh I don't think the DANDI: hardcoded at

const dandiUrl = `DANDI:${identifier}`;

needs to be replaced because it is a shortened URL for the https://dandiarchive.org instance. All instances of DANDI at other domain will just use the long URL.

@candleindark
Copy link
Member Author

@yarikoptic Should be bother to replace the hardcoded 'spdx:CC0-1.0' in the following?

It is one of the default supported licenses, and create_dev_dandiset is just for development.

@candleindark
Copy link
Member Author

@yarikoptic Should be bother to replace the hardcoded 'spdx:CC0-1.0' in the following?

It is one of the default supported licenses, and create_dev_dandiset is just for development.

@yarikoptic Never mind, I replaced the hardcoded license.

@candleindark candleindark marked this pull request as ready for review October 8, 2025 07:18
@yarikoptic
Copy link
Member

following up to the question to @mvandenburgh . So that TODO was added in

which added (2nd line unrelated, included for completness)

      // TODO: Fix this upstream in the schema
      schema['properties']['identifier']['pattern'] = '^DANDI:\\d{6}$'
      schema['$defs']['Project']['properties']['wasAssociatedWith']['items']['oneOf'][2]['properties']['identifier']['pattern'] = '^RRID:.*'

and it didn't reference any particular PR or even dandi-schema version. Looking at that commit state of dandi-schema it was

setup.py:        'dandischema==0.11.0',  # schema version 0.6.9

so used 0.6.9 schema. And the diff between the two is

❯ diff -Naur releases/0.6.{9,10}/dandiset.json
--- releases/0.6.9/dandiset.json	2025-01-17 15:27:21.826885797 -0500
+++ releases/0.6.10/dandiset.json	2025-05-16 16:02:57.225766934 -0400
@@ -1070,7 +1070,7 @@
           "default": null,
           "description": "RRID of the software from scicrunch.org.",
           "nskey": "schema",
-          "pattern": "^RRID\\:.*",
+          "pattern": "^RRID:.*",
           "title": "Research resource identifier",
           "type": "string"
         },
@@ -1203,7 +1203,7 @@
       "type": "string"
     },
     "schemaVersion": {
-      "default": "0.6.9",
+      "default": "0.6.10",
       "nskey": "schema",
       "readOnly": true,
       "title": "Schema Version",
@@ -1218,7 +1218,7 @@
     },
     "description": {
       "description": "A description of the Dandiset",
-      "maxLength": 3000,
+      "maxLength": 10000,
       "nskey": "schema",
       "title": "Description",
       "type": "string"
@@ -1386,7 +1386,7 @@
     "identifier": {
       "description": "A Dandiset identifier that can be resolved by identifiers.org.",
       "nskey": "schema",
-      "pattern": "^DANDI\\:\\d{6}$",
+      "pattern": "^DANDI:\\d{6}$",
       "readOnly": true,
       "title": "Dandiset identifier",
       "type": "string"

so it seems that the 0.6.10 had fixed the pattern and we can just remove that ad-hoc fixup of the schema. @mvandenburgh please confirm but meanwhile we proceed under such an assumption

@candleindark
Copy link
Member Author

@mvandenburgh I don't think the DANDI: hardcoded at

const dandiUrl = `DANDI:${identifier}`;

needs to be replaced because it is a shortened URL for the https://dandiarchive.org instance. All instances of DANDI at other domain will just use the long URL.

In our discussion about this, @yarikoptic concurred, so let's proceed with my initial judgement.

@candleindark candleindark force-pushed the vendor-configurable branch 3 times, most recently from ff5b077 to b9b2775 Compare October 9, 2025 16:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the DANDI archive codebase to utilize vendor-specific information from schema instance configuration instead of hardcoded values. The changes replace hardcoded DANDI: prefixes, RRID identifiers, and license lists with corresponding attributes from dandischema.conf.

  • Replaces hardcoded instance-specific strings with configuration-driven values
  • Updates metadata generation to use schema instance configuration
  • Adds frontend support for dynamic instance naming

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/src/types/index.ts Adds interface definition for instance configuration
web/src/components/DandisetList.vue Updates to display dynamic archive name instead of hardcoded "DANDI"
dev/.env.docker-compose-native Adds environment variable for instance name
dandiapi/settings/base.py Imports and configures schema instance configuration
dandiapi/api/views/dandiset.py Updates identifier prefix removal to use dynamic instance name
dandiapi/api/tests/test_version.py Updates test assertions to use schema configuration values
dandiapi/api/tests/test_tasks.py Updates test assertions for publish task metadata
dandiapi/api/tests/test_asset.py Updates test assertions for asset publishing
dandiapi/api/services/metadata/init.py Updates metadata ID generation to use dynamic instance name
dandiapi/api/models/version.py Updates version metadata to use configuration-driven identifiers
dandiapi/api/models/metadata.py Updates publish metadata to use dynamic instance configuration
dandiapi/api/management/commands/create_dev_dandiset.py Updates license selection to use configured licenses
.github/workflows/frontend-ci.yml Adds instance name environment variable
.github/workflows/cli-integration.yml Updates to use temporary test branch
.github/workflows/backend-ci.yml Adds instance configuration environment variables

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@candleindark candleindark force-pushed the rf-jsonschema-runtime-instance-config branch from b6104d2 to 689faaa Compare October 12, 2025 02:18
@jjnesbitt jjnesbitt force-pushed the vendor-configurable branch from 9c36d76 to 4ebd692 Compare November 6, 2025 16:00
Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jjnesbitt
Copy link
Member

@candleindark I believe from our end this is all set. The failing CLI tests will are fixed by dandi/dandi-cli#1739 (confirmed by this test run aimed at the CLI branch). At this point, we're just waiting for the dandi-schema PR to be merged and released. Then, we can proceed with this PR (dropping the temporary commits and merging).

Copy link
Member

@jjnesbitt jjnesbitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll just need to make sure to squash when we merge.

@yarikoptic
Copy link
Member

FWIW - https://pypi.org/project/dandischema/0.12.0/ is now out. Test against it?!

@jjnesbitt jjnesbitt added the minor Increment the minor version when merged label Nov 21, 2025
@jjnesbitt
Copy link
Member

The CLI integration tests are failing, which is expected and okay, since all of the tests see a schema version of 0.7.0, while expecting 0.6.10.

Per this comment, we will merge this PR first, and then the CLI PR.

@jjnesbitt jjnesbitt merged commit 1aed085 into master Nov 21, 2025
5 of 7 checks passed
@jjnesbitt jjnesbitt deleted the vendor-configurable branch November 21, 2025 16:15
@github-project-automation github-project-automation bot moved this from In Progress to Done in Multi-DANDI instance support Nov 21, 2025
@dandibot
Copy link
Member

🚀 PR was released in v0.20.0 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged released This issue/pull request has been released.

Projects

Development

Successfully merging this pull request may close these issues.

De/re-vendorize dandi-archive

7 participants