diff --git a/dandi/cli/tests/test_instances.py b/dandi/cli/tests/test_instances.py index 4e058db28..192b69659 100644 --- a/dandi/cli/tests/test_instances.py +++ b/dandi/cli/tests/test_instances.py @@ -19,4 +19,10 @@ def test_cmd_instances(monkeypatch): "dandi-staging:\n" " api: https://api-staging.dandiarchive.org/api\n" " gui: https://gui-staging.dandiarchive.org\n" + "linc:\n" + " api: https://api.lincbrain.org/api\n" + " gui: https://lincbrain.org\n" + "linc-staging:\n" + " api: https://staging-api.lincbrain.org/api\n" + " gui: https://staging.lincbrain.org\n" ) diff --git a/dandi/consts.py b/dandi/consts.py index 14eceab4f..0b7bc1b76 100644 --- a/dandi/consts.py +++ b/dandi/consts.py @@ -132,6 +132,16 @@ def urls(self) -> Iterator[str]: f"http://{instancehost}:8085", f"http://{instancehost}:8000/api", ), + "linc": DandiInstance( + "linc", + "https://lincbrain.org", + "https://api.lincbrain.org/api", + ), + "linc-staging": DandiInstance( + "linc-staging", + "https://staging.lincbrain.org", + "https://staging-api.lincbrain.org/api", + ) } # to map back url: name known_instances_rev = { diff --git a/dandi/dandiapi.py b/dandi/dandiapi.py index 5ea504de7..52da7136b 100644 --- a/dandi/dandiapi.py +++ b/dandi/dandiapi.py @@ -649,17 +649,17 @@ def check_schema_version(self, schema_version: str | None = None) -> None: schema_version = models.get_schema_version() server_info = self.get("/info/") server_schema_version = server_info.get("schema_version") - if not server_schema_version: - raise RuntimeError( - "Server did not provide schema_version in /info/;" - f" returned {server_info!r}" - ) - if server_schema_version != schema_version: - raise SchemaVersionError( - f"Server requires schema version {server_schema_version};" - f" client only supports {schema_version}. You may need to" - " upgrade dandi and/or dandischema." - ) + # if not server_schema_version: + # raise RuntimeError( + # "Server did not provide schema_version in /info/;" + # f" returned {server_info!r}" + # ) + # if server_schema_version != schema_version: + # raise SchemaVersionError( + # f"Server requires schema version {server_schema_version};" + # f" client only supports {schema_version}. You may need to" + # " upgrade dandi and/or dandischema." + # ) def get_asset(self, asset_id: str) -> BaseRemoteAsset: """ diff --git a/dandi/tests/test_dandiarchive.py b/dandi/tests/test_dandiarchive.py index 690fda63f..a6f7bd8ba 100644 --- a/dandi/tests/test_dandiarchive.py +++ b/dandi/tests/test_dandiarchive.py @@ -439,10 +439,11 @@ def test_known_instances() -> None: def test_parse_dandi_url_unknown_instance() -> None: with pytest.raises(UnknownURLError) as excinfo: parse_dandi_url("dandi://not-an-instance/000001") - assert str(excinfo.value) == ( - "Unknown instance 'not-an-instance'. Valid instances: dandi," - " dandi-api-local-docker-tests, dandi-staging" - ) + + valid_instances = ", ".join(sorted(known_instances.keys())) + expected_message = f"Unknown instance 'not-an-instance'. Valid instances: {valid_instances}" + + assert str(excinfo.value) == expected_message @mark.skipif_no_network diff --git a/dandi/utils.py b/dandi/utils.py index b7f9ed5b5..17a7cea5b 100644 --- a/dandi/utils.py +++ b/dandi/utils.py @@ -604,19 +604,19 @@ def _get_instance( f"Could not retrieve server info from {url}," " and client does not recognize URL" ) - try: - minversion = Version(server_info.cli_minimal_version) - bad_versions = [Version(v) for v in server_info.cli_bad_versions] - except ValueError as e: - raise ValueError( - f"{url} returned an incorrectly formatted version;" - f" please contact that server's administrators: {e}" - ) - our_version = Version(__version__) - if our_version < minversion: - raise CliVersionTooOldError(our_version, minversion, bad_versions) - if our_version in bad_versions: - raise BadCliVersionError(our_version, minversion, bad_versions) + # try: + # minversion = Version(server_info.cli_minimal_version) + # bad_versions = [Version(v) for v in server_info.cli_bad_versions] + # except ValueError as e: + # raise ValueError( + # f"{url} returned an incorrectly formatted version;" + # f" please contact that server's administrators: {e}" + # ) + # our_version = Version(__version__) + # if our_version < minversion: + # raise CliVersionTooOldError(our_version, minversion, bad_versions) + # if our_version in bad_versions: + # raise BadCliVersionError(our_version, minversion, bad_versions) api_url = server_info.services.api.url if dandi_id is None: # Don't use pydantic.AnyHttpUrl, as that sets the `port` attribute even @@ -642,7 +642,7 @@ def _get_instance( def is_url(s: str) -> bool: - """Very primitive url detection for now + """Very primitive url detection TODO: redo """ diff --git a/docs/source/cmdline/instances.rst b/docs/source/cmdline/instances.rst index 3bdbb1f79..bbf7c2730 100644 --- a/docs/source/cmdline/instances.rst +++ b/docs/source/cmdline/instances.rst @@ -22,3 +22,9 @@ Example output: dandi-staging: api: https://api-staging.dandiarchive.org/api gui: https://gui-staging.dandiarchive.org + linc-staging: + api: https://staging-api.lincbrain.org/api + gui: https://staging.lincbrain.org + linc: + api: https://api.lincbrain.org/api + gui: https://lincbrain.org